Ticket #3913: 3913b.diff
| File 3913b.diff, 53.2 KB (added by mdawaffe, 5 years ago) |
|---|
-
wp-includes/js/wp-ajax.js
1 <?php @require_once('../../wp-config.php'); cache_javascript_headers(); ?>2 1 var WPAjax = Class.create(); 3 2 Object.extend(WPAjax.prototype, Ajax.Request.prototype); 4 3 Object.extend(WPAjax.prototype, { 5 4 WPComplete: false, // onComplete function 6 5 WPError: false, // onWPError function 6 defaultUrl: '', // We get these from WPAjaxL10n 7 permText: '', 8 strangeText: '', 9 whoaText: '', 10 7 11 initialize: function(url, responseEl) { 8 12 var tempObj = this; 9 13 this.transport = Ajax.getTransport(); … … 19 23 tempObj.WPError(transport); 20 24 } 21 25 }); 22 this.url = url ? url : '<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php';26 this.url = url ? url : this.defaultUrl; 23 27 this.getResponseElement(responseEl); 24 28 }, 25 29 addArg: function(key, value) { … … 52 56 } 53 57 var r = parseInt(r,10); 54 58 if ( -1 == r ) { 55 Element.update(this.myResponseElement,"<div class='error'><p> <?php _e("You don't have permission to do that."); ?></p></div>");59 Element.update(this.myResponseElement,"<div class='error'><p>" + this.permText + "</p></div>"); 56 60 return false; 57 61 } else if ( 0 == r ) { 58 Element.update(this.myResponseElement,"<div class='error'><p> <?php _e("Something strange happened. Try refreshing the page."); ?></p></div>");62 Element.update(this.myResponseElement,"<div class='error'><p>" + this.strangeText + "</p></div>"); 59 63 return false; 60 64 } 61 65 return true; … … 71 75 } 72 76 }); 73 77 78 Event.observe( window, 'load', function() { Object.extend(WPAjax.prototype, WPAjaxL10n); }, false ) 79 74 80 Ajax.activeSendCount = 0; 75 81 Ajax.Responders.register( { 76 82 onCreate: function() { … … 79 85 return; 80 86 wpBeforeUnload = window.onbeforeunload; 81 87 window.onbeforeunload = function() { 82 return "<?php js_escape(__("Slow down, I'm still sending your data!")); ?>";88 return WPAjax.whoaText; 83 89 } 84 90 }, 85 91 onLoading: function() { // Can switch to onLoaded if we lose data -
wp-includes/js/list-manipulation.js
8 8 if ( !obj ) 9 9 obj=theList; 10 10 if ( !message ) 11 message = obj.delText.replace(/% /g, what);11 message = obj.delText.replace(/%thing%/g, what); 12 12 if( confirm(message) ) 13 13 return obj.ajaxDelete( what, id ); 14 14 else return false; … … 36 36 dataStore: null, 37 37 formStore: null, 38 38 39 jumpText: ' Jump to new item',40 delText: ' Are you sure you want to delete this %s?',39 jumpText: '', // We get these from listManL10n 40 delText: '', 41 41 42 42 initialize: function(theListId) { 43 43 this.theList = $(theListId ? theListId : 'the-list'); -
wp-includes/js/autosave-js.php
1 <?php @require_once('../../wp-config.php');2 cache_javascript_headers();3 ?>4 var autosaveLast = '';5 var autosavePeriodical;6 7 function autosave_start_timer() {8 var form = $('post');9 autosaveLast = form.post_title.value+form.content.value;10 // Keep autosave_interval in sync with edit_post().11 autosavePeriodical = new PeriodicalExecuter(autosave, <?php echo apply_filters('autosave_interval', '120'); ?>);12 //Disable autosave after the form has been submitted13 if(form.addEventListener) {14 form.addEventListener("submit", function () { autosavePeriodical.currentlyExecuting = true; }, false);15 }16 if(form.attachEvent) {17 form.save ? form.save.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null;18 form.submit ? form.submit.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null;19 form.publish ? form.publish.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null;20 form.deletepost ? form.deletepost.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null;21 }22 }23 addLoadEvent(autosave_start_timer)24 25 function autosave_cur_time() {26 var now = new Date();27 return "" + ((now.getHours() >12) ? now.getHours() -12 : now.getHours()) +28 ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes() +29 ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();30 }31 32 function autosave_update_nonce() {33 var response = nonceAjax.response;34 document.getElementsByName('_wpnonce')[0].value = response;35 }36 37 function autosave_update_post_ID() {38 var response = autosaveAjax.response;39 var res = parseInt(response);40 var message;41 42 if(isNaN(res)) {43 message = "<?php echo js_escape(__('Error: ')); ?>" + response;44 } else {45 message = "<?php echo js_escape(__('Saved at ')); ?>" + autosave_cur_time();46 $('post_ID').name = "post_ID";47 $('post_ID').value = res;48 // We need new nonces49 nonceAjax = new sack();50 nonceAjax.element = null;51 nonceAjax.setVar("action", "autosave-generate-nonces");52 nonceAjax.setVar("post_ID", res);53 nonceAjax.setVar("cookie", document.cookie);54 nonceAjax.setVar("post_type", $('post_type').value);55 nonceAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php";56 nonceAjax.onCompletion = autosave_update_nonce;57 nonceAjax.method = "POST";58 nonceAjax.runAJAX();59 $('hiddenaction').value = 'editpost';60 }61 $('autosave').innerHTML = message;62 autosave_enable_buttons();63 }64 65 function autosave_loading() {66 $('autosave').innerHTML = "<?php echo js_escape(__('Saving Draft...')); ?>";67 }68 69 function autosave_saved() {70 var response = autosaveAjax.response;71 var res = parseInt(response);72 var message;73 74 if(isNaN(res)) {75 message = "<?php echo js_escape(__('Error: ')); ?>" + response;76 } else {77 message = "<?php echo js_escape(__('Saved at ')); ?>" + autosave_cur_time() + ".";78 }79 $('autosave').innerHTML = message;80 autosave_enable_buttons();81 }82 83 function autosave_disable_buttons() {84 var form = $('post');85 form.save ? form.save.disabled = 'disabled' : null;86 form.submit ? form.submit.disabled = 'disabled' : null;87 form.publish ? form.publish.disabled = 'disabled' : null;88 form.deletepost ? form.deletepost.disabled = 'disabled' : null;89 setTimeout('autosave_enable_buttons();', 1000); // Re-enable 1 sec later. Just gives autosave a head start to avoid collisions.90 }91 92 function autosave_enable_buttons() {93 var form = $('post');94 form.save ? form.save.disabled = '' : null;95 form.submit ? form.submit.disabled = '' : null;96 form.publish ? form.publish.disabled = '' : null;97 form.deletepost ? form.deletepost.disabled = '' : null;98 }99 100 function autosave() {101 var form = $('post');102 var rich = ((typeof tinyMCE != "undefined") && tinyMCE.getInstanceById('content')) ? true : false;103 104 autosaveAjax = new sack();105 106 /* Gotta do this up here so we can check the length when tinyMCE is in use */107 if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) {108 autosaveAjax.setVar("content", form.content.value);109 } else {110 // Don't run while the TinyMCE spellcheck is on.111 if(tinyMCE.selectedInstance.spellcheckerOn) return;112 tinyMCE.wpTriggerSave();113 autosaveAjax.setVar("content", form.content.value);114 }115 116 if(form.post_title.value.length==0 || form.content.value.length==0 || form.post_title.value+form.content.value == autosaveLast)117 return;118 119 autosave_disable_buttons();120 121 autosaveLast = form.post_title.value+form.content.value;122 123 cats = document.getElementsByName("post_category[]");124 goodcats = ([]);125 for(i=0;i<cats.length;i++) {126 if(cats[i].checked)127 goodcats.push(cats[i].value);128 }129 catslist = goodcats.join(",");130 131 autosaveAjax.setVar("action", "autosave");132 autosaveAjax.setVar("cookie", document.cookie);133 autosaveAjax.setVar("catslist", catslist);134 autosaveAjax.setVar("post_ID", $("post_ID").value);135 autosaveAjax.setVar("post_title", form.post_title.value);136 autosaveAjax.setVar("post_type", form.post_type.value);137 if ( form.comment_status.checked )138 autosaveAjax.setVar("comment_status", 'open');139 if ( form.ping_status.checked )140 autosaveAjax.setVar("ping_status", 'open');141 if(form.excerpt)142 autosaveAjax.setVar("excerpt", form.excerpt.value);143 144 if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) {145 autosaveAjax.setVar("content", form.content.value);146 } else {147 tinyMCE.wpTriggerSave();148 autosaveAjax.setVar("content", form.content.value);149 }150 151 autosaveAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php";152 autosaveAjax.method = "POST";153 autosaveAjax.element = null;154 autosaveAjax.onLoading = autosave_loading;155 autosaveAjax.onInteractive = autosave_loading;156 if(parseInt($("post_ID").value) < 1)157 autosaveAjax.onCompletion = autosave_update_post_ID;158 else159 autosaveAjax.onCompletion = autosave_saved;160 autosaveAjax.runAJAX();161 } -
wp-includes/js/autosave.js
1 <?php @require_once('../../wp-config.php');2 cache_javascript_headers();3 ?>4 1 var autosaveLast = ''; 5 2 var autosavePeriodical; 6 3 … … 8 5 var form = $('post'); 9 6 autosaveLast = form.post_title.value+form.content.value; 10 7 // Keep autosave_interval in sync with edit_post(). 11 autosavePeriodical = new PeriodicalExecuter(autosave, <?php echo apply_filters('autosave_interval', '120'); ?>);8 autosavePeriodical = new PeriodicalExecuter(autosave, autosaveL10n.autosaveInterval); 12 9 //Disable autosave after the form has been submitted 13 10 if(form.addEventListener) { 14 11 form.addEventListener("submit", function () { autosavePeriodical.currentlyExecuting = true; }, false); … … 40 37 var message; 41 38 42 39 if(isNaN(res)) { 43 message = "<?php echo js_escape(__('Error: ')); ?>" + response;40 message = autosaveL10n.errorText.replace(/%response%/g, response); 44 41 } else { 45 message = "<?php echo js_escape(__('Saved at ')); ?>" + autosave_cur_time();42 message = autosaveL10n.saveText.replace(/%time%/g, autosave_cur_time()); 46 43 $('post_ID').name = "post_ID"; 47 44 $('post_ID').value = res; 48 45 // We need new nonces … … 52 49 nonceAjax.setVar("post_ID", res); 53 50 nonceAjax.setVar("cookie", document.cookie); 54 51 nonceAjax.setVar("post_type", $('post_type').value); 55 nonceAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php";52 nonceAjax.requestFile = autosaveL10n.requestFile; 56 53 nonceAjax.onCompletion = autosave_update_nonce; 57 54 nonceAjax.method = "POST"; 58 55 nonceAjax.runAJAX(); … … 63 60 } 64 61 65 62 function autosave_loading() { 66 $('autosave').innerHTML = "<?php echo js_escape(__('Saving Draft...')); ?>";63 $('autosave').innerHTML = autosaveL10n.savingText; 67 64 } 68 65 69 66 function autosave_saved() { … … 72 69 var message; 73 70 74 71 if(isNaN(res)) { 75 message = "<?php echo js_escape(__('Error: ')); ?>" + response;72 message = autosaveL10n.errorText.replace(/%response%/g, response); 76 73 } else { 77 message = "<?php echo js_escape(__('Saved at ')); ?>" + autosave_cur_time() + ".";74 message = autosaveL10n.saveText.replace(/%time%/g, autosave_cur_time()); 78 75 } 79 76 $('autosave').innerHTML = message; 80 77 autosave_enable_buttons(); … … 148 145 autosaveAjax.setVar("content", form.content.value); 149 146 } 150 147 151 autosaveAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php";148 autosaveAjax.requestFile = autosaveL10n.requestFile; 152 149 autosaveAjax.method = "POST"; 153 150 autosaveAjax.element = null; 154 151 autosaveAjax.onLoading = autosave_loading; -
wp-includes/js/wp-ajax-js.php
1 <?php @require_once('../../wp-config.php'); cache_javascript_headers(); ?>2 var WPAjax = Class.create();3 Object.extend(WPAjax.prototype, Ajax.Request.prototype);4 Object.extend(WPAjax.prototype, {5 WPComplete: false, // onComplete function6 WPError: false, // onWPError function7 initialize: function(url, responseEl) {8 var tempObj = this;9 this.transport = Ajax.getTransport();10 if ( !this.transport )11 return false;12 this.setOptions( {13 parameters: 'cookie=' + encodeURIComponent(document.cookie),14 onComplete: function(transport) { // transport = XMLHttpRequest object15 if ( tempObj.parseAjaxResponse() ) {16 if ( 'function' == typeof tempObj.WPComplete )17 tempObj.WPComplete(transport);18 } else if ( 'function' == typeof tempObj.WPError ) // if response corresponds to an error (bad data, say, not 404)19 tempObj.WPError(transport);20 }21 });22 this.url = url ? url : '<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php';23 this.getResponseElement(responseEl);24 },25 addArg: function(key, value) {26 var a = [];27 a[encodeURIComponent(key)] = encodeURIComponent(value);28 this.options.parameters = $H(this.options.parameters).merge($H(a));29 },30 getResponseElement: function(r) {31 var p = $(r + '-p');32 if ( !p ) {33 new Insertion.Bottom(r, "<span id='" + r + "-p'></span>");34 var p = $(r + '-p');35 }36 this.myResponseElement = p;37 },38 parseAjaxResponse: function() { // 1 = good, 0 = strange (bad data?), -1 = you lack permission39 if ( this.transport.responseXML && typeof this.transport.responseXML == 'object' && ( this.transport.responseXML.xml || 'undefined' == typeof this.transport.responseXML.xml ) ) {40 var err = this.transport.responseXML.getElementsByTagName('wp_error');41 if ( err[0] ) {42 var msg = $A(err).inject( '', function(a, b) { return a + '<p>' + b.firstChild.nodeValue + '</p>'; } );43 Element.update(this.myResponseElement,'<div class="error">' + msg + '</div>');44 return false;45 }46 return true;47 }48 var r = this.transport.responseText;49 if ( isNaN(r) ) {50 Element.update(this.myResponseElement,'<div class="error"><p>' + r + '</p></div>');51 return false;52 }53 var r = parseInt(r,10);54 if ( -1 == r ) {55 Element.update(this.myResponseElement,"<div class='error'><p><?php _e("You don't have permission to do that."); ?></p></div>");56 return false;57 } else if ( 0 == r ) {58 Element.update(this.myResponseElement,"<div class='error'><p><?php _e("Something strange happened. Try refreshing the page."); ?></p></div>");59 return false;60 }61 return true;62 },63 addOnComplete: function(f) {64 if ( 'function' == typeof f ) { var of = this.WPComplete; this.WPComplete = function(t) { if ( of ) of(t); f(t); } }65 },66 addOnWPError: function(f) {67 if ( 'function' == typeof f ) { var of = this.WPError; this.WPError = function(t) { if ( of ) of(t); f(t); } }68 },69 notInitialized: function() {70 return this.transport ? false : true;71 }72 });73 74 Ajax.activeSendCount = 0;75 Ajax.Responders.register( {76 onCreate: function() {77 Ajax.activeSendCount++;78 if ( 1 != Ajax.activeSendCount )79 return;80 wpBeforeUnload = window.onbeforeunload;81 window.onbeforeunload = function() {82 return "<?php js_escape(__("Slow down, I'm still sending your data!")); ?>";83 }84 },85 onLoading: function() { // Can switch to onLoaded if we lose data86 Ajax.activeSendCount--;87 if ( 0 != Ajax.activeSendCount )88 return;89 window.onbeforeunload = wpBeforeUnload;90 }91 });92 93 //Pretty func adapted from ALA http://www.alistapart.com/articles/gettingstartedwithajax94 function getNodeValue(tree,el){try { var r = tree.getElementsByTagName(el)[0].firstChild.nodeValue; } catch(err) { var r = null; } return r; } -
wp-includes/script-loader.php
19 19 $mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php'); 20 20 $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20070225' ); 21 21 $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0-0'); 22 $this->add( 'autosave', '/wp-includes/js/autosave-js.php', array('prototype', 'sack'), '20070116'); 23 $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '20070118'); 24 $this->add( 'listman', '/wp-includes/js/list-manipulation.js', array('wp-ajax', 'fat'), '20070305'); 22 $this->add( 'autosave', '/wp-includes/js/autosave.js', array('prototype', 'sack'), '20070306'); 23 $this->localize( 'autosave', 'autosaveL10n', array( 24 'autosaveInterval' => apply_filters('autosave_interval', '120'), 25 'errorText' => __('Error: %response%'), 26 'saveText' => __('Saved at %time%.'), 27 'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', 28 'savingText' => __('Saving Draft...') 29 ) ); 30 $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306'); 31 $this->localize( 'wp-ajax', 'WPAjaxL10n', array( 32 'defaultUrl' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', 33 'permText' => __("You don't have permission to do that."), 34 'strangeText' => __("Something strange happened. Try refreshing the page."), 35 'whoaText' => __("Slow down, I'm still sending your data!") 36 ) ); 37 $this->add( 'listman', '/wp-includes/js/list-manipulation.js', array('wp-ajax', 'fat'), '20070306'); 25 38 $this->localize( 'listman', 'listManL10n', array( 26 39 'jumpText' => __('Jump to new item'), 27 'delText' => __('Are you sure you want to delete this % s?')40 'delText' => __('Are you sure you want to delete this %thing%?') 28 41 ) ); 29 42 $this->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.7.0'); 30 43 $this->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.7.0'); … … 37 50 $this->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.1.1'); 38 51 $this->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.1.1'); 39 52 if ( is_admin() ) { 40 $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' ); 41 $this->add( 'ajaxcat', '/wp-admin/cat-js.php', array('listman'), '20070118' ); 53 global $pagenow; 54 $man = false; 55 switch ( $pagenow ) : 56 case 'post.php' : 57 case 'post-new.php' : 58 $man = 'postmeta'; 59 break; 60 case 'page.php' : 61 case 'page-new.php' : 62 $man = 'pagemeta'; 63 break; 64 case 'link.php' : 65 $man = 'linkmeta'; 66 break; 67 endswitch; 68 if ( $man ) { 69 $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key.js', array('dbx'), '20070306' ); 70 $this->localize( 'dbx-admin-key', 'dbxL10n', array( 71 'manager' => $man, 72 'open' => __('open'), 73 'close' => __('close'), 74 'moveMouse' => __('click-down and drag to move this box'), 75 'toggleMouse' => __('click to %toggle% this box'), 76 'moveKey' => __('use the arrow keys to move this box'), 77 'toggleKey' => __(', or press the enter key to %toggle% it'), 78 ) ); 79 } 80 $this->add( 'ajaxcat', '/wp-admin/cat.js', array('listman'), '20070306' ); 81 $this->localize( 'ajaxcat', 'catL10n', array( 82 'add' => attribute_escape(__('Add')), 83 'how' => __('Separate multiple categories with commas.') 84 ) ); 42 85 $this->add( 'admin-categories', '/wp-admin/categories.js', array('listman'), '3684' ); 43 86 $this->add( 'admin-custom-fields', '/wp-admin/custom-fields.js', array('listman'), '3733' ); 44 87 $this->add( 'admin-comments', '/wp-admin/edit-comments.js', array('listman'), '3847' ); 45 88 $this->add( 'admin-users', '/wp-admin/users.js', array('listman'), '4583' ); 46 89 $this->add( 'xfn', '/wp-admin/xfn.js', false, '3517' ); 47 $this->add( 'upload', '/wp-admin/upload-js.php', array('prototype'), '20070118' ); 90 $this->add( 'upload', '/wp-admin/upload.js', array('prototype'), '20070306' ); 91 $this->localize( 'upload', 'uploadL10n', array( 92 'browseTitle' => attribute_escape(__('Browse your files')), 93 'back' => __('« Back'), 94 'directTitle' => attribute_escape(__('Direct link to file')), 95 'edit' => __('Edit'), 96 'thumb' => __('Thumbnail'), 97 'full' => __('Full size'), 98 'icon' => __('Icon'), 99 'title' => __('Title'), 100 'show' => __('Show:'), 101 'link' => __('Link to:'), 102 'file' => __('File'), 103 'page' => __('Page'), 104 'none' => __('None'), 105 'editorText' => attribute_escape(__('Send to editor »')), 106 'insert' => __('Insert'), 107 'urlText' => __('URL'), 108 'desc' => __('Description'), 109 'deleteText' => attribute_escape(__('Delete File')), 110 'saveText' => attribute_escape(__('Save »')), 111 'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.") 112 ) ); 48 113 } 49 114 } 50 115 -
wp-admin/upload-js.php
1 <?php require_once('admin.php'); cache_javascript_headers(); ?>2 addLoadEvent( function() {3 theFileList = {4 currentImage: {ID: 0},5 nonce: '',6 tab: '',7 postID: 0,8 9 initializeVars: function() {10 this.urlData = document.location.href.split('?');11 this.params = this.urlData[1].toQueryParams();12 this.postID = this.params['post_id'];13 this.tab = this.params['tab'];14 this.style = this.params['style'];15 this.ID = this.params['ID'];16 if ( !this.style )17 this.style = 'default';18 var nonceEl = $('nonce-value');19 if ( nonceEl )20 this.nonce = nonceEl.value;21 if ( this.ID ) {22 this.grabImageData( this.ID );23 this.imageView( this.ID );24 }25 },26 27 initializeLinks: function() {28 if ( this.ID )29 return;30 $$('a.file-link').each( function(i) {31 var id = i.id.split('-').pop();32 i.onclick = function(e) { theFileList[ 'inline' == theFileList.style ? 'imageView' : 'editView' ](id, e); }33 } );34 },35 36 grabImageData: function(id) {37 if ( id == this.currentImage.ID )38 return;39 var thumbEl = $('attachment-thumb-url-' + id);40 if ( thumbEl ) {41 this.currentImage.thumb = ( 0 == id ? '' : thumbEl.value );42 this.currentImage.thumbBase = ( 0 == id ? '' : $('attachment-thumb-url-base-' + id).value );43 } else {44 this.currentImage.thumb = false;45 }46 this.currentImage.src = ( 0 == id ? '' : $('attachment-url-' + id).value );47 this.currentImage.srcBase = ( 0 == id ? '' : $('attachment-url-base-' + id).value );48 this.currentImage.page = ( 0 == id ? '' : $('attachment-page-url-' + id).value );49 this.currentImage.title = ( 0 == id ? '' : $('attachment-title-' + id).value );50 this.currentImage.description = ( 0 == id ? '' : $('attachment-description-' + id).value );51 var widthEl = $('attachment-width-' + id);52 if ( widthEl ) {53 this.currentImage.width = ( 0 == id ? '' : widthEl.value );54 this.currentImage.height = ( 0 == id ? '' : $('attachment-height-' + id).value );55 } else {56 this.currentImage.width = false;57 this.currentImage.height = false;58 }59 this.currentImage.isImage = ( 0 == id ? 0 : $('attachment-is-image-' + id).value );60 this.currentImage.ID = id;61 },62 63 imageView: function(id, e) {64 this.prepView(id);65 var h = '';66 67 h += "<div id='upload-file'>"68 if ( this.ID ) {69 var params = $H(this.params);70 params.ID = '';71 params.action = '';72 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('« Back')); ?></a>";73 } else {74 h += "<a href='#' onclick='return theFileList.cancelView();' title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('« Back')) ?></a>";75 }76 h += "<div id='file-title'>"77 if ( 0 == this.currentImage.isImage )78 h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo attribute_escape(__('Direct link to file')); ?>'>" + this.currentImage.title + "</a></h2>";79 else80 h += "<h2>" + this.currentImage.title + "</h2>";81 h += " — <span>";82 h += "<a href='#' onclick='return theFileList.editView(" + id + ");'><?php echo attribute_escape(__('Edit')); ?></a>"83 h += "</span>";84 h += '</div>'85 h += "<div id='upload-file-view' class='alignleft'>";86 if ( 1 == this.currentImage.isImage ) {87 h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo attribute_escape(__('Direct link to file')); ?>'>";88 h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";89 h += "</a>";90 } else91 h += ' ';92 h += "</div>";93 94 h += "<form name='uploadoptions' id='uploadoptions' class='alignleft'>";95 h += "<table>";96 var display = [];97 var checked = 'display-title';98 if ( 1 == this.currentImage.isImage ) {99 checked = 'display-full';100 if ( this.currentImage.thumb ) {101 display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> <?php echo attribute_escape(__('Thumbnail')); ?></label><br />");102 checked = 'display-thumb';103 }104 display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> <?php echo attribute_escape(__('Full size')); ?></label>");105 } else if ( this.currentImage.thumb ) {106 display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> <?php echo attribute_escape(__('Icon')); ?></label>");107 }108 if ( display.length ) {109 display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> <?php echo attribute_escape(__('Title')); ?></label>");110 h += "<tr><th style='padding-bottom:.5em'><?php echo attribute_escape(__('Show:')); ?></th><td style='padding-bottom:.5em'>";111 $A(display).each( function(i) { h += i; } );112 h += "</td></tr>";113 }114 115 h += "<tr><th><?php echo attribute_escape(__('Link to:')); ?></th><td>";116 h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> <?php echo attribute_escape(__('File')); ?></label><br />";117 h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> <?php echo attribute_escape(__('Page')); ?></label><br />";118 h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> <?php echo attribute_escape(__('None')); ?></label>";119 h += "</td></tr>";120 121 h += "<tr><td colspan='2'><p class='submit'>";122 h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='<?php echo attribute_escape(__('Send to editor »')); ?>' />";123 h += "</p></td></tr></table>";124 h += "</form>";125 126 h += "</div>";127 128 new Insertion.Top('upload-content', h);129 var displayEl = $(checked);130 if ( displayEl )131 displayEl.checked = true;132 133 if (e) Event.stop(e);134 return false;135 },136 137 editView: function(id, e) {138 this.prepView(id);139 var h = '';140 141 var action = 'upload.php?style=' + this.style + '&tab=upload';142 if ( this.postID )143 action += '&post_id=' + this.postID;144 145 h += "<form id='upload-file' method='post' action='" + action + "'>";146 if ( this.ID ) {147 var params = $H(this.params);148 params.ID = '';149 params.action = '';150 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('« Back')); ?></a>";151 } else {152 h += "<a href='#' onclick='return theFileList.cancelView();' title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('« Back')); ?></a>";153 }154 h += "<div id='file-title'>"155 if ( 0 == this.currentImage.isImage )156 h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo attribute_escape(__('Direct link to file')); ?>'>" + this.currentImage.title + "</a></h2>";157 else158 h += "<h2>" + this.currentImage.title + "</h2>";159 h += " — <span>";160 h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'><?php echo attribute_escape(__('Insert')); ?></a>"161 h += "</span>";162 h += '</div>'163 h += "<div id='upload-file-view' class='alignleft'>";164 if ( 1 == this.currentImage.isImage ) {165 h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo wp_specialchars(__('Direct link to file')); ?>'>";166 h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";167 h += "</a>";168 } else169 h += ' ';170 h += "</div>";171 172 173 h += "<table><col /><col class='widefat' /><tr>"174 h += "<th scope='row'><label for='url'><?php echo attribute_escape(__('URL')); ?></label></th>";175 h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>";176 h += "</tr><tr>";177 h += "<th scope='row'><label for='post_title'><?php echo attribute_escape(__('Title')); ?></label></th>";178 h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>";179 h += "</tr><tr>";180 h += "<th scope='row'><label for='post_content'><?php echo attribute_escape(__('Description')); ?></label></th>";181 h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>";182 h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='<?php echo attribute_escape(__('Delete File')); ?>' onclick='theFileList.deleteFile(" + id + ");' />";183 h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />";184 h += "<input type='hidden' name='action' id='action-value' value='save' />";185 h += "<input type='hidden' name='ID' value='" + id + "' />";186 h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />";187 h += "<div class='submit'><input type='submit' value='<?php echo attribute_escape(__('Save »')); ?>' /></div>";188 h += "</td></tr></table></form>";189 190 new Insertion.Top('upload-content', h);191 if (e) Event.stop(e);192 return false;193 },194 195 prepView: function(id) {196 this.cancelView( true );197 var filesEl = $('upload-files');198 if ( filesEl )199 filesEl.hide();200 var navEl = $('current-tab-nav');201 if ( navEl )202 navEl.hide();203 this.grabImageData(id);204 },205 206 cancelView: function( prep ) {207 if ( !prep ) {208 var filesEl = $('upload-files');209 if ( filesEl )210 Element.show(filesEl);211 var navEl = $('current-tab-nav');212 if ( navEl )213 Element.show(navEl);214 }215 if ( !this.ID )216 this.grabImageData(0);217 var div = $('upload-file');218 if ( div )219 Element.remove(div);220 return false;221 },222 223 sendToEditor: function(id) {224 this.grabImageData(id);225 var link = '';226 var display = '';227 var h = '';228 229 link = $A(document.forms.uploadoptions.elements.link).detect( function(i) { return i.checked; } ).value;230 displayEl = $A(document.forms.uploadoptions.elements.display).detect( function(i) { return i.checked; } )231 if ( displayEl )232 display = displayEl.value;233 else if ( 1 == this.currentImage.isImage )234 display = 'full';235 236 if ( 'none' != link )237 h += "<a href='" + ( 'file' == link ? ( this.currentImage.srcBase + this.currentImage.src ) : ( this.currentImage.page + "' rel='attachment wp-att-" + this.currentImage.ID ) ) + "' title='" + this.currentImage.title + "'>";238 if ( display && 'title' != display )239 h += "<img src='" + ( 'thumb' == display ? ( this.currentImage.thumbBase + this.currentImage.thumb ) : ( this.currentImage.srcBase + this.currentImage.src ) ) + "' alt='" + this.currentImage.title + "' />";240 else241 h += this.currentImage.title;242 if ( 'none' != link )243 h += "</a>";244 245 var win = window.opener ? window.opener : window.dialogArguments;246 if ( !win )247 win = top;248 tinyMCE = win.tinyMCE;249 if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') ) {250 tinyMCE.selectedInstance.getWin().focus();251 tinyMCE.execCommand('mceInsertContent', false, h);252 } else253 win.edInsertContent(win.edCanvas, h);254 if ( !this.ID )255 this.cancelView();256 return false;257 },258 259 deleteFile: function(id) {260 if ( confirm("<?php printf(js_escape(__("Are you sure you want to delete the file '%s'?\nClick ok to delete or cancel to go back.")), '" + this.currentImage.title + "'); ?>") ) {261 $('action-value').value = 'delete';262 $('upload-file').submit();263 return true;264 }265 return false;266 }267 268 };269 theFileList.initializeVars();270 theFileList.initializeLinks();271 } ); -
wp-admin/upload.js
1 <?php require_once('admin.php'); cache_javascript_headers(); ?>2 1 addLoadEvent( function() { 3 2 theFileList = { 4 3 currentImage: {ID: 0}, … … 69 68 var params = $H(this.params); 70 69 params.ID = ''; 71 70 params.action = ''; 72 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('« Back')); ?></a>";71 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'"; 73 72 } else { 74 h += "<a href='#' onclick='return theFileList.cancelView();' title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('« Back')) ?></a>";73 h += "<a href='#' onclick='return theFileList.cancelView();'"; 75 74 } 75 h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>"; 76 76 h += "<div id='file-title'>" 77 77 if ( 0 == this.currentImage.isImage ) 78 h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title=' <?php echo attribute_escape(__('Direct link to file')); ?>'>" + this.currentImage.title + "</a></h2>";78 h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>"; 79 79 else 80 80 h += "<h2>" + this.currentImage.title + "</h2>"; 81 81 h += " — <span>"; 82 h += "<a href='#' onclick='return theFileList.editView(" + id + ");'> <?php echo attribute_escape(__('Edit')); ?></a>"82 h += "<a href='#' onclick='return theFileList.editView(" + id + ");'>" + this.edit + "</a>" 83 83 h += "</span>"; 84 84 h += '</div>' 85 85 h += "<div id='upload-file-view' class='alignleft'>"; 86 86 if ( 1 == this.currentImage.isImage ) { 87 h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title=' <?php echo attribute_escape(__('Direct link to file')); ?>'>";87 h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>"; 88 88 h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />"; 89 89 h += "</a>"; 90 90 } else … … 98 98 if ( 1 == this.currentImage.isImage ) { 99 99 checked = 'display-full'; 100 100 if ( this.currentImage.thumb ) { 101 display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> <?php echo attribute_escape(__('Thumbnail')); ?></label><br />");101 display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.thumb + "</label><br />"); 102 102 checked = 'display-thumb'; 103 103 } 104 display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> <?php echo attribute_escape(__('Full size')); ?></label>");104 display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> " + this.full + "</label>"); 105 105 } else if ( this.currentImage.thumb ) { 106 display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> <?php echo attribute_escape(__('Icon')); ?></label>");106 display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.icon + "</label>"); 107 107 } 108 108 if ( display.length ) { 109 display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> <?php echo attribute_escape(__('Title')); ?></label>");110 h += "<tr><th style='padding-bottom:.5em'> <?php echo attribute_escape(__('Show:')); ?></th><td style='padding-bottom:.5em'>";109 display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> " + this.title + "</label>"); 110 h += "<tr><th style='padding-bottom:.5em'>" + this.show + "</th><td style='padding-bottom:.5em'>"; 111 111 $A(display).each( function(i) { h += i; } ); 112 112 h += "</td></tr>"; 113 113 } 114 114 115 h += "<tr><th> <?php echo attribute_escape(__('Link to:')); ?></th><td>";116 h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> <?php echo attribute_escape(__('File')); ?></label><br />";117 h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> <?php echo attribute_escape(__('Page')); ?></label><br />";118 h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> <?php echo attribute_escape(__('None')); ?></label>";115 h += "<tr><th>" + this.link + "</th><td>"; 116 h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> " + this.file + "</label><br />"; 117 h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> " + this.page + "</label><br />"; 118 h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> " + this.none + "</label>"; 119 119 h += "</td></tr>"; 120 120 121 121 h += "<tr><td colspan='2'><p class='submit'>"; 122 h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value=' <?php echo attribute_escape(__('Send to editor »')); ?>' />";122 h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='" + this.editorText + "' />"; 123 123 h += "</p></td></tr></table>"; 124 124 h += "</form>"; 125 125 … … 147 147 var params = $H(this.params); 148 148 params.ID = ''; 149 149 params.action = ''; 150 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('« Back')); ?></a>";150 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'"; 151 151 } else { 152 h += "<a href='#' onclick='return theFileList.cancelView();' title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('« Back')); ?></a>";152 h += "<a href='#' onclick='return theFileList.cancelView();'"; 153 153 } 154 h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>"; 154 155 h += "<div id='file-title'>" 155 156 if ( 0 == this.currentImage.isImage ) 156 h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title=' <?php echo attribute_escape(__('Direct link to file')); ?>'>" + this.currentImage.title + "</a></h2>";157 h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>"; 157 158 else 158 159 h += "<h2>" + this.currentImage.title + "</h2>"; 159 160 h += " — <span>"; 160 h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'> <?php echo attribute_escape(__('Insert')); ?></a>"161 h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'>" + this.insert + "</a>"; 161 162 h += "</span>"; 162 163 h += '</div>' 163 164 h += "<div id='upload-file-view' class='alignleft'>"; 164 165 if ( 1 == this.currentImage.isImage ) { 165 h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title=' <?php echo wp_specialchars(__('Direct link to file')); ?>'>";166 h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>"; 166 167 h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />"; 167 168 h += "</a>"; 168 169 } else … … 170 171 h += "</div>"; 171 172 172 173 173 h += "<table><col /><col class='widefat' /><tr>" 174 h += "<th scope='row'><label for='url'> <?php echo attribute_escape(__('URL')); ?></label></th>";174 h += "<table><col /><col class='widefat' /><tr>"; 175 h += "<th scope='row'><label for='url'>" + this.urlText + "</label></th>"; 175 176 h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>"; 176 177 h += "</tr><tr>"; 177 h += "<th scope='row'><label for='post_title'> <?php echo attribute_escape(__('Title')); ?></label></th>";178 h += "<th scope='row'><label for='post_title'>" + this.title + "</label></th>"; 178 179 h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>"; 179 180 h += "</tr><tr>"; 180 h += "<th scope='row'><label for='post_content'> <?php echo attribute_escape(__('Description')); ?></label></th>";181 h += "<th scope='row'><label for='post_content'>" + this.desc + "</label></th>"; 181 182 h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>"; 182 h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value=' <?php echo attribute_escape(__('Delete File')); ?>' onclick='theFileList.deleteFile(" + id + ");' />";183 h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='" + this.deleteText + "' onclick='theFileList.deleteFile(" + id + ");' />"; 183 184 h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />"; 184 185 h += "<input type='hidden' name='action' id='action-value' value='save' />"; 185 186 h += "<input type='hidden' name='ID' value='" + id + "' />"; 186 187 h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />"; 187 h += "<div class='submit'><input type='submit' value=' <?php echo attribute_escape(__('Save »')); ?>' /></div>";188 h += "<div class='submit'><input type='submit' value='" + this.saveText + "' /></div>"; 188 189 h += "</td></tr></table></form>"; 189 190 190 191 new Insertion.Top('upload-content', h); … … 257 258 }, 258 259 259 260 deleteFile: function(id) { 260 if ( confirm( "<?php printf(js_escape(__("Are you sure you want to delete the file '%s'?\nClick ok to delete or cancel to go back.")), '" + this.currentImage.title + "'); ?>") ) {261 if ( confirm( this.confirmText.replace(/%title%/g, this.currentImage.title) ) ) { 261 262 $('action-value').value = 'delete'; 262 263 $('upload-file').submit(); 263 264 return true; … … 266 267 } 267 268 268 269 }; 270 Object.extend( theFileList, uploadL10n ); 269 271 theFileList.initializeVars(); 270 272 theFileList.initializeLinks(); 271 273 } ); -
wp-admin/cat-js.php
1 <?php2 require_once('../wp-config.php');3 cache_javascript_headers();4 ?>5 addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.topAdder=1;catList.alt=0;catList.showLink=0;});6 addLoadEvent(newCatAddIn);7 function newCatAddIn() {8 var jaxcat = $('jaxcat');9 if ( !jaxcat )10 return false;11 Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="<?php echo js_escape(__('Add')); ?>"/><span id="howto"><?php echo js_escape(__('Separate multiple categories with commas.')); ?></span></span>');12 $('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); };13 $('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); };14 } -
wp-admin/cat.js
1 <?php2 require_once('../wp-config.php');3 cache_javascript_headers();4 ?>5 1 addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.topAdder=1;catList.alt=0;catList.showLink=0;}); 6 2 addLoadEvent(newCatAddIn); 7 3 function newCatAddIn() { 8 4 var jaxcat = $('jaxcat'); 9 5 if ( !jaxcat ) 10 6 return false; 11 Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value=" <?php echo js_escape(__('Add')); ?>"/><span id="howto"><?php echo js_escape(__('Separate multiple categories with commas.')); ?></span></span>');7 Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + catL10n.add + '"/><span id="howto">' + catL10n.how + '</span></span>'); 12 8 $('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); }; 13 9 $('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); }; 14 10 } -
wp-admin/dbx-admin-key-js.php
1 <?php2 require_once('admin.php');3 cache_javascript_headers();4 5 switch ( $_GET['pagenow'] ) :6 case 'post.php' :7 case 'post-new.php' :8 $man = 'postmeta';9 break;10 case 'page.php' :11 case 'page-new.php' :12 $man = 'pagemeta';13 break;14 case 'link.php' :15 $man = 'linkmeta';16 break;17 default:18 exit;19 break;20 endswitch;21 ?>22 addLoadEvent( function() {var manager = new dbxManager('<?php echo $man; ?>');} );23 24 addLoadEvent( function()25 {26 //create new docking boxes group27 var meta = new dbxGroup(28 'grabit', // container ID [/-_a-zA-Z0-9/]29 'vertical', // orientation ['vertical'|'horizontal']30 '10', // drag threshold ['n' pixels]31 'no', // restrict drag movement to container axis ['yes'|'no']32 '10', // animate re-ordering [frames per transition, or '0' for no effect]33 'yes', // include open/close toggle buttons ['yes'|'no']34 'closed', // default state ['open'|'closed']35 '<?php echo js_escape(__('open')); ?>', // word for "open", as in "open this box"36 '<?php echo js_escape(__('close')); ?>', // word for "close", as in "close this box"37 '<?php echo js_escape(__('click-down and drag to move this box')); ?>', // sentence for "move this box" by mouse38 '<?php echo js_escape(__('click to %toggle% this box')); ?>', // pattern-match sentence for "(open|close) this box" by mouse39 '<?php echo js_escape(__('use the arrow keys to move this box')); ?>', // sentence for "move this box" by keyboard40 '<?php echo js_escape(__(', or press the enter key to %toggle% it')); ?>', // pattern-match sentence-fragment for "(open|close) this box" by keyboard41 '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts42 );43 44 // Boxes are closed by default. Open the Category box if the cookie isn't already set.45 var catdiv = document.getElementById('categorydiv');46 if ( catdiv ) {47 var button = catdiv.getElementsByTagName('A')[0];48 if ( dbx.cookiestate == null && /dbx\-toggle\-closed/.test(button.className) )49 meta.toggleBoxState(button, true);50 }51 52 var advanced = new dbxGroup(53 'advancedstuff', // container ID [/-_a-zA-Z0-9/]54 'vertical', // orientation ['vertical'|'horizontal']55 '10', // drag threshold ['n' pixels]56 'yes', // restrict drag movement to container axis ['yes'|'no']57 '10', // animate re-ordering [frames per transition, or '0' for no effect]58 'yes', // include open/close toggle buttons ['yes'|'no']59 'closed', // default state ['open'|'closed']60 '<?php echo js_escape(__('open')); ?>', // word for "open", as in "open this box"61 '<?php echo js_escape(__('close')); ?>', // word for "close", as in "close this box"62 '<?php echo js_escape(__('click-down and drag to move this box')); ?>', // sentence for "move this box" by mouse63 '<?php echo js_escape(__('click to %toggle% this box')); ?>', // pattern-match sentence for "(open|close) this box" by mouse64 '<?php echo js_escape(__('use the arrow keys to move this box')); ?>', // sentence for "move this box" by keyboard65 '<?php echo js_escape(__(', or press the enter key to %toggle% it')); ?>', // pattern-match sentence-fragment for "(open|close) this box" by keyboard66 '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts67 );68 }); -
wp-admin/dbx-admin-key.js
1 <?php 2 require_once('admin.php'); 3 cache_javascript_headers(); 1 addLoadEvent( function() {var manager = new dbxManager( dbxL10n.mananger );} ); 4 2 5 switch ( $_GET['pagenow'] ) :6 case 'post.php' :7 case 'post-new.php' :8 $man = 'postmeta';9 break;10 case 'page.php' :11 case 'page-new.php' :12 $man = 'pagemeta';13 break;14 case 'link.php' :15 $man = 'linkmeta';16 break;17 default:18 exit;19 break;20 endswitch;21 ?>22 addLoadEvent( function() {var manager = new dbxManager('<?php echo $man; ?>');} );23 24 3 addLoadEvent( function() 25 4 { 26 5 //create new docking boxes group 27 6 var meta = new dbxGroup( 28 7 'grabit', // container ID [/-_a-zA-Z0-9/] 29 'vertical', // orientation ['vertical'|'horizontal']8 'vertical', // orientation ['vertical'|'horizontal'] 30 9 '10', // drag threshold ['n' pixels] 31 10 'no', // restrict drag movement to container axis ['yes'|'no'] 32 11 '10', // animate re-ordering [frames per transition, or '0' for no effect] 33 12 'yes', // include open/close toggle buttons ['yes'|'no'] 34 13 'closed', // default state ['open'|'closed'] 35 '<?php echo js_escape(__('open')); ?>', // word for "open", as in "open this box"36 '<?php echo js_escape(__('close')); ?>', // word for "close", as in "close this box"37 '<?php echo js_escape(__('click-down and drag to move this box')); ?>',// sentence for "move this box" by mouse38 '<?php echo js_escape(__('click to %toggle% this box')); ?>',// pattern-match sentence for "(open|close) this box" by mouse39 '<?php echo js_escape(__('use the arrow keys to move this box')); ?>',// sentence for "move this box" by keyboard40 '<?php echo js_escape(__(', or press the enter key to %toggle% it')); ?>',// pattern-match sentence-fragment for "(open|close) this box" by keyboard14 dbxL10n.open, // word for "open", as in "open this box" 15 dbxL10n.close, // word for "close", as in "close this box" 16 dbxL10n.moveMouse, // sentence for "move this box" by mouse 17 dbxL10n.toggleMouse, // pattern-match sentence for "(open|close) this box" by mouse 18 dbxL10n.moveKey, // sentence for "move this box" by keyboard 19 dbxL10n.toggleKey, // pattern-match sentence-fragment for "(open|close) this box" by keyboard 41 20 '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts 42 21 ); 43 22 … … 50 29 } 51 30 52 31 var advanced = new dbxGroup( 53 'advancedstuff', // container ID [/-_a-zA-Z0-9/]54 'vertical', // orientation ['vertical'|'horizontal']55 '10', // drag threshold ['n' pixels]32 'advancedstuff', 33 'vertical', 34 '10', 56 35 'yes', // restrict drag movement to container axis ['yes'|'no'] 57 '10', // animate re-ordering [frames per transition, or '0' for no effect]58 'yes', // include open/close toggle buttons ['yes'|'no']59 'closed', // default state ['open'|'closed']60 '<?php echo js_escape(__('open')); ?>', // word for "open", as in "open this box"61 '<?php echo js_escape(__('close')); ?>', // word for "close", as in "close this box"62 '<?php echo js_escape(__('click-down and drag to move this box')); ?>', // sentence for "move this box" by mouse63 '<?php echo js_escape(__('click to %toggle% this box')); ?>', // pattern-match sentence for "(open|close) this box" by mouse64 '<?php echo js_escape(__('use the arrow keys to move this box')); ?>', // sentence for "move this box" by keyboard65 '<?php echo js_escape(__(', or press the enter key to %toggle% it')); ?>', // pattern-match sentence-fragment for "(open|close) this box" by keyboard36 '10', 37 'yes', 38 'closed', 39 dbxL10n.open, 40 dbxL10n.close, 41 dbxL10n.moveMouse, 42 dbxL10n.toggleMouse, 43 dbxL10n.moveKey, 44 dbxL10n.toggleKey, 66 45 '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts 67 46 ); 68 47 });
