|
|
(2 intermediate revisions by one other user not shown) |
Line 1: |
Line 1: |
− | <script type="text/javascript">
| + | Logged in As AdminOmeka I was able to save these edits! |
− | jQuery(document).ready(function() {
| + | |
− | // Handle edit transcription page.
| + | LLLLL |
− | jQuery('#scripto-transcription-page-edit').click(function() {
| + | |
− | jQuery('#scripto-transcription-page-edit').
| + | Kfherbert added this |
− | prop('disabled', true).
| |
− | text('<?php echo __('Editing transcription...'); ?>');
| |
− | jQuery.post(
| |
− | <?php echo js_escape(url('scripto/index/page-action')); ?>,
| |
− | {
| |
− | page_action: 'edit',
| |
− | page: 'transcription',
| |
− | item_id: <?php echo js_escape($this->doc->getId()); ?>,
| |
− | file_id: <?php echo js_escape($this->doc->getPageId()); ?>,
| |
− | wikitext: jQuery('#scripto-transcription-page-wikitext').val()
| |
− | },
| |
− | function(data) {
| |
− | jQuery('#scripto-transcription-page-edit').
| |
− | prop('disabled', false).
| |
− | text('<?php echo __('Edit transcription'); ?>');
| |
− | jQuery('#scripto-transcription-page-html').html(data);
| |
− | }
| |
− | );
| |
− | });
| |
− | // Handle edit talk page.
| |
− | jQuery('#scripto-talk-page-edit').click(function() {
| |
− | jQuery('#scripto-talk-page-edit').
| |
− | prop('disabled', true).
| |
− | text('<?php echo __('Editing discussion...'); ?>');
| |
− | jQuery.post(
| |
− | <?php echo js_escape(url('scripto/index/page-action')); ?>,
| |
− | {
| |
− | page_action: 'edit',
| |
− | page: 'talk',
| |
− | item_id: <?php echo js_escape($this->doc->getId()); ?>,
| |
− | file_id: <?php echo js_escape($this->doc->getPageId()); ?>,
| |
− | wikitext: jQuery('#scripto-talk-page-wikitext').val()
| |
− | },
| |
− | function(data) {
| |
− | jQuery('#scripto-talk-page-edit').
| |
− | prop('disabled', false).
| |
− | text('<?php echo __('Edit discussion'); ?>');
| |
− | jQuery('#scripto-talk-page-html').html(data);
| |
− | }
| |
− | );
| |
− | });
| |
− | // Handle default transcription/talk visibility.
| |
− | if (window.location.hash == '#discussion') {
| |
− | jQuery('#scripto-transcription').hide();
| |
− | jQuery('#scripto-page-show').text('<?php echo __('show transcription'); ?>');
| |
− | } else {
| |
− | window.location.hash = '#transcription'
| |
− | jQuery('#scripto-talk').hide();
| |
− | jQuery('#scripto-page-show').text('<?php echo __('show discussion'); ?>');
| |
− | }
| |
− | // Handle transcription/talk visibility.
| |
− | jQuery('#scripto-page-show').click(function(event) {
| |
− | event.preventDefault();
| |
− | if ('#transcription' == window.location.hash) {
| |
− | window.location.hash = '#discussion';
| |
− | jQuery('#scripto-transcription').hide();
| |
− | jQuery('#scripto-talk').show();
| |
− | jQuery('#scripto-page-show').text('<?php echo __('show transcription'); ?>');
| |
− | } else {
| |
− | window.location.hash = '#transcription';
| |
− | jQuery('#scripto-talk').hide();
| |
− | jQuery('#scripto-transcription').show();
| |
− | jQuery('#scripto-page-show').text('<?php echo __('show discussion'); ?>');
| |
− | }
| |
− | });
| |
− | // Toggle show transcription edit.
| |
− | jQuery('#scripto-transcription-edit-show').click(function(event) {
| |
− | event.preventDefault();
| |
− | var clicks = jQuery(this).data('clicks');
| |
− | if (!clicks) {
| |
− | jQuery(this).text('<?php echo __('hide edit'); ?>');
| |
− | jQuery('#scripto-transcription-edit').slideDown('fast');
| |
− | } else {
| |
− | jQuery(this).text('<?php echo __('edit'); ?>');
| |
− | jQuery('#scripto-transcription-edit').slideUp('fast');
| |
− | }
| |
− | jQuery(this).data("clicks", !clicks);
| |
− | });
| |
− | // Toggle show talk edit.
| |
− | jQuery('#scripto-talk-edit-show').click(function(event) {
| |
− | event.preventDefault();
| |
− | var clicks = jQuery(this).data('clicks');
| |
− | if (!clicks) {
| |
− | jQuery(this).text('<?php echo __('hide edit'); ?>');
| |
− | jQuery('#scripto-talk-edit').slideDown('fast');
| |
− | } else {
| |
− | jQuery(this).text('<?php echo __('edit'); ?>');
| |
− | jQuery('#scripto-talk-edit').slideUp('fast');
| |
− | }
| |
− | jQuery(this).data("clicks", !clicks);
| |
− | });
| |
− | <?php if ($this->scripto->isLoggedIn()): ?>
| |
− | // Handle default un/watch page.
| |
− | <?php if ($this->doc->isWatchedPage()): ?>
| |
− | jQuery('#scripto-page-watch').
| |
− | data('watch', true).
| |
− | text('<?php echo __('Unwatch page'); ?>').
| |
− | css('float', 'none');
| |
− | <?php else: ?>
| |
− | jQuery('#scripto-page-watch').
| |
− | data('watch', false).
| |
− | text('<?php echo __('Watch page'); ?>').
| |
− | css('float', 'none');
| |
− | <?php endif; ?>
| |
− | // Handle un/watch page.
| |
− | jQuery('#scripto-page-watch').click(function() {
| |
− | if (!jQuery(this).data('watch')) {
| |
− | jQuery(this).prop('disabled', true).text('<?php echo __('Watching page...'); ?>');
| |
− | jQuery.post(
| |
− | <?php echo js_escape(url('scripto/index/page-action')); ?>,
| |
− | {
| |
− | page_action: 'watch',
| |
− | page: 'transcription',
| |
− | item_id: <?php echo js_escape($this->doc->getId()); ?>,
| |
− | file_id: <?php echo js_escape($this->doc->getPageId()); ?>
| |
− | },
| |
− | function(data) {
| |
− | jQuery('#scripto-page-watch').
| |
− | data('watch', true).
| |
− | prop('disabled', false).
| |
− | text('<?php echo __('Unwatch page'); ?>');
| |
− | }
| |
− | );
| |
− | } else {
| |
− | jQuery(this).prop('disabled', true).text('<?php echo __('Unwatching page...'); ?>');
| |
− | jQuery.post(
| |
− | <?php echo js_escape(url('scripto/index/page-action')); ?>,
| |
− | {
| |
− | page_action: 'unwatch',
| |
− | page: 'transcription',
| |
− | item_id: <?php echo js_escape($this->doc->getId()); ?>,
| |
− | file_id: <?php echo js_escape($this->doc->getPageId()); ?>
| |
− | },
| |
− | function(data) {
| |
− | jQuery('#scripto-page-watch').
| |
− | data('watch', false).
| |
− | prop('disabled', false).
| |
− | text('<?php echo __('Watch page'); ?>');
| |
− | }
| |
− | );
| |
− | }
| |
− | });
| |
− | <?php endif; // end isLoggedIn() ?>
| |
− | <?php if ($this->scripto->canProtect()): ?>
| |
− | // Handle default un/protect transcription page.
| |
− | <?php if ($this->doc->isProtectedTranscriptionPage()): ?>
| |
− | jQuery('#scripto-transcription-page-protect').
| |
− | data('protect', true).
| |
− | text('<?php echo __('Unprotect page'); ?>').
| |
− | css('float', 'none');
| |
− | <?php else: ?>
| |
− | jQuery('#scripto-transcription-page-protect').
| |
− | data('protect', false).
| |
− | text('<?php echo __('Protect page'); ?>').
| |
− | css('float', 'none');
| |
− | <?php endif; ?>
| |
− | // Handle un/protect transcription page.
| |
− | jQuery('#scripto-transcription-page-protect').click(function() {
| |
− | if (!jQuery(this).data('protect')) {
| |
− | jQuery(this).prop('disabled', true).text('<?php echo __('Protecting...'); ?>');
| |
− | jQuery.post(
| |
− | <?php echo js_escape(url('scripto/index/page-action')); ?>,
| |
− | {
| |
− | page_action: 'protect',
| |
− | page: 'transcription',
| |
− | item_id: <?php echo js_escape($this->doc->getId()); ?>,
| |
− | file_id: <?php echo js_escape($this->doc->getPageId()); ?>,
| |
− | wikitext: jQuery('#scripto-transcription-page-wikitext').val()
| |
− | },
| |
− | function(data) {
| |
− | jQuery('#scripto-transcription-page-protect').
| |
− | data('protect', true).
| |
− | prop('disabled', false).
| |
− | text('<?php echo __('Unprotect page'); ?>');
| |
− | }
| |
− | );
| |
− | } else {
| |
− | jQuery(this).prop('disabled', true).text('<?php echo __('Unprotecting page...'); ?>');
| |
− | jQuery.post(
| |
− | <?php echo js_escape(url('scripto/index/page-action')); ?>,
| |
− | {
| |
− | page_action: 'unprotect',
| |
− | page: 'transcription',
| |
− | item_id: <?php echo js_escape($this->doc->getId()); ?>,
| |
− | file_id: <?php echo js_escape($this->doc->getPageId()); ?>
| |
− | },
| |
− | function(data) {
| |
− | jQuery('#scripto-transcription-page-protect').
| |
− | data('protect', false).
| |
− | prop('disabled', false).
| |
− | text('<?php echo __('Protect page'); ?>');
| |
− | }
| |
− | );
| |
− | }
| |
− | });
| |
− | // Handle default un/protect talk page.
| |
− | <?php if ($this->doc->isProtectedTalkPage()): ?>
| |
− | jQuery('#scripto-talk-page-protect').
| |
− | data('protect', true).
| |
− | text('<?php echo __('Unprotect page'); ?>').
| |
− | css('float', 'none');
| |
− | <?php else: ?>
| |
− | jQuery('#scripto-talk-page-protect').
| |
− | data('protect', false).
| |
− | text('<?php echo __('Protect page'); ?>').
| |
− | css('float', 'none');
| |
− | <?php endif; ?>
| |
− | // Handle un/protect talk page.
| |
− | jQuery('#scripto-talk-page-protect').click(function() {
| |
− | if (!jQuery(this).data('protect')) {
| |
− | jQuery(this).
| |
− | prop('disabled', true).
| |
− | text('<?php echo __('Protecting page...'); ?>');
| |
− | jQuery.post(
| |
− | <?php echo js_escape(url('scripto/index/page-action')); ?>,
| |
− | {
| |
− | page_action: 'protect',
| |
− | page: 'talk',
| |
− | item_id: <?php echo js_escape($this->doc->getId()); ?>,
| |
− | file_id: <?php echo js_escape($this->doc->getPageId()); ?>
| |
− | },
| |
− | function(data) {
| |
− | jQuery('#scripto-talk-page-protect').
| |
− | data('protect', true).
| |
− | prop('disabled', false).
| |
− | text('<?php echo __('Unprotect page'); ?>');
| |
− | }
| |
− | );
| |
− | } else {
| |
− | jQuery(this).prop('disabled', true).text('<?php echo __('Unprotecting page...'); ?>');
| |
− | jQuery.post(
| |
− | <?php echo js_escape(url('scripto/index/page-action')); ?>,
| |
− | {
| |
− | page_action: 'unprotect',
| |
− | page: 'talk',
| |
− | item_id: <?php echo js_escape($this->doc->getId()); ?>,
| |
− | file_id: <?php echo js_escape($this->doc->getPageId()); ?>
| |
− | },
| |
− | function(data) {
| |
− | jQuery('#scripto-talk-page-protect').
| |
− | data('protect', false).
| |
− | prop('disabled', false).
| |
− | text('<?php echo __('Protect page'); ?>');
| |
− | }
| |
− | );
| |
− | }
| |
− | });
| |
− | <?php endif; // end canProtect() ?>
| |
− | <?php if ($this->scripto->canExport()): ?>
| |
− | jQuery('#scripto-transcription-page-import').click(function() {
| |
− | jQuery(this).prop('disabled', true).text('<?php echo __('Importing page...'); ?>');
| |
− | jQuery.post(
| |
− | <?php echo js_escape(url('scripto/index/page-action')); ?>,
| |
− | {
| |
− | page_action: 'import-page',
| |
− | page: 'transcription',
| |
− | item_id: <?php echo js_escape($this->doc->getId()); ?>,
| |
− | file_id: <?php echo js_escape($this->doc->getPageId()); ?>
| |
− | },
| |
− | function(data) {
| |
− | jQuery('#scripto-transcription-page-import').
| |
− | prop('disabled', false).
| |
− | text('<?php echo __('Import page'); ?>');
| |
− | }
| |
− | );
| |
− | });
| |
− | jQuery('#scripto-transcription-document-import').click(function() {
| |
− | jQuery(this).prop('disabled', true).text('<?php echo __('Importing document...'); ?>');
| |
− | jQuery.post(
| |
− | <?php echo js_escape(url('scripto/index/page-action')); ?>,
| |
− | {
| |
− | page_action: 'import-document',
| |
− | page: 'transcription',
| |
− | item_id: <?php echo js_escape($this->doc->getId()); ?>,
| |
− | file_id: <?php echo js_escape($this->doc->getPageId()); ?>
| |
− | },
| |
− | function(data) {
| |
− | jQuery('#scripto-transcription-document-import').
| |
− | prop('disabled', false).
| |
− | text('<?php echo __('Import document'); ?>');
| |
− | }
| |
− | );
| |
− | });
| |
− | <?php endif; // end canExport() ?>
| |
− | });
| |
− | </script>
| |