Changeset 10291
- Timestamp:
- 01/02/2009 03:08:58 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 40 added
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/js/cat.js
r6303 r10291 1 jQuery( function($) { 2 var myConfirm = function() { return '' !== $('#newcat').val(); }; 3 $('#jaxcat').prepend('<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" class="add:categorychecklist:jaxcat" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span><span id="cat-ajax-response"></span>') 4 $('#categorychecklist').wpList( { alt: '', response: 'cat-ajax-response', confirm: myConfirm } ); 5 } ); 1 jQuery(document).ready(function(b){var a=function(){return""!==b("#newcat").val()};b("#jaxcat").prepend('<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" class="add:categorychecklist:jaxcat" id="catadd" value="'+catL10n.add+'"/><input type="hidden"/><input type="hidden"/><span id="howto">'+catL10n.how+'</span></span><span id="cat-ajax-response"></span>');b("#categorychecklist").wpList({alt:"",response:"cat-ajax-response",confirm:a})}); -
trunk/wp-admin/js/categories.js
r10150 r10291 1 jQuery(function($) { 2 var options = false 3 if ( document.forms['addcat'].category_parent ) 4 options = document.forms['addcat'].category_parent.options; 5 6 var addAfter = function( r, settings ) { 7 var name = $("<span>" + $('name', r).text() + "</span>").html(); 8 var id = $('cat', r).attr('id'); 9 options[options.length] = new Option(name, id); 10 11 addAfter2( r, settings ); 12 } 13 14 var addAfter2 = function( x, r ) { 15 var t = $(r.parsed.responses[0].data); 16 if ( t.length == 1 ) 17 inlineEditTax.addEvents($(t.id)); 18 } 19 20 var delAfter = function( r, settings ) { 21 var id = $('cat', r).attr('id'); 22 for ( var o = 0; o < options.length; o++ ) 23 if ( id == options[o].value ) 24 options[o] = null; 25 } 26 27 if ( options ) 28 $('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } ); 29 else 30 $('#the-list').wpList({ addAfter: addAfter2 }); 31 32 if ( jQuery('#link-category-search-input').size() ) { 33 columns.init('edit-link-categories'); 34 } else { 35 columns.init('categories'); 36 } 37 }); 1 jQuery(document).ready(function(c){var b=false,e,d,a;if(document.forms.addcat.category_parent){b=document.forms.addcat.category_parent.options}e=function(h,g){var f,i;f=c("<span>"+c("name",h).text()+"</span>").html();i=c("cat",h).attr("id");b[b.length]=new Option(f,i);d(h,g)};d=function(f,h){var g=c(h.parsed.responses[0].data);if(g.length==1){inlineEditTax.addEvents(c(g.id))}};a=function(g,f){var i=c("cat",g).attr("id"),h;for(h=0;h<b.length;h++){if(i==b[h].value){b[h]=null}}};if(b){c("#the-list").wpList({addAfter:e,delAfter:a})}else{c("#the-list").wpList({addAfter:d})}if(jQuery("#link-category-search-input").size()){columns.init("edit-link-categories")}else{columns.init("categories")}}); -
trunk/wp-admin/js/comment.js
r10258 r10291 1 jQuery(document).ready( function($) { 2 3 var stamp = $('#timestamp').html(); 4 $('.edit-timestamp').click(function () { 5 if ($('#timestampdiv').is(":hidden")) { 6 $('#timestampdiv').slideDown("normal"); 7 $('.edit-timestamp').hide(); 8 } 9 return false; 10 }); 11 12 $('.cancel-timestamp').click(function() { 13 $('#timestampdiv').slideUp("normal"); 14 $('#mm').val($('#hidden_mm').val()); 15 $('#jj').val($('#hidden_jj').val()); 16 $('#aa').val($('#hidden_aa').val()); 17 $('#hh').val($('#hidden_hh').val()); 18 $('#mn').val($('#hidden_mn').val()); 19 $('#timestamp').html(stamp); 20 $('.edit-timestamp').show(); 21 return false; 22 }); 23 24 $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels 25 $('#timestampdiv').slideUp("normal"); 26 $('.edit-timestamp').show(); 27 $('#timestamp').html( 28 commentL10n.submittedOn + ' <b>' + 29 $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' + 30 $('#jj').val() + ', ' + 31 $('#aa').val() + ' @ ' + 32 $('#hh').val() + ':' + 33 $('#mn').val() + '</b> ' 34 ); 35 return false; 36 }); 37 }); 1 jQuery(document).ready(function(b){var a=b("#timestamp").html();b(".edit-timestamp").click(function(){if(b("#timestampdiv").is(":hidden")){b("#timestampdiv").slideDown("normal");b(".edit-timestamp").hide()}return false});b(".cancel-timestamp").click(function(){b("#timestampdiv").slideUp("normal");b("#mm").val(b("#hidden_mm").val());b("#jj").val(b("#hidden_jj").val());b("#aa").val(b("#hidden_aa").val());b("#hh").val(b("#hidden_hh").val());b("#mn").val(b("#hidden_mn").val());b("#timestamp").html(a);b(".edit-timestamp").show();return false});b(".save-timestamp").click(function(){b("#timestampdiv").slideUp("normal");b(".edit-timestamp").show();b("#timestamp").html(commentL10n.submittedOn+" <b>"+b("#mm option[value="+b("#mm").val()+"]").text()+" "+b("#jj").val()+", "+b("#aa").val()+" @ "+b("#hh").val()+":"+b("#mn").val()+"</b> ");return false})}); -
trunk/wp-admin/js/common.js
r10258 r10291 1 2 var wpCookies = { 3 // The following functions are from Cookie.js class in TinyMCE, Moxiecode, used under LGPL. 4 5 each : function(o, cb, s) { 6 var n, l; 7 8 if (!o) 9 return 0; 10 11 s = s || o; 12 13 if (typeof(o.length) != 'undefined') { 14 for (n=0, l = o.length; n<l; n++) { 15 if (cb.call(s, o[n], n, o) === false) 16 return 0; 17 } 18 } else { 19 for (n in o) { 20 if (o.hasOwnProperty(n)) { 21 if (cb.call(s, o[n], n, o) === false) 22 return 0; 23 } 24 } 25 } 26 return 1; 27 }, 28 29 getHash : function(n) { 30 var v = this.get(n), h; 31 32 if (v) { 33 this.each(v.split('&'), function(v) { 34 v = v.split('='); 35 h = h || {}; 36 h[v[0]] = v[1]; 37 }); 38 } 39 return h; 40 }, 41 42 setHash : function(n, v, e, p, d, s) { 43 var o = ''; 44 45 this.each(v, function(v, k) { 46 o += (!o ? '' : '&') + k + '=' + v; 47 }); 48 49 this.set(n, o, e, p, d, s); 50 }, 51 52 get : function(n) { 53 var c = document.cookie, e, p = n + "=", b; 54 55 if (!c) 56 return; 57 58 b = c.indexOf("; " + p); 59 60 if (b == -1) { 61 b = c.indexOf(p); 62 63 if (b != 0) 64 return null; 65 } else 66 b += 2; 67 68 e = c.indexOf(";", b); 69 70 if (e == -1) 71 e = c.length; 72 73 return decodeURIComponent(c.substring(b + p.length, e)); 74 }, 75 76 set : function(n, v, e, p, d, s) { 77 document.cookie = n + "=" + encodeURIComponent(v) + 78 ((e) ? "; expires=" + e.toGMTString() : "") + 79 ((p) ? "; path=" + p : "") + 80 ((d) ? "; domain=" + d : "") + 81 ((s) ? "; secure" : ""); 82 }, 83 84 remove : function(n, p) { 85 var d = new Date(); 86 87 d.setTime(d.getTime() - 1000); 88 89 this.set(n, '', d, p, d); 90 } 91 }; 92 93 // Returns the value as string. Second arg or empty string is returned when value is not set. 94 function getUserSetting( name, def ) { 95 var o = getAllUserSettings(); 96 97 if ( o.hasOwnProperty(name) ) 98 return o[name]; 99 100 if ( typeof def != 'undefined' ) 101 return def; 102 103 return ''; 104 } 105 106 // Both name and value must be only ASCII letters, numbers or underscore 107 // and the shorter, the better (cookies can store maximum 4KB). Not suitable to store text. 108 function setUserSetting( name, value, del ) { 109 var c = 'wp-settings-'+userSettings.uid, o = wpCookies.getHash(c) || {}, d = new Date(); 110 var n = name.toString().replace(/[^A-Za-z0-9_]/, ''), v = value.toString().replace(/[^A-Za-z0-9_]/, ''); 111 112 if ( del ) delete o[n]; 113 else o[n] = v; 114 115 d.setTime( d.getTime() + 31536000000 ); 116 p = userSettings.url; 117 118 wpCookies.setHash(c, o, d, p ); 119 wpCookies.set('wp-settings-time-'+userSettings.uid, userSettings.time, d, p ); 120 } 121 122 function deleteUserSetting( name ) { 123 setUserSetting( name, '', 1 ); 124 } 125 126 // Returns all settings as js object. 127 function getAllUserSettings() { 128 return wpCookies.getHash('wp-settings-'+userSettings.uid) || {}; 129 } 130 131 132 jQuery(document).ready( function($) { 133 // pulse 134 $('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300); 135 136 // Basic form validation 137 if ( ( 'undefined' != typeof wpAjax ) && $.isFunction( wpAjax.validateForm ) ) { 138 $('form.validate').submit( function() { return wpAjax.validateForm( $(this) ); } ); 139 } 140 141 // Move .updated and .error alert boxes 142 $('div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error').addClass('below-h2'); 143 $('div.updated, div.error').not('.below-h2').insertAfter('div.wrap h2:first'); 144 145 // screen settings tab 146 $('#show-settings-link').click(function () { 147 if ( ! $('#screen-options-wrap').hasClass('screen-options-open') ) { 148 $('#contextual-help-link-wrap').addClass('invisible'); 149 } 150 $('#screen-options-wrap').slideToggle('fast', function(){ 151 if ( $(this).hasClass('screen-options-open') ) { 152 $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right.gif")'}); 153 $('#contextual-help-link-wrap').removeClass('invisible'); 154 $(this).removeClass('screen-options-open'); 155 156 } else { 157 $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'}); 158 $(this).addClass('screen-options-open'); 159 } 160 }); 161 return false; 162 }); 163 164 // help tab 165 $('#contextual-help-link').click(function () { 166 if ( ! $('#contextual-help-wrap').hasClass('contextual-help-open') ) { 167 $('#screen-options-link-wrap').addClass('invisible'); 168 } 169 $('#contextual-help-wrap').slideToggle('fast', function(){ 170 if ( $(this).hasClass('contextual-help-open') ) { 171 $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right.gif")'}); 172 $('#screen-options-link-wrap').removeClass('invisible'); 173 $(this).removeClass('contextual-help-open'); 174 } else { 175 $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'}); 176 $(this).addClass('contextual-help-open'); 177 } 178 }); 179 return false; 180 }); 181 182 // check all checkboxes 183 var lastClicked = false; 184 $( 'table:visible tbody .check-column :checkbox' ).click( function(e) { 185 if ( 'undefined' == e.shiftKey ) { return true; } 186 if ( e.shiftKey ) { 187 if ( !lastClicked ) { return true; } 188 var checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' ); 189 var first = checks.index( lastClicked ); 190 var last = checks.index( this ); 191 var checked = $(this).attr('checked'); 192 if ( 0 < first && 0 < last && first != last ) { 193 checks.slice( first, last ).attr( 'checked', function(){ 194 if ( $(this).parents('tr').is(':visible') ) 195 return checked ? 'checked' : ''; 196 197 return ''; 198 }); 199 } 200 } 201 lastClicked = this; 202 return true; 203 } ); 204 $( 'thead :checkbox, tfoot :checkbox' ).click( function(e) { 205 var c = $(this).attr('checked'); 206 if ( 'undefined' == typeof toggleWithKeyboard) 207 toggleWithKeyboard = false; 208 var toggle = e.shiftKey || toggleWithKeyboard; 209 $(this).parents( 'form:first' ).find( 'table tbody:visible').find( '.check-column :checkbox' ).attr( 'checked', function() { 210 if ( $(this).parents('tr').is(':hidden') ) 211 return ''; 212 if ( toggle ) 213 return $(this).attr( 'checked' ) ? '' : 'checked'; 214 else if (c) 215 return 'checked'; 216 return ''; 217 }); 218 $(this).parents( 'form:first' ).find( 'table thead:visible, table tfoot:visible').find( '.check-column :checkbox' ).attr( 'checked', function() { 219 if ( toggle ) 220 return ''; 221 else if (c) 222 return 'checked'; 223 return ''; 224 }); 225 }); 226 }); 227 228 var showNotice, adminMenu, columns; 229 230 // stub for doing better warnings 231 showNotice = { 232 warn : function(text) { 233 if ( confirm(text) ) 234 return true; 235 236 return false; 237 }, 238 239 note : function(text) { 240 alert(text); 241 } 242 }; 243 244 (function($){ 245 // sidebar admin menu 246 adminMenu = { 247 248 init : function() { 249 $('#adminmenu div.wp-menu-toggle').each( function() { 250 if ( $(this).siblings('.wp-submenu').length ) 251 $(this).click(function(){ adminMenu.toggle( $(this).siblings('.wp-submenu') ); }); 252 else 253 $(this).hide(); 254 }); 255 $('#adminmenu li.menu-top .wp-menu-image').click( function() { window.location = $(this).siblings('a.menu-top')[0].href; } ); 256 this.favorites(); 257 258 $('.wp-menu-separator').click(function(){ 259 if ( $('#wpcontent').hasClass('folded') ) { 260 adminMenu.fold(1); 261 setUserSetting( 'mfold', 'o' ); 262 } else { 263 adminMenu.fold(); 264 setUserSetting( 'mfold', 'f' ); 265 } 266 }); 267 268 if ( 'f' != getUserSetting( 'mfold' ) ) { 269 this.restoreMenuState(); 270 } else { 271 this.fold(); 272 } 273 }, 274 275 restoreMenuState : function() { 276 $('#adminmenu li.wp-has-submenu').each(function(i, e) { 277 var v = getUserSetting( 'm'+i ); 278 if ( $(e).hasClass('wp-has-current-submenu') ) return true; // leave the current parent open 279 280 if ( 'o' == v ) $(e).addClass('wp-menu-open'); 281 else if ( 'c' == v ) $(e).removeClass('wp-menu-open'); 282 }); 283 }, 284 285 toggle : function(el) { 286 287 el['slideToggle'](150, function(){el.css('display','');}).parent().toggleClass( 'wp-menu-open' ); 288 289 $('#adminmenu li.wp-has-submenu').each(function(i, e) { 290 var v = $(e).hasClass('wp-menu-open') ? 'o' : 'c'; 291 setUserSetting( 'm'+i, v ); 292 }); 293 294 return false; 295 }, 296 297 fold : function(off) { 298 if (off) { 299 $('#wpcontent').removeClass('folded'); 300 $('#adminmenu li.wp-has-submenu').unbind(); 301 } else { 302 $('#wpcontent').addClass('folded'); 303 $('#adminmenu li.wp-has-submenu').hoverIntent({ 304 over: function(e){ 305 var m = $(this).find('.wp-submenu'), t = e.clientY, H = $(window).height(), h = m.height(), o; 306 307 if ( (t+h+10) > H ) { 308 o = (t+h+10) - H; 309 m.css({'marginTop':'-'+o+'px'}); 310 } else if ( m.css('marginTop') ) { 311 m.css({'marginTop':''}) 312 } 313 m.addClass('sub-open'); 314 }, 315 out: function(){ $(this).find('.wp-submenu').removeClass('sub-open').css({'marginTop':''}); }, 316 timeout: 220, 317 sensitivity: 8, 318 interval: 100 319 }); 320 321 } 322 }, 323 324 favorites : function() { 325 $('#favorite-inside').width($('#favorite-actions').width()-4); 326 $('#favorite-toggle, #favorite-inside').bind( 'mouseenter', function(){$('#favorite-inside').removeClass('slideUp').addClass('slideDown'); setTimeout(function(){if ( $('#favorite-inside').hasClass('slideDown') ) { $('#favorite-inside').slideDown(100); $('#favorite-first').addClass('slide-down'); }}, 200) } ); 327 328 $('#favorite-toggle, #favorite-inside').bind( 'mouseleave', function(){$('#favorite-inside').removeClass('slideDown').addClass('slideUp'); setTimeout(function(){if ( $('#favorite-inside').hasClass('slideUp') ) { $('#favorite-inside').slideUp(100, function(){ $('#favorite-first').removeClass('slide-down'); } ); }}, 300) } ); 329 } 330 }; 331 332 $(document).ready(function(){adminMenu.init();}); 333 })(jQuery); 334 335 (function($){ 336 // show/hide/save table columns 337 columns = { 338 init : function(page) { 339 $('.hide-column-tog').click( function() { 340 var column = $(this).val(); 341 var show = $(this).attr('checked'); 342 if ( show ) { 343 $('.column-' + column).show(); 344 } else { 345 $('.column-' + column).hide(); 346 } 347 columns.save_manage_columns_state(page); 348 } ); 349 }, 350 351 save_manage_columns_state : function(page) { 352 var hidden = $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(','); 353 $.post('admin-ajax.php', { 354 action: 'hidden-columns', 355 hidden: hidden, 356 hiddencolumnsnonce: $('#hiddencolumnsnonce').val(), 357 page: page 358 }); 359 } 360 } 361 362 })(jQuery); 363 364 365 jQuery(document).ready(function($){ 366 if ( 'undefined' != typeof google && google.gears ) return; 367 368 var gf = false; 369 if ( 'undefined' != typeof GearsFactory ) { 370 gf = new GearsFactory(); 371 } else { 372 try { 373 gf = new ActiveXObject('Gears.Factory'); 374 if ( factory.getBuildInfo().indexOf('ie_mobile') != -1 ) 375 gf.privateSetGlobalObject(this); 376 } catch (e) { 377 if ( ( 'undefined' != typeof navigator.mimeTypes ) && navigator.mimeTypes['application/x-googlegears'] ) { 378 gf = document.createElement("object"); 379 gf.style.display = "none"; 380 gf.width = 0; 381 gf.height = 0; 382 gf.type = "application/x-googlegears"; 383 document.documentElement.appendChild(gf); 384 } 385 } 386 } 387 if ( gf && gf.hasPermission ) 388 return; 389 390 $('.turbo-nag').show(); 391 }); 1 var wpCookies={each:function(d,a,c){var e,b;if(!d){return 0}c=c||d;if(typeof(d.length)!="undefined"){for(e=0,b=d.length;e<b;e++){if(a.call(c,d[e],e,d)===false){return 0}}}else{for(e in d){if(d.hasOwnProperty(e)){if(a.call(c,d[e],e,d)===false){return 0}}}}return 1},getHash:function(c){var a=this.get(c),b;if(a){this.each(a.split("&"),function(d){d=d.split("=");b=b||{};b[d[0]]=d[1]})}return b},setHash:function(i,a,f,c,h,b){var g="";this.each(a,function(e,d){g+=(!g?"":"&")+d+"="+e});this.set(i,g,f,c,h,b)},get:function(h){var g=document.cookie,f,d=h+"=",a;if(!g){return}a=g.indexOf("; "+d);if(a==-1){a=g.indexOf(d);if(a!=0){return null}}else{a+=2}f=g.indexOf(";",a);if(f==-1){f=g.length}return decodeURIComponent(g.substring(a+d.length,f))},set:function(h,a,f,c,g,b){document.cookie=h+"="+encodeURIComponent(a)+((f)?"; expires="+f.toGMTString():"")+((c)?"; path="+c:"")+((g)?"; domain="+g:"")+((b)?"; secure":"")},remove:function(c,a){var b=new Date();b.setTime(b.getTime()-1000);this.set(c,"",b,a,b)}};function getUserSetting(a,b){var c=getAllUserSettings();if(c.hasOwnProperty(a)){return c[a]}if(typeof b!="undefined"){return b}return""}function setUserSetting(a,i,k){var h="wp-settings-"+userSettings.uid,e=wpCookies.getHash(h)||{},g=new Date(),b,f=a.toString().replace(/[^A-Za-z0-9_]/,""),j=i.toString().replace(/[^A-Za-z0-9_]/,"");if(k){delete e[f]}else{e[f]=j}g.setTime(g.getTime()+31536000000);b=userSettings.url;wpCookies.setHash(h,e,g,b);wpCookies.set("wp-settings-time-"+userSettings.uid,userSettings.time,g,b)}function deleteUserSetting(a){setUserSetting(a,"",1)}function getAllUserSettings(){return wpCookies.getHash("wp-settings-"+userSettings.uid)||{}}jQuery(document).ready(function(d){var f=false,a,e,c,b;d(".fade").animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300).animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300);if(("undefined"!=typeof wpAjax)&&d.isFunction(wpAjax.validateForm)){d("form.validate").submit(function(){return wpAjax.validateForm(d(this))})}d("div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error").addClass("below-h2");d("div.updated, div.error").not(".below-h2").insertAfter("div.wrap h2:first");d("#show-settings-link").click(function(){if(!d("#screen-options-wrap").hasClass("screen-options-open")){d("#contextual-help-link-wrap").addClass("invisible")}d("#screen-options-wrap").slideToggle("fast",function(){if(d(this).hasClass("screen-options-open")){d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#contextual-help-link-wrap").removeClass("invisible");d(this).removeClass("screen-options-open")}else{d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("screen-options-open")}});return false});d("#contextual-help-link").click(function(){if(!d("#contextual-help-wrap").hasClass("contextual-help-open")){d("#screen-options-link-wrap").addClass("invisible")}d("#contextual-help-wrap").slideToggle("fast",function(){if(d(this).hasClass("contextual-help-open")){d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#screen-options-link-wrap").removeClass("invisible");d(this).removeClass("contextual-help-open")}else{d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("contextual-help-open")}});return false});d("table:visible tbody .check-column :checkbox").click(function(g){if("undefined"==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).parents("form:first").find(":checkbox");e=a.index(f);c=a.index(this);b=d(this).attr("checked");if(0<e&&0<c&&e!=c){a.slice(e,c).attr("checked",function(){if(d(this).parents("tr").is(":visible")){return b?"checked":""}return""})}}f=this;return true});d("thead :checkbox, tfoot :checkbox").click(function(h){var i=d(this).attr("checked"),g=h.shiftKey||toggleWithKeyboard;if("undefined"==typeof toggleWithKeyboard){toggleWithKeyboard=false}d(this).parents("form:first").find("table tbody:visible").find(".check-column :checkbox").attr("checked",function(){if(d(this).parents("tr").is(":hidden")){return""}if(g){return d(this).attr("checked")?"":"checked"}else{if(i){return"checked"}}return""});d(this).parents("form:first").find("table thead:visible, table tfoot:visible").find(".check-column :checkbox").attr("checked",function(){if(g){return""}else{if(i){return"checked"}}return""})})});var showNotice,adminMenu,columns;showNotice={warn:function(a){if(confirm(a)){return true}return false},note:function(a){alert(a)}};(function(a){adminMenu={init:function(){a("#adminmenu div.wp-menu-toggle").each(function(){if(a(this).siblings(".wp-submenu").length){a(this).click(function(){adminMenu.toggle(a(this).siblings(".wp-submenu"))})}else{a(this).hide()}});a("#adminmenu li.menu-top .wp-menu-image").click(function(){window.location=a(this).siblings("a.menu-top")[0].href});this.favorites();a(".wp-menu-separator").click(function(){if(a("#wpcontent").hasClass("folded")){adminMenu.fold(1);setUserSetting("mfold","o")}else{adminMenu.fold();setUserSetting("mfold","f")}});if("f"!=getUserSetting("mfold")){this.restoreMenuState()}else{this.fold()}},restoreMenuState:function(){a("#adminmenu li.wp-has-submenu").each(function(c,d){var b=getUserSetting("m"+c);if(a(d).hasClass("wp-has-current-submenu")){return true}if("o"==b){a(d).addClass("wp-menu-open")}else{if("c"==b){a(d).removeClass("wp-menu-open")}}})},toggle:function(b){b.slideToggle(150,function(){b.css("display","")}).parent().toggleClass("wp-menu-open");a("#adminmenu li.wp-has-submenu").each(function(d,f){var c=a(f).hasClass("wp-menu-open")?"o":"c";setUserSetting("m"+d,c)});return false},fold:function(b){if(b){a("#wpcontent").removeClass("folded");a("#adminmenu li.wp-has-submenu").unbind()}else{a("#wpcontent").addClass("folded");a("#adminmenu li.wp-has-submenu").hoverIntent({over:function(i){var c=a(this).find(".wp-submenu"),f=i.clientY,d=a(window).height(),g=c.height(),j;if((f+g+10)>d){j=(f+g+10)-d;c.css({marginTop:"-"+j+"px"})}else{if(c.css("marginTop")){c.css({marginTop:""})}}c.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open").css({marginTop:""})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a("#favorite-inside").width(a("#favorite-actions").width()-4);a("#favorite-toggle, #favorite-inside").bind("mouseenter",function(){a("#favorite-inside").removeClass("slideUp").addClass("slideDown");setTimeout(function(){if(a("#favorite-inside").hasClass("slideDown")){a("#favorite-inside").slideDown(100);a("#favorite-first").addClass("slide-down")}},200)});a("#favorite-toggle, #favorite-inside").bind("mouseleave",function(){a("#favorite-inside").removeClass("slideDown").addClass("slideUp");setTimeout(function(){if(a("#favorite-inside").hasClass("slideUp")){a("#favorite-inside").slideUp(100,function(){a("#favorite-first").removeClass("slide-down")})}},300)})}};a(document).ready(function(){adminMenu.init()})})(jQuery);(function(a){columns={init:function(b){a(".hide-column-tog").click(function(){var d=a(this).val(),c=a(this).attr("checked");if(c){a(".column-"+d).show()}else{a(".column-"+d).hide()}columns.save_manage_columns_state(b)})},save_manage_columns_state:function(c){var b=a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",");a.post("admin-ajax.php",{action:"hidden-columns",hidden:b,hiddencolumnsnonce:a("#hiddencolumnsnonce").val(),page:c})}}})(jQuery);jQuery(document).ready(function(b){if("undefined"!=typeof google&&google.gears){return}var a=false;if("undefined"!=typeof GearsFactory){a=new GearsFactory()}else{try{a=new ActiveXObject("Gears.Factory");if(factory.getBuildInfo().indexOf("ie_mobile")!=-1){a.privateSetGlobalObject(this)}}catch(c){if(("undefined"!=typeof navigator.mimeTypes)&&navigator.mimeTypes["application/x-googlegears"]){a=document.createElement("object");a.style.display="none";a.width=0;a.height=0;a.type="application/x-googlegears";document.documentElement.appendChild(a)}}}if(a&&a.hasPermission){return}b(".turbo-nag").show()}); -
trunk/wp-admin/js/custom-fields.js
r7131 r10291 1 jQuery( function($) { 2 var before = function() { 3 var nonce = $('#newmeta [@name=_ajax_nonce]').val(); 4 var postId = $('#post_ID').val(); 5 if ( !nonce || !postId ) { return false; } 6 return [nonce,postId]; 7 } 8 9 var addBefore = function( s ) { 10 var b = before(); 11 if ( !b ) { return false; } 12 s.data = s.data.replace(/_ajax_nonce=[a-f0-9]+/, '_ajax_nonce=' + b[0]) + '&post_id=' + b[1]; 13 return s; 14 }; 15 16 var addAfter = function( r, s ) { 17 var postId = $('postid', r).text(); 18 if ( !postId ) { return; } 19 $('#post_ID').attr( 'name', 'post_ID' ).val( postId ); 20 var h = $('#hiddenaction'); 21 if ( 'post' == h.val() ) { h.val( 'postajaxpost' ); } 22 }; 23 24 var delBefore = function( s ) { 25 var b = before(); if ( !b ) return false; 26 s.data._ajax_nonce = b[0]; s.data.post_id = b[1]; 27 return s; 28 } 29 30 $('#the-list') 31 .wpList( { addBefore: addBefore, addAfter: addAfter, delBefore: delBefore } ) 32 .find('.updatemeta, .deletemeta').attr( 'type', 'button' ); 33 } ); 1 jQuery(document).ready(function(d){var c,b,e,a;c=function(){var g=d("#newmeta [@name=_ajax_nonce]").val(),f=d("#post_ID").val();if(!g||!f){return false}return[g,f]};b=function(g){var f=c();if(!f){return false}g.data=g.data.replace(/_ajax_nonce=[a-f0-9]+/,"_ajax_nonce="+f[0])+"&post_id="+f[1];return g};e=function(j,i){var f=d("postid",j).text(),g;if(!f){return}d("#post_ID").attr("name","post_ID").val(f);g=d("#hiddenaction");if("post"==g.val()){g.val("postajaxpost")}};a=function(g){var f=c();if(!f){return false}g.data._ajax_nonce=f[0];g.data.post_id=f[1];return g};d("#the-list").wpList({addBefore:b,addAfter:e,delBefore:a}).find(".updatemeta, .deletemeta").attr("type","button")}); -
trunk/wp-admin/js/dashboard.js
r10258 r10291 1 2 jQuery( function($) { 3 4 // These widgets are sometimes populated via ajax 5 var ajaxWidgets = [ 6 'dashboard_incoming_links', 7 'dashboard_primary', 8 'dashboard_secondary', 9 'dashboard_plugins' 10 ]; 11 12 var ajaxPopulateWidgets = function() { 13 $.each( ajaxWidgets, function() { 14 var e = jQuery('#' + this + ':visible div.inside').find('.widget-loading'); 15 if ( e.size() ) { e.parent().load('index-extra.php?jax=' + this); } 16 } ); 17 }; 18 ajaxPopulateWidgets(); 19 20 postboxes.add_postbox_toggles('dashboard', { onShow: ajaxPopulateWidgets } ); 21 22 /* QuickPress */ 23 var quickPressLoad = function() { 24 var act = $('#quickpost-action'); 25 var t = $('#quick-press').submit( function() { 26 $('#dashboard_quick_press h3').append( '<img src="images/loading.gif" style="margin: 0 6px 0 0; vertical-align: middle" />' ); 27 28 if ( 'post' == act.val() ) { 29 act.val( 'post-quickpress-publish' ); 30 } 31 32 $('#dashboard_quick_press div.inside').load( t.attr( 'action' ), t.serializeArray(), function() { 33 $('#dashboard_quick_press h3 img').remove(); 34 $('#dashboard_quick_press ul').find('li').each( function() { 35 $('#dashboard_recent_drafts ul').prepend( this ); 36 } ).end().remove(); 37 tb_init('a.thickbox'); 38 quickPressLoad(); 39 } ); 40 return false; 41 } ); 42 43 $('#publish').click( function() { act.val( 'post-quickpress-publish' ); } ); 44 45 }; 46 quickPressLoad(); 47 48 } ); 1 jQuery(document).ready(function(c){var a,b,d;a=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins"];b=function(){c.each(a,function(){var f=jQuery("#"+this+":visible div.inside").find(".widget-loading");if(f.size()){f.parent().load("index-extra.php?jax="+this)}})};b();postboxes.add_postbox_toggles("dashboard",{onShow:b});d=function(){var e=c("#quickpost-action"),f;f=c("#quick-press").submit(function(){c("#dashboard_quick_press h3").append('<img src="images/loading.gif" style="margin: 0 6px 0 0; vertical-align: middle" />');if("post"==e.val()){e.val("post-quickpress-publish")}c("#dashboard_quick_press div.inside").load(f.attr("action"),f.serializeArray(),function(){c("#dashboard_quick_press h3 img").remove();c("#dashboard_quick_press ul").find("li").each(function(){c("#dashboard_recent_drafts ul").prepend(this)}).end().remove();tb_init("a.thickbox");d()});return false});c("#publish").click(function(){e.val("post-quickpress-publish")})};d()}); -
trunk/wp-admin/js/edit-comments.js
r10258 r10291 1 var theList; var theExtraList; 2 (function($) { 3 4 setCommentsList = function() { 5 var totalInput = $('#comments-form .tablenav :input[name="_total"]'); 6 var perPageInput = $('#comments-form .tablenav :input[name="_per_page"]'); 7 var pageInput = $('#comments-form .tablenav :input[name="_page"]'); 8 var lastConfidentTime = 0; 9 10 var dimAfter = function( r, settings ) { 11 var c = $('#' + settings.element); 12 13 if ( c.is('.unapproved') ) 14 c.find('div.comment_status').html('0') 15 else 16 c.find('div.comment_status').html('1') 17 18 $('span.pending-count').each( function() { 19 var a = $(this); 20 var n = a.html().replace(/[ ,.]+/g, ''); 21 n = parseInt(n,10); 22 if ( isNaN(n) ) return; 23 n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 ); 24 if ( n < 0 ) { n = 0; } 25 $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0'); 26 n = n.toString(); 27 if ( n.length > 3 ) 28 n = n.substr(0, n.length-3)+' '+n.substr(-3); 29 a.html(n); 30 }); 31 }; 32 33 // Send current total, page, per_page and url 34 var delBefore = function( settings ) { 35 settings.data._total = totalInput.val(); 36 settings.data._per_page = perPageInput.val(); 37 settings.data._page = pageInput.val(); 38 settings.data._url = document.location.href; 39 return settings; 40 }; 41 42 /* Updates the current total (as displayed visibly) 43 */ 44 var updateTotalCount = function( total, time, setConfidentTime ) { 45 if ( time < lastConfidentTime ) { 46 return; 47 } 48 totalInput.val( total.toString() ); 49 if ( setConfidentTime ) { 50 lastConfidentTime = time; 51 } 52 $('span.total-type-count').each( function() { 53 var a = $(this); 54 var n = totalInput.val().toString(); 55 if ( n.length > 3 ) 56 n = n.substr(0, n.length-3)+' '+n.substr(-3); 57 a.html(n); 58 }); 59 60 }; 61 62 // In admin-ajax.php, we send back the unix time stamp instead of 1 on success 63 var delAfter = function( r, settings ) { 64 $('span.pending-count').each( function() { 65 var a = $(this); 66 var n = a.html().replace(/[ ,.]+/g, ''); 67 n = parseInt(n,10); 68 if ( isNaN(n) ) return; 69 if ( $('#' + settings.element).is('.unapproved') ) { // we deleted a formerly unapproved comment 70 n = n - 1; 71 } else if ( $(settings.target).parents( 'span.unapprove' ).size() ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove" 72 n = n + 1; 73 } 74 if ( n < 0 ) { n = 0; } 75 $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0'); 76 n = n.toString(); 77 if ( n.length > 3 ) 78 n = n.substr(0, n.length-3)+' '+n.substr(-3); 79 a.html(n); 80 }); 81 82 $('span.spam-count').each( function() { 83 var a = $(this); 84 var n = a.html().replace(/[ ,.]+/g, ''); 85 n = parseInt(n,10); 86 if ( isNaN(n) ) return; 87 if ( $(settings.target).parents( 'span.spam' ).size() ) { // we marked a comment as spam 88 n = n + 1; 89 } else if ( $('#' + settings.element).is('.spam') ) { // we approved or deleted a comment marked as spam 90 n = n - 1; 91 } 92 if ( n < 0 ) { n = 0; } 93 n = n.toString(); 94 if ( n.length > 3 ) 95 n = n.substr(0, n.length-3)+' '+n.substr(-3); 96 a.html(n); 97 }); 98 99 100 // XML response 101 if ( ( 'object' == typeof r ) && lastConfidentTime < settings.parsed.responses[0].supplemental.time ) { 102 // Set the total to the known good value (even if this value is a little old, newer values should only be a few less, and so shouldn't mess up the page links) 103 updateTotalCount( settings.parsed.responses[0].supplemental.total, settings.parsed.responses[0].supplemental.time, true ); 104 if ( $.trim( settings.parsed.responses[0].supplemental.pageLinks ) ) { 105 $('.tablenav-pages').find( '.page-numbers' ).remove().end().append( $( settings.parsed.responses[0].supplemental.pageLinks ) ); 106 } else if ( 'undefined' != typeof settings.parsed.responses[0].supplemental.pageLinks ) { 107 $('.tablenav-pages').find( '.page-numbers' ).remove(); 108 } 109 } else { 110 // Decrement the total 111 var total = parseInt( totalInput.val(), 10 ); 112 if ( total-- < 0 ) 113 total = 0; 114 updateTotalCount( total, r, false ); 115 } 116 117 if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) { 118 return; 119 } 120 121 theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() ); 122 $('#get-extra-comments').submit(); 123 }; 124 125 theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } ); 126 theList = $('#the-comment-list').wpList( { alt: '', delBefore: delBefore, dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } ); 127 128 }; 129 130 $(document).ready(function(){ 131 setCommentsList(); 132 }); 133 134 commentReply = { 135 136 init : function() { 137 var row = $('#replyrow'); 138 139 $('a.cancel', row).click(function() { return commentReply.revert(); }); 140 $('a.save', row).click(function() { return commentReply.send(this); }); 141 142 // add events 143 $('#the-comment-list .column-comment > p').dblclick(function(){ 144 commentReply.toggle($(this).parent()); 145 }); 146 147 $('#doaction, #doaction2, #post-query-submit').click(function(e){ 148 if ( $('#the-comment-list #replyrow').length > 0 ) 149 t.close(); 150 }); 151 152 }, 153 154 addEvents : function(r) { 155 r.each(function() { 156 $(this).find('.column-comment > p').dblclick(function(){ 157 commentReply.toggle($(this).parent()); 158 }); 159 }); 160 }, 161 162 toggle : function(el) { 163 if ( $(el).css('display') != 'none' ) 164 $(el).find('a.vim-q').click(); 165 }, 166 167 revert : function() { 168 169 if ( $('#the-comment-list #replyrow').length < 1 ) 170 return false; 171 172 $('#replyrow').fadeOut('fast', function(){ 173 commentReply.close(); 174 }); 175 176 return false; 177 }, 178 179 close : function() { 180 $(this.o).fadeIn('fast').css('backgroundColor', ''); 181 $('#com-reply').append( $('#replyrow') ); 182 $('#replycontent').val(''); 183 $('#edithead input').val(''); 184 $('#replysubmit .error').html('').hide(); 185 $('#replysubmit .waiting').hide(); 186 if ( $.browser.msie ) 187 $('#replycontainer, #replycontent').css('height', '120px'); 188 else 189 $('#replycontainer').resizable('destroy').css('height', '120px'); 190 }, 191 192 open : function(id, p, a) { 193 var t = this; 194 t.close(); 195 t.o = '#comment-'+id; 196 197 $('#replyrow td').attr('colspan', $('.widefat thead th:visible').length); 198 var editRow = $('#replyrow'), rowData = $('#inline-'+id); 199 var act = t.act = (a == 'edit') ? 'edit-comment' : 'replyto-comment'; 200 201 $('#action', editRow).val(act); 202 $('#comment_post_ID', editRow).val(p); 203 $('#comment_ID', editRow).val(id); 204 205 if ( a == 'edit' ) { 206 $('#author', editRow).val( $('div.author', rowData).text() ); 207 $('#author-email', editRow).val( $('div.author-email', rowData).text() ); 208 $('#author-url', editRow).val( $('div.author-url', rowData).text() ); 209 $('#status', editRow).val( $('div.comment_status', rowData).text() ); 210 $('#replycontent', editRow).val( $('textarea.comment', rowData).val() ); 211 $('#edithead, #savebtn', editRow).show(); 212 $('#replyhead, #replybtn', editRow).hide(); 213 214 var h = $(t.o).height(); 215 if ( h > 220 ) 216 if ( $.browser.msie ) 217 $('#replycontainer, #replycontent', editRow).height(h-105); 218 else 219 $('#replycontainer', editRow).height(h-105); 220 221 $(t.o).after(editRow.hide()).fadeOut('fast', function(){ 222 $('#replyrow').fadeIn('fast'); 223 }); 224 } else { 225 $('#edithead, #savebtn', editRow).hide(); 226 $('#replyhead, #replybtn', editRow).show(); 227 $(t.o).after(editRow); 228 $('#replyrow').hide().fadeIn('fast'); 229 } 230 231 if ( ! $.browser.msie ) 232 $('#replycontainer').resizable({ 233 handles : 's', 234 axis : 'y', 235 minHeight : 80, 236 stop : function() { 237 $('#replycontainer').width('auto'); 238 } 239 }); 240 241 setTimeout(function() { 242 var rtop = $('#replyrow').offset().top; 243 var rbottom = rtop + $('#replyrow').height(); 244 var scrollTop = window.pageYOffset || document.documentElement.scrollTop; 245 var vp = document.documentElement.clientHeight || self.innerHeight || 0; 246 var scrollBottom = scrollTop + vp; 247 248 if ( scrollBottom - 20 < rbottom ) 249 window.scroll(0, rbottom - vp + 35); 250 else if ( rtop - 20 < scrollTop ) 251 window.scroll(0, rtop - 35); 252 253 $('#replycontent').focus().keyup(function(e){ 254 if (e.which == 27) commentReply.revert(); // close on Escape 255 }); 256 }, 600); 257 258 return false; 259 }, 260 261 send : function() { 262 var post = {}; 263 264 $('#replysubmit .waiting').show(); 265 266 $('#replyrow input').each(function() { 267 post[ $(this).attr('name') ] = $(this).val(); 268 }); 269 270 post.content = $('#replycontent').val(); 271 post.id = post.comment_post_ID; 272 273 $.ajax({ 274 type : 'POST', 275 url : wpListL10n.url, 276 data : post, 277 success : function(x) { commentReply.show(x); }, 278 error : function(r) { commentReply.error(r); } 279 }); 280 281 return false; 282 }, 283 284 show : function(xml) { 285 286 if ( typeof(xml) == 'string' ) { 287 this.error({'responseText': xml}); 288 return false; 289 } 290 291 var r = wpAjax.parseAjaxResponse(xml); 292 if ( r.errors ) { 293 this.error({'responseText': wpAjax.broken}); 294 return false; 295 } 296 297 if ( 'edit-comment' == this.act ) 298 $(this.o).remove(); 299 300 r = r.responses[0]; 301 var c = r.data; 302 303 $(c).hide() 304 $('#replyrow').after(c); 305 this.o = id = '#comment-'+r.id; 306 this.revert(); 307 this.addEvents($(id)); 308 var bg = $(id).hasClass('unapproved') ? '#ffffe0' : '#fff'; 309 310 $(id) 311 .animate( { 'backgroundColor':'#CCEEBB' }, 600 ) 312 .animate( { 'backgroundColor': bg }, 600 ); 313 314 $.fn.wpList.process($(id)) 315 }, 316 317 error : function(r) { 318 var er = r.statusText; 319 320 $('#replysubmit .waiting').hide(); 321 322 if ( r.responseText ) 323 er = r.responseText.replace( /<.[^<>]*?>/g, '' ); 324 325 if ( er ) 326 $('#replysubmit .error').html(er).show(); 327 328 } 329 }; 330 toggleWithKeyboard = false; 331 $(document).ready(function(){ 332 columns.init('edit-comments'); 333 commentReply.init(); 334 335 if ( typeof QTags != 'undefined' ) 336 ed_reply = new QTags('ed_reply', 'replycontent', 'replycontainer', 'more'); 337 338 if ( typeof $.table_hotkeys != 'undefined' ) { 339 var make_hotkeys_redirect = function(which) { 340 return function() { 341 var first_last = 'next' == which? 'first' : 'last'; 342 var l=$('.'+which+'.page-numbers'); 343 if (l.length) 344 window.location = l[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g, '')+'&hotkeys_highlight_'+first_last+'=1'; 345 } 346 }; 347 var edit_comment = function(event, current_row) { 348 window.location = $('span.edit a', current_row).attr('href'); 349 }; 350 var toggle_all = function() { 351 toggleWithKeyboard = true; 352 var master_checkbox = $('form#comments-form .check-column :checkbox:first'); 353 master_checkbox.click().attr('checked', ''); 354 toggleWithKeyboard = false; 355 } 356 var make_bulk = function(value) { 357 return function(event, _) { 358 $('option[value='+value+']').attr('selected', 'selected'); 359 $('form#comments-form')[0].submit(); 360 } 361 }; 362 $.table_hotkeys($('table.widefat'),['a', 'u', 's', 'd', 'r', 'q', ['e', edit_comment], 363 ['shift+a', make_bulk('approve')], ['shift+s', make_bulk('markspam')], 364 ['shift+d', make_bulk('delete')], ['shift+x', toggle_all], 365 ['shift+u', make_bulk('unapprove')]], 366 {highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last, 367 prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next')} 368 ); 369 } 370 }); 371 372 })(jQuery); 1 var theList,theExtraList;(function(a){setCommentsList=function(){var g,i,h,f=0,c,e,d,b;g=a('#comments-form .tablenav :input[name="_total"]');i=a('#comments-form .tablenav :input[name="_per_page"]');h=a('#comments-form .tablenav :input[name="_page"]');c=function(k,j){var l=a("#"+j.element);if(l.is(".unapproved")){l.find("div.comment_status").html("0")}else{l.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}o=o+(a("#"+j.element).is("."+j.dimClass)?1:-1);if(o<0){o=0}a("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};e=function(j){j.data._total=g.val();j.data._per_page=i.val();j.data._page=h.val();j.data._url=document.location.href;return j};d=function(j,k,l){if(k<f){return}g.val(j.toString());if(l){f=k}a("span.total-type-count").each(function(){var m=a(this),o;o=g.val().toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};b=function(l,j){a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a("#"+j.element).is(".unapproved")){o=o-1}else{if(a(j.target).parents("span.unapprove").size()){o=o+1}}if(o<0){o=0}a("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});a("span.spam-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a(j.target).parents("span.spam").size()){o=o+1}else{if(a("#"+j.element).is(".spam")){o=o-1}}if(o<0){o=0}o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});if(("object"==typeof l)&&f<j.parsed.responses[0].supplemental.time){d(j.parsed.responses[0].supplemental.total,j.parsed.responses[0].supplemental.time,true);if(a.trim(j.parsed.responses[0].supplemental.pageLinks)){a(".tablenav-pages").find(".page-numbers").remove().end().append(a(j.parsed.responses[0].supplemental.pageLinks))}else{if("undefined"!=typeof j.parsed.responses[0].supplemental.pageLinks){a(".tablenav-pages").find(".page-numbers").remove()}}}else{var k=parseInt(g.val(),10);if(k--<0){k=0}d(k,l,false)}if(theExtraList.size()==0||theExtraList.children().size()==0){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());a("#get-extra-comments").submit()};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:e,dimAfter:c,delAfter:b,addColor:"none"})};a(document).ready(function(){setCommentsList()});commentReply={init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send(this)});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}})},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){a(this.o).fadeIn("fast").css("backgroundColor","");a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("#edithead input").val("");a("#replysubmit .error").html("").hide();a("#replysubmit .waiting").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}},open:function(i,g,c){var e=this,d,b,f;e.close();e.o="#comment-"+i;a("#replyrow td").attr("colspan",a(".widefat thead th:visible").length);d=a("#replyrow"),rowData=a("#inline-"+i);b=e.act=(c=="edit")?"edit-comment":"replyto-comment";a("#action",d).val(b);a("#comment_post_ID",d).val(g);a("#comment_ID",d).val(i);if(c=="edit"){a("#author",d).val(a("div.author",rowData).text());a("#author-email",d).val(a("div.author-email",rowData).text());a("#author-url",d).val(a("div.author-url",rowData).text());a("#status",d).val(a("div.comment_status",rowData).text());a("#replycontent",d).val(a("textarea.comment",rowData).val());a("#edithead, #savebtn",d).show();a("#replyhead, #replybtn",d).hide();f=a(e.o).height();if(f>220){if(a.browser.msie){a("#replycontainer, #replycontent",d).height(f-105)}else{a("#replycontainer",d).height(f-105)}}a(e.o).after(d.hide()).fadeOut("fast",function(){a("#replyrow").fadeIn("fast")})}else{a("#edithead, #savebtn",d).hide();a("#replyhead, #replybtn",d).show();a(e.o).after(d);a("#replyrow").hide().fadeIn("fast")}if(!a.browser.msie){a("#replycontainer").resizable({handles:"s",axis:"y",minHeight:80,stop:function(){a("#replycontainer").width("auto")}})}setTimeout(function(){var l,j,m,h,k;l=a("#replyrow").offset().top;j=l+a("#replyrow").height();m=window.pageYOffset||document.documentElement.scrollTop;h=document.documentElement.clientHeight||self.innerHeight||0;k=m+h;if(k-20<j){window.scroll(0,j-h+35)}else{if(l-20<m){window.scroll(0,l-35)}}a("#replycontent").focus().keyup(function(n){if(n.which==27){commentReply.revert()}})},600);return false},send:function(){var b={};a("#replysubmit .waiting").show();a("#replyrow input").each(function(){b[a(this).attr("name")]=a(this).val()});b.content=a("#replycontent").val();b.id=b.comment_post_ID;a.ajax({type:"POST",url:wpListL10n.url,data:b,success:function(c){commentReply.show(c)},error:function(c){commentReply.error(c)}});return false},show:function(b){var e,g,f,d;if(typeof(b)=="string"){this.error({responseText:b});return false}e=wpAjax.parseAjaxResponse(b);if(e.errors){this.error({responseText:wpAjax.broken});return false}if("edit-comment"==this.act){a(this.o).remove()}e=e.responses[0];g=e.data;a(g).hide();a("#replyrow").after(g);this.o=f="#comment-"+e.id;this.revert();this.addEvents(a(f));d=a(f).hasClass("unapproved")?"#ffffe0":"#fff";a(f).animate({backgroundColor:"#CCEEBB"},600).animate({backgroundColor:d},600);a.fn.wpList.process(a(f))},error:function(b){var c=b.statusText;a("#replysubmit .waiting").hide();if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};toggleWithKeyboard=false;a(document).ready(function(){var e,b,c,d;columns.init("edit-comments");commentReply.init();if(typeof QTags!="undefined"){ed_reply=new QTags("ed_reply","replycontent","replycontainer","more")}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a("."+f+".page-numbers");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;var f=a("form#comments-form .check-column :checkbox:first");f.click().attr("checked","");toggleWithKeyboard=false};d=function(f){return function(h,g){a("option[value="+f+"]").attr("selected","selected");a("form#comments-form")[0].submit()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q",["e",b],["shift+a",d("approve")],["shift+s",d("markspam")],["shift+d",d("delete")],["shift+x",c],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery); -
trunk/wp-admin/js/editor.js
r10232 r10291 1 2 var switchEditors = { 3 4 mode : '', 5 6 I : function(e) { 7 return document.getElementById(e); 8 }, 9 10 edInit : function() { 11 var h = tinymce.util.Cookie.getHash("TinyMCE_content_size"), H = this.I('edButtonHTML'), P = this.I('edButtonPreview'); 12 13 // Activate TinyMCE if it's the user's default editor 14 if ( getUserSetting( 'editor' ) == 'html' ) { 15 if ( h ) 16 try { this.I('content').style.height = h.ch - 30 + 'px'; } catch(e){}; 17 } else { 18 try { 19 this.I("quicktags").style.display = "none"; 20 } catch(e){}; 21 tinyMCE.execCommand("mceAddControl", false, "content"); 22 } 23 }, 24 25 saveCallback : function(el, content, body) { 26 27 if ( tinyMCE.activeEditor.isHidden() ) 28 content = this.I(el).value; 29 else 30 content = this.pre_wpautop(content); 31 32 return content; 33 }, 34 35 pre_wpautop : function(content) { 36 // We have a TON of cleanup to do. Line breaks are already stripped. 37 38 // Protect pre|script tags 39 content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) { 40 a = a.replace(/<br ?\/?>[\r\n]*/g, '<wp_temp>'); 41 return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '<wp_temp>'); 42 }); 43 44 // Pretty it up for the source editor 45 var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p'; 46 content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'mg'), '</$1>\n'); 47 content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'mg'), '\n<$1>'); 48 49 // Mark </p> if it has any attributes. 50 content = content.replace(new RegExp('(<p [^>]+>.*?)</p>', 'mg'), '$1</p#>'); 51 52 // Sepatate <div> containing <p> 53 content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'mgi'), '<div$1>\n\n'); 54 55 // Remove <p> and <br /> 56 content = content.replace(new RegExp('\\s*<p>', 'mgi'), ''); 57 content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n'); 58 content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n'); 59 content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n'); 60 61 // Fix some block element newline issues 62 content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div'); 63 content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n'); 64 content = content.replace(new RegExp('\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*', 'gi'), '\n\n[caption$1[/caption]\n\n'); 65 content = content.replace(new RegExp('caption\\]\\n\\n+\\[caption', 'g'), 'caption]\n\n[caption'); 66 67 var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre'; 68 content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>'); 69 content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'mg'), '</$1>\n'); 70 content = content.replace(new RegExp('<li([^>]*)>', 'g'), '\t<li$1>'); 71 72 if ( content.indexOf('<object') != -1 ) { 73 content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'mg'), "<param$1>"); 74 content = content.replace(new RegExp('\\s*</embed>\\s*', 'mg'), '</embed>'); 75 } 76 77 // Unmark special paragraph closing tags 78 content = content.replace(new RegExp('</p#>', 'g'), '</p>\n'); 79 content = content.replace(new RegExp('\\s*(<p [^>]+>.*</p>)', 'mg'), '\n$1'); 80 81 // Trim whitespace 82 content = content.replace(new RegExp('^\\s*', ''), ''); 83 content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), ''); 84 85 // put back the line breaks in pre|script 86 content = content.replace(/<wp_temp>/g, '\n'); 87 88 // Hope. 89 return content; 90 }, 91 92 go : function(id, mode) { 93 id = id || 'content'; 94 mode = mode || this.mode || ''; 95 96 var ed = tinyMCE.get(id) || false; 97 var qt = this.I('quicktags'); 98 var H = this.I('edButtonHTML'); 99 var P = this.I('edButtonPreview'); 100 var ta = this.I(id); 101 102 if ( 'tinymce' == mode ) { 103 104 if ( ed && ! ed.isHidden() ) 105 return false; 106 107 this.mode = 'html'; 108 ta.style.color = '#fff'; 109 110 P.className = 'active'; 111 H.className = ''; 112 edCloseAllTags(); // :-( 113 114 qt.style.display = 'none'; 115 116 ta.value = this.wpautop(ta.value); 117 118 if ( ed ) ed.show(); 119 else tinyMCE.execCommand("mceAddControl", false, id); 120 121 setUserSetting( 'editor', 'tinymce' ); 122 } else { 123 if ( ! ed || ed.isHidden() ) 124 return false; 125 126 this.mode = 'tinymce'; 127 H.className = 'active'; 128 P.className = ''; 129 130 ta.style.height = ed.getContentAreaContainer().offsetHeight + 6 + 'px'; 131 132 ed.hide(); 133 qt.style.display = 'block'; 134 135 ta.style.color = ''; 136 setUserSetting( 'editor', 'html' ); 137 } 138 return false; 139 }, 140 141 wpautop : function(pee) { 142 var blocklist = 'table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]'; 143 144 pee = pee + "\n\n"; 145 pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n"); 146 pee = pee.replace(new RegExp('(<(?:'+blocklist+')[^>]*>)', 'gi'), "\n$1"); 147 pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), "$1\n\n"); 148 pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n"); 149 pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n"); 150 pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n"); 151 pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), ''); 152 pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1"); 153 pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1"); 154 pee = pee.replace(new RegExp('<p>\\s*<blockquote([^>]*)>', 'gi'), "<blockquote$1><p>"); 155 pee = pee.replace(new RegExp('</blockquote>\\s*</p>', 'gi'), '</p></blockquote>'); 156 pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1"); 157 pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1"); 158 pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n"); 159 pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1"); 160 pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1'); 161 pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]'); 162 // pee = pee.replace(new RegExp('^((?: )*)\\s', 'mg'), '$1 '); 163 164 // Fix the pre|script tags 165 pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) { 166 a = a.replace(/<br ?\/?>[\r\n]*/g, '\n'); 167 return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '\n'); 168 }); 169 170 return pee; 171 } 172 }; 1 var switchEditors={mode:"",I:function(a){return document.getElementById(a)},edInit:function(){var a=tinymce.util.Cookie.getHash("TinyMCE_content_size");if(getUserSetting("editor")=="html"){if(a){try{this.I("content").style.height=a.ch-30+"px"}catch(b){}}}else{try{this.I("quicktags").style.display="none"}catch(b){}tinyMCE.execCommand("mceAddControl",false,"content")}},saveCallback:function(b,c,a){if(tinyMCE.activeEditor.isHidden()){c=this.I(b).value}else{c=this.pre_wpautop(c)}return c},pre_wpautop:function(b){var c,a;b=b.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g,function(d){d=d.replace(/<br ?\/?>[\r\n]*/g,"<wp_temp>");return d.replace(/<\/?p( [^>]*)?>[\r\n]*/g,"<wp_temp>")});c="blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p";b=b.replace(new RegExp("\\s*</("+c+")>\\s*","mg"),"</$1>\n");b=b.replace(new RegExp("\\s*<(("+c+")[^>]*)>","mg"),"\n<$1>");b=b.replace(new RegExp("(<p [^>]+>.*?)</p>","mg"),"$1</p#>");b=b.replace(new RegExp("<div([^>]*)>\\s*<p>","mgi"),"<div$1>\n\n");b=b.replace(new RegExp("\\s*<p>","mgi"),"");b=b.replace(new RegExp("\\s*</p>\\s*","mgi"),"\n\n");b=b.replace(new RegExp("\\n\\s*\\n","mgi"),"\n\n");b=b.replace(new RegExp("\\s*<br ?/?>\\s*","gi"),"\n");b=b.replace(new RegExp("\\s*<div","mg"),"\n<div");b=b.replace(new RegExp("</div>\\s*","mg"),"</div>\n");b=b.replace(new RegExp("\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*","gi"),"\n\n[caption$1[/caption]\n\n");b=b.replace(new RegExp("caption\\]\\n\\n+\\[caption","g"),"caption]\n\n[caption");a="blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre";b=b.replace(new RegExp("\\s*<(("+a+") ?[^>]*)\\s*>","mg"),"\n<$1>");b=b.replace(new RegExp("\\s*</("+a+")>\\s*","mg"),"</$1>\n");b=b.replace(new RegExp("<li([^>]*)>","g"),"\t<li$1>");if(b.indexOf("<object")!=-1){b=b.replace(new RegExp("\\s*<param([^>]*)>\\s*","mg"),"<param$1>");b=b.replace(new RegExp("\\s*</embed>\\s*","mg"),"</embed>")}b=b.replace(new RegExp("</p#>","g"),"</p>\n");b=b.replace(new RegExp("\\s*(<p [^>]+>.*</p>)","mg"),"\n$1");b=b.replace(new RegExp("^\\s*",""),"");b=b.replace(new RegExp("[\\s\\u00a0]*$",""),"");b=b.replace(/<wp_temp>/g,"\n");return b},go:function(g,e){g=g||"content";e=e||this.mode||"";var b=tinyMCE.get(g)||false,f=this.I("quicktags"),c=this.I("edButtonHTML"),d=this.I("edButtonPreview"),a=this.I(g);if("tinymce"==e){if(b&&!b.isHidden()){return false}this.mode="html";a.style.color="#fff";d.className="active";c.className="";edCloseAllTags();f.style.display="none";a.value=this.wpautop(a.value);if(b){b.show()}else{tinyMCE.execCommand("mceAddControl",false,g)}setUserSetting("editor","tinymce")}else{if(!b||b.isHidden()){return false}this.mode="tinymce";c.className="active";d.className="";a.style.height=b.getContentAreaContainer().offsetHeight+6+"px";b.hide();f.style.display="block";a.style.color="";setUserSetting("editor","html")}return false},wpautop:function(a){var b="table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]";a=a+"\n\n";a=a.replace(new RegExp("<br />\\s*<br />","gi"),"\n\n");a=a.replace(new RegExp("(<(?:"+b+")[^>]*>)","gi"),"\n$1");a=a.replace(new RegExp("(</(?:"+b+")>)","gi"),"$1\n\n");a=a.replace(new RegExp("\\r\\n|\\r","g"),"\n");a=a.replace(new RegExp("\\n\\s*\\n+","g"),"\n\n");a=a.replace(new RegExp("([\\s\\S]+?)\\n\\n","mg"),"<p>$1</p>\n");a=a.replace(new RegExp("<p>\\s*?</p>","gi"),"");a=a.replace(new RegExp("<p>\\s*(</?(?:"+b+")[^>]*>)\\s*</p>","gi"),"$1");a=a.replace(new RegExp("<p>(<li.+?)</p>","gi"),"$1");a=a.replace(new RegExp("<p>\\s*<blockquote([^>]*)>","gi"),"<blockquote$1><p>");a=a.replace(new RegExp("</blockquote>\\s*</p>","gi"),"</p></blockquote>");a=a.replace(new RegExp("<p>\\s*(</?(?:"+b+")[^>]*>)","gi"),"$1");a=a.replace(new RegExp("(</?(?:"+b+")[^>]*>)\\s*</p>","gi"),"$1");a=a.replace(new RegExp("\\s*\\n","gi"),"<br />\n");a=a.replace(new RegExp("(</?(?:"+b+")[^>]*>)\\s*<br />","gi"),"$1");a=a.replace(new RegExp("<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)","gi"),"$1");a=a.replace(new RegExp("(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*","gi"),"[caption$1[/caption]");a=a.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g,function(c){c=c.replace(/<br ?\/?>[\r\n]*/g,"\n");return c.replace(/<\/?p( [^>]*)?>[\r\n]*/g,"\n")});return a}}; -
trunk/wp-admin/js/gallery.js
r9917 r10291 1 jQuery(function($) { 2 var gallerySortable; 3 var gallerySortableInit = function() { 4 gallerySortable = $('#media-items').sortable( { 5 items: '.media-item', 6 placeholder: 'sorthelper', 7 axis: 'y', 8 distance: 2, 9 update: galleryReorder 10 } ); 11 } 12 13 // When an update has occurred, adjust the order for each item 14 var galleryReorder = function(e, sort) { 15 jQuery.each(sort['element'].sortable('toArray'), function(i, id) { 16 jQuery('#' + id + ' .menu_order input')[0].value = (1+i); 17 }); 18 } 19 20 // initialize sortable 21 gallerySortableInit(); 22 }); 23 24 jQuery(document).ready(function($){ 25 $('.menu_order_input').each(function(){ 26 if ( this.value == '0' ) this.value = ''; 27 }); 28 29 if ( $('#media-items>*').length > 1 ) { 30 var w = wpgallery.getWin(); 31 32 $('#save-all, #gallery-settings').show(); 33 if ( typeof w.tinyMCE != 'undefined' && w.tinyMCE.activeEditor && ! w.tinyMCE.activeEditor.isHidden() ) { 34 wpgallery.mcemode = true; 35 wpgallery.init(); 36 } else { 37 $('#insert-gallery').show(); 38 } 39 } 40 }); 41 42 jQuery(window).unload( function () { tinymce = tinyMCE = wpgallery = null; } ); // Cleanup 43 44 /* gallery settings */ 45 var tinymce = null, tinyMCE; 46 47 var wpgallery = { 48 mcemode : false, 49 editor : {}, 50 dom : {}, 51 is_update : false, 52 el : {}, 53 54 I : function(e) { 55 return document.getElementById(e); 56 }, 57 58 init: function() { 59 var t = this, li, q, i, it, w = t.getWin(); 60 61 if ( ! t.mcemode ) return; 62 63 li = ('' + document.location.search).replace(/^\?/, '').split('&'); 64 q = {}; 65 for (i=0; i<li.length; i++) { 66 it = li[i].split('='); 67 q[unescape(it[0])] = unescape(it[1]); 68 } 69 70 if (q.mce_rdomain) 71 document.domain = q.mce_rdomain; 72 73 // Find window & API 74 tinymce = w.tinymce; 75 tinyMCE = w.tinyMCE; 76 t.editor = tinymce.EditorManager.activeEditor; 77 78 t.setup(); 79 }, 80 81 getWin : function() { 82 return window.dialogArguments || opener || parent || top; 83 }, 84 85 restoreSelection : function() { 86 var t = this; 87 88 if (tinymce.isIE) 89 t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark); 90 }, 91 92 setup : function() { 93 var t = this, a, f = document.forms[0], ed = t.editor, el, g; 94 if ( ! t.mcemode ) return; 95 96 t.restoreSelection(); 97 t.el = ed.selection.getNode(); 98 99 if ( t.el.nodeName != 'IMG' || ! ed.dom.hasClass(t.el, 'wpGallery') ) { 100 if ( (g = ed.dom.select('img.wpGallery')) && g[0] ) { 101 t.el = g[0]; 102 } else { 103 if ( getUserSetting('galfile') == '1' ) t.I('linkto-file').checked = "checked"; 104 if ( getUserSetting('galdesc') == '1' ) t.I('order-desc').checked = "checked"; 105 if ( getUserSetting('galcols') ) t.I('columns').value = getUserSetting('galcols'); 106 if ( getUserSetting('galord') ) t.I('orderby').value = getUserSetting('galord'); 107 jQuery('#insert-gallery').show(); 108 return; 109 } 110 } 111 112 a = ed.dom.getAttrib(t.el, 'title'); 113 a = ed.dom.decode(a); 114 115 if ( a ) { 116 jQuery('#update-gallery').show(); 117 t.is_update = true; 118 119 var columns = a.match(/columns=['"]([0-9]+)['"]/), link = a.match(/link=['"]([^'"]+)['"]/i); 120 var order = a.match(/order=['"]([^'"]+)['"]/i), orderby = a.match(/orderby=['"]([^'"]+)['"]/i), all = ''; 121 122 if ( link && link[1] ) t.I('linkto-file').checked = "checked"; 123 if ( order && order[1] ) t.I('order-desc').checked = "checked"; 124 if ( columns && columns[1] ) t.I('columns').value = ''+columns[1]; 125 if ( orderby && orderby[1] ) t.I('orderby').value = orderby[1]; 126 } else { 127 jQuery('#insert-gallery').show(); 128 } 129 }, 130 131 update : function() { 132 var t = this, ed = t.editor, el, all = ''; 133 134 if ( ! t.mcemode || ! t.is_update ) { 135 var s = '[gallery'+t.getSettings()+']'; 136 t.getWin().send_to_editor(s); 137 return; 138 } 139 140 if (t.el.nodeName != 'IMG') return; 141 142 all = ed.dom.decode(ed.dom.getAttrib(t.el, 'title')); 143 all = all.replace(/\s*(order|link|columns|orderby)=['"]([^'"]+)['"]/gi, ''); 144 all += t.getSettings(); 145 146 ed.dom.setAttrib(t.el, 'title', all); 147 t.getWin().tb_remove(); 148 }, 149 150 getSettings : function() { 151 var I = this.I, s = ''; 152 153 if ( I('linkto-file').checked ) { 154 s += ' link="file"'; 155 setUserSetting('galfile', '1'); 156 } 157 158 if ( I('order-desc').checked ) { 159 s += ' order="DESC"'; 160 setUserSetting('galdesc', '1'); 161 } 162 163 if ( I('columns').value != 3 ) { 164 s += ' columns="'+I('columns').value+'"'; 165 setUserSetting('galcols', I('columns').value); 166 } 167 168 if ( I('orderby').value != 'menu_order' ) { 169 s += ' orderby="'+I('orderby').value+'"'; 170 setUserSetting('galord', I('orderby').value); 171 } 172 173 return s; 174 } 175 }; 1 jQuery(document).ready(function(d){var c,e,b,a;e=function(){c=d("#media-items").sortable({items:".media-item",placeholder:"sorthelper",axis:"y",distance:2,update:b})};b=function(g,f){jQuery.each(f.element.sortable("toArray"),function(h,j){jQuery("#"+j+" .menu_order input")[0].value=(1+h)})};e();d(".menu_order_input").each(function(){if(this.value=="0"){this.value=""}});if(d("#media-items>*").length>1){a=wpgallery.getWin();d("#save-all, #gallery-settings").show();if(typeof a.tinyMCE!="undefined"&&a.tinyMCE.activeEditor&&!a.tinyMCE.activeEditor.isHidden()){wpgallery.mcemode=true;wpgallery.init()}else{d("#insert-gallery").show()}}});jQuery(window).unload(function(){tinymce=tinyMCE=wpgallery=null});var tinymce=null,tinyMCE,wpgallery;wpgallery={mcemode:false,editor:{},dom:{},is_update:false,el:{},I:function(a){return document.getElementById(a)},init:function(){var d=this,a,f,c,e,b=d.getWin();if(!d.mcemode){return}a=(""+document.location.search).replace(/^\?/,"").split("&");f={};for(c=0;c<a.length;c++){e=a[c].split("=");f[unescape(e[0])]=unescape(e[1])}if(f.mce_rdomain){document.domain=f.mce_rdomain}tinymce=b.tinymce;tinyMCE=b.tinyMCE;d.editor=tinymce.EditorManager.activeEditor;d.setup()},getWin:function(){return window.dialogArguments||opener||parent||top},restoreSelection:function(){var a=this;if(tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},setup:function(){var f=this,c,d=f.editor,i;if(!f.mcemode){return}f.restoreSelection();f.el=d.selection.getNode();if(f.el.nodeName!="IMG"||!d.dom.hasClass(f.el,"wpGallery")){if((i=d.dom.select("img.wpGallery"))&&i[0]){f.el=i[0]}else{if(getUserSetting("galfile")=="1"){f.I("linkto-file").checked="checked"}if(getUserSetting("galdesc")=="1"){f.I("order-desc").checked="checked"}if(getUserSetting("galcols")){f.I("columns").value=getUserSetting("galcols")}if(getUserSetting("galord")){f.I("orderby").value=getUserSetting("galord")}jQuery("#insert-gallery").show();return}}c=d.dom.getAttrib(f.el,"title");c=d.dom.decode(c);if(c){jQuery("#update-gallery").show();f.is_update=true;var e=c.match(/columns=['"]([0-9]+)['"]/),h=c.match(/link=['"]([^'"]+)['"]/i),b=c.match(/order=['"]([^'"]+)['"]/i),j=c.match(/orderby=['"]([^'"]+)['"]/i);if(h&&h[1]){f.I("linkto-file").checked="checked"}if(b&&b[1]){f.I("order-desc").checked="checked"}if(e&&e[1]){f.I("columns").value=""+e[1]}if(j&&j[1]){f.I("orderby").value=j[1]}}else{jQuery("#insert-gallery").show()}},update:function(){var b=this,a=b.editor,d="",c;if(!b.mcemode||!b.is_update){c="[gallery"+b.getSettings()+"]";b.getWin().send_to_editor(c);return}if(b.el.nodeName!="IMG"){return}d=a.dom.decode(a.dom.getAttrib(b.el,"title"));d=d.replace(/\s*(order|link|columns|orderby)=['"]([^'"]+)['"]/gi,"");d+=b.getSettings();a.dom.setAttrib(b.el,"title",d);b.getWin().tb_remove()},getSettings:function(){var a=this.I,b="";if(a("linkto-file").checked){b+=' link="file"';setUserSetting("galfile","1")}if(a("order-desc").checked){b+=' order="DESC"';setUserSetting("galdesc","1")}if(a("columns").value!=3){b+=' columns="'+a("columns").value+'"';setUserSetting("galcols",a("columns").value)}if(a("orderby").value!="menu_order"){b+=' orderby="'+a("orderby").value+'"';setUserSetting("galord",a("orderby").value)}return b}}; -
trunk/wp-admin/js/inline-edit-post.js
r10258 r10291 1 2 (function($) { 3 inlineEditPost = { 4 5 init : function() { 6 var t = this, qeRow = $('#inline-edit'), bulkRow = $('#bulk-edit'); 7 8 t.type = $('table.widefat').hasClass('page') ? 'page' : 'post'; 9 t.what = '#'+t.type+'-'; 10 11 // get all editable rows 12 t.rows = $('tr.iedit'); 13 14 // prepare the edit rows 15 qeRow.keyup(function(e) { if(e.which == 27) return inlineEditPost.revert(); }); 16 bulkRow.keyup(function(e) { if (e.which == 27) return inlineEditPost.revert(); }); 17 18 $('a.cancel', qeRow).click(function() { return inlineEditPost.revert(); }); 19 $('a.save', qeRow).click(function() { return inlineEditPost.save(this); }); 20 $('input, select', qeRow).keydown(function(e) { if(e.which == 13) return inlineEditPost.save(this); }); 21 22 $('a.cancel', bulkRow).click(function() { return inlineEditPost.revert(); }); 23 24 $('#inline-edit .inline-edit-private input[value=private]').click( function(){ 25 var pw = $('input.inline-edit-password-input'); 26 if ( $(this).attr('checked') ) { 27 pw.val('').attr('disabled', 'disabled'); 28 } else { 29 pw.attr('disabled', ''); 30 } 31 }); 32 33 // add events 34 t.addEvents(t.rows); 35 36 $('#bulk-title-div').parents('fieldset').after( 37 $('#inline-edit fieldset.inline-edit-categories').clone() 38 ).siblings( 'fieldset:last' ).prepend( 39 // ).siblings( 'fieldset:last' ).after( '<fieldset class="inline-edit-col-bottom"><div class="inline-edit-col"></div></fieldset>' ); 40 // $('fieldset.inline-edit-col-bottom').prepend( 41 $('#inline-edit label.inline-edit-tags').clone() 42 ); 43 44 // categories expandable? 45 $('span.catshow').click(function() { 46 $('.inline-editor ul.cat-checklist').addClass("cat-hover"); 47 $('.inline-editor span.cathide').show(); 48 $(this).hide(); 49 }); 50 51 $('span.cathide').click(function() { 52 $('.inline-editor ul.cat-checklist').removeClass("cat-hover"); 53 $('.inline-editor span.catshow').show(); 54 $(this).hide(); 55 }); 56 57 $('select[name="_status"] option[value="future"]', bulkRow).remove(); 58 59 $('#doaction, #doaction2').click(function(e){ 60 var n = $(this).attr('id').substr(2); 61 if ( $('select[name="'+n+'"]').val() == 'edit' ) { 62 e.preventDefault(); 63 t.setBulk(); 64 } else if ( $('form#posts-filter tr.inline-editor').length > 0 ) { 65 t.revert(); 66 } 67 }); 68 69 $('#post-query-submit').click(function(e){ 70 if ( $('form#posts-filter tr.inline-editor').length > 0 ) 71 t.revert(); 72 }); 73 74 }, 75 76 toggle : function(el) { 77 var t = this; 78 79 $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el); 80 }, 81 82 addEvents : function(r) { 83 r.each(function() { 84 var row = $(this); 85 $('a.editinline', row).click(function() { inlineEditPost.edit(this); return false; }); 86 }); 87 }, 88 89 setBulk : function() { 90 var te = '', c = '', type = this.type; 91 this.revert(); 92 93 $('#bulk-edit td').attr('colspan', $('.widefat:first thead th:visible').length); 94 $('table.widefat tbody').prepend( $('#bulk-edit') ); 95 $('#bulk-edit').addClass('inline-editor').show(); 96 97 $('tbody th.check-column input[type="checkbox"]').each(function(i){ 98 if ( $(this).attr('checked') ) { 99 var id = $(this).val(); 100 var theTitle = $('#inline_'+id+' .post_title').text() || inlineEditL10n.notitle; 101 te += '<div id="ttle'+id+'"><a id="_'+id+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+theTitle+'</div>'; 102 } 103 }); 104 105 $('#bulk-titles').html(te); 106 $('#bulk-titles a').click(function() { 107 var id = $(this).attr('id').substr(1), r = inlineEditPost.type+'-'+id; 108 109 $('table.widefat input[value="'+id+'"]').attr('checked', ''); 110 $('#ttle'+id).remove(); 111 }); 112 113 // enable autocomplete for tags 114 if ( type == 'post' ) 115 $('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } ); 116 }, 117 118 edit : function(id) { 119 var t = this; 120 t.revert(); 121 122 if ( typeof(id) == 'object' ) 123 id = t.getId(id); 124 125 var fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password']; 126 if ( t.type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template'); 127 if ( t.type == 'post' ) fields.push('tags_input'); 128 129 // add the new blank row 130 var editRow = $('#inline-edit').clone(true); 131 $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length); 132 133 if ( $(t.what+id).hasClass('alternate') ) 134 $(editRow).addClass('alternate'); 135 $(t.what+id).hide().after(editRow); 136 137 // populate the data 138 var rowData = $('#inline_'+id); 139 for ( var f = 0; f < fields.length; f++ ) { 140 $(':input[name="'+fields[f]+'"]', editRow).val( $('.'+fields[f], rowData).text() ); 141 } 142 143 if ( $('.comment_status', rowData).text() == 'open' ) 144 $('input[name="comment_status"]', editRow).attr("checked", "checked"); 145 if ( $('.ping_status', rowData).text() == 'open' ) 146 $('input[name="ping_status"]', editRow).attr("checked", "checked"); 147 if ( $('.sticky', rowData).text() == 'sticky' ) 148 $('input[name="sticky"]', editRow).attr("checked", "checked"); 149 150 // categories 151 var cats; 152 if ( cats = $('.post_category', rowData).text() ) 153 $('ul.cat-checklist :checkbox', editRow).val(cats.split(',')); 154 155 // handle the post status 156 var status = $('._status', rowData).text(); 157 if ( status != 'future' ) $('select[name="_status"] option[value="future"]', editRow).remove(); 158 if ( status == 'private' ) { 159 $('input[name="keep_private"]', editRow).attr("checked", "checked"); 160 $('input.inline-edit-password-input').val('').attr('disabled', 'disabled'); 161 } 162 163 // remove the current page and children from the parent dropdown 164 var pageOpt = $('select[name="post_parent"] option[value="'+id+'"]', editRow); 165 if ( pageOpt.length > 0 ) { 166 var pageLevel = pageOpt[0].className.split('-')[1], nextPage = pageOpt, pageLoop = true; 167 while ( pageLoop ) { 168 var nextPage = nextPage.next('option'); 169 if (nextPage.length == 0) break; 170 var nextLevel = nextPage[0].className.split('-')[1]; 171 if ( nextLevel <= pageLevel ) { 172 pageLoop = false; 173 } else { 174 nextPage.remove(); 175 nextPage = pageOpt; 176 } 177 } 178 pageOpt.remove(); 179 } 180 181 $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show(); 182 $('.ptitle', editRow).focus(); 183 184 // enable autocomplete for tags 185 if ( t.type == 'post' ) 186 $('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } ); 187 188 return false; 189 }, 190 191 save : function(id) { 192 if( typeof(id) == 'object' ) 193 id = this.getId(id); 194 195 $('table.widefat .inline-edit-save .waiting').show(); 196 197 var params = { 198 action: 'inline-save', 199 post_type: this.type, 200 post_ID: id, 201 edit_date: 'true' 202 }; 203 204 var fields = $('#edit-'+id+' :input').fieldSerialize(); 205 params = fields + '&' + $.param(params); 206 207 // make ajax request 208 $.post('admin-ajax.php', params, 209 function(r) { 210 $('table.widefat .inline-edit-save .waiting').hide(); 211 212 if (r) { 213 if ( -1 != r.indexOf('<tr') ) { 214 $(inlineEditPost.what+id).remove(); 215 $('#edit-'+id).before(r).remove(); 216 217 var row = $(inlineEditPost.what+id); 218 row.hide(); 219 220 if ( 'draft' == $('input[name="post_status"]').val() ) 221 row.find('td.column-comments').hide(); 222 223 inlineEditPost.addEvents(row); 224 row.fadeIn(); 225 } else { 226 r = r.replace( /<.[^<>]*?>/g, '' ); 227 $('#edit-'+id+' .inline-edit-save').append('<span class="error">'+r+'</span>'); 228 } 229 } else { 230 $('#edit-'+id+' .inline-edit-save').append('<span class="error">'+inlineEditL10n.error+'</span>'); 231 } 232 } 233 , 'html'); 234 return false; 235 }, 236 237 revert : function() { 238 var id; 239 240 if ( id = $('table.widefat tr.inline-editor').attr('id') ) { 241 $('table.widefat .inline-edit-save .waiting').hide(); 242 243 if ( 'bulk-edit' == id ) { 244 $('table.widefat #bulk-edit').removeClass('inline-editor').hide(); 245 $('#bulk-titles').html(''); 246 $('#inlineedit').append( $('#bulk-edit') ); 247 } else { 248 $('#'+id).remove(); 249 id = id.substr( id.lastIndexOf('-') + 1 ); 250 $(this.what+id).show(); 251 } 252 } 253 254 return false; 255 }, 256 257 getId : function(o) { 258 var id = o.tagName == 'TR' ? o.id : $(o).parents('tr').attr('id'); 259 var parts = id.split('-'); 260 return parts[parts.length - 1]; 261 } 262 }; 263 264 $(document).ready(function(){inlineEditPost.init();}); 265 })(jQuery); 1 (function(a){inlineEditPost={init:function(){var c=this,d=a("#inline-edit"),b=a("#bulk-edit");c.type=a("table.widefat").hasClass("page")?"page":"post";c.what="#"+c.type+"-";c.rows=a("tr.iedit");d.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});b.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});a("a.cancel",d).click(function(){return inlineEditPost.revert()});a("a.save",d).click(function(){return inlineEditPost.save(this)});a("input, select",d).keydown(function(f){if(f.which==13){return inlineEditPost.save(this)}});a("a.cancel",b).click(function(){return inlineEditPost.revert()});a("#inline-edit .inline-edit-private input[value=private]").click(function(){var e=a("input.inline-edit-password-input");if(a(this).attr("checked")){e.val("").attr("disabled","disabled")}else{e.attr("disabled","")}});c.addEvents(c.rows);a("#bulk-title-div").parents("fieldset").after(a("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(a("#inline-edit label.inline-edit-tags").clone());a("span.catshow").click(function(){a(".inline-editor ul.cat-checklist").addClass("cat-hover");a(".inline-editor span.cathide").show();a(this).hide()});a("span.cathide").click(function(){a(".inline-editor ul.cat-checklist").removeClass("cat-hover");a(".inline-editor span.catshow").show();a(this).hide()});a('select[name="_status"] option[value="future"]',b).remove();a("#doaction, #doaction2").click(function(f){var g=a(this).attr("id").substr(2);if(a('select[name="'+g+'"]').val()=="edit"){f.preventDefault();c.setBulk()}else{if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}}});a("#post-query-submit").click(function(f){if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},addEvents:function(b){b.each(function(){var c=a(this);a("a.editinline",c).click(function(){inlineEditPost.edit(this);return false})})},setBulk:function(){var c="",b=this.type;this.revert();a("#bulk-edit td").attr("colspan",a(".widefat:first thead th:visible").length);a("table.widefat tbody").prepend(a("#bulk-edit"));a("#bulk-edit").addClass("inline-editor").show();a('tbody th.check-column input[type="checkbox"]').each(function(e){if(a(this).attr("checked")){var f=a(this).val(),d;d=a("#inline_"+f+" .post_title").text()||inlineEditL10n.notitle;c+='<div id="ttle'+f+'"><a id="_'+f+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+d+"</div>"}});a("#bulk-titles").html(c);a("#bulk-titles a").click(function(){var d=a(this).attr("id").substr(1);a('table.widefat input[value="'+d+'"]').attr("checked","");a("#ttle"+d).remove()});if(b=="post"){a('tr.inline-editor textarea[name="tags_input"]').suggest("admin-ajax.php?action=ajax-tag-search",{delay:500,minchars:2,multiple:true,multipleSep:", "})}},edit:function(b){var n=this,i,d,e,m,h,g,j;n.revert();if(typeof(b)=="object"){b=n.getId(b)}i=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password"];if(n.type=="page"){i.push("post_parent","menu_order","page_template")}if(n.type=="post"){i.push("tags_input")}d=a("#inline-edit").clone(true);a("td",d).attr("colspan",a(".widefat:first thead th:visible").length);if(a(n.what+b).hasClass("alternate")){a(d).addClass("alternate")}a(n.what+b).hide().after(d);e=a("#inline_"+b);for(j=0;j<i.length;j++){a(':input[name="'+i[j]+'"]',d).val(a("."+i[j],e).text())}if(a(".comment_status",e).text()=="open"){a('input[name="comment_status"]',d).attr("checked","checked")}if(a(".ping_status",e).text()=="open"){a('input[name="ping_status"]',d).attr("checked","checked")}if(a(".sticky",e).text()=="sticky"){a('input[name="sticky"]',d).attr("checked","checked")}if(m=a(".post_category",e).text()){a("ul.cat-checklist :checkbox",d).val(m.split(","))}h=a("._status",e).text();if(h!="future"){a('select[name="_status"] option[value="future"]',d).remove()}if(h=="private"){a('input[name="keep_private"]',d).attr("checked","checked");a("input.inline-edit-password-input").val("").attr("disabled","disabled")}g=a('select[name="post_parent"] option[value="'+b+'"]',d);if(g.length>0){var l=g[0].className.split("-")[1],c=true,k,o;while(c){k=k.next("option");if(k.length==0){break}o=k[0].className.split("-")[1];if(o<=l){c=false}else{k.remove();k=g}}g.remove()}a(d).attr("id","edit-"+b).addClass("inline-editor").show();a(".ptitle",d).focus();if(n.type=="post"){a('tr.inline-editor textarea[name="tags_input"]').suggest("admin-ajax.php?action=ajax-tag-search",{delay:500,minchars:2,multiple:true,multipleSep:", "})}return false},save:function(d){var c,b;if(typeof(d)=="object"){d=this.getId(d)}a("table.widefat .inline-edit-save .waiting").show();c={action:"inline-save",post_type:this.type,post_ID:d,edit_date:"true"};b=a("#edit-"+d+" :input").fieldSerialize();c=b+"&"+a.param(c);a.post("admin-ajax.php",c,function(e){a("table.widefat .inline-edit-save .waiting").hide();if(e){if(-1!=e.indexOf("<tr")){a(inlineEditPost.what+d).remove();a("#edit-"+d).before(e).remove();var f=a(inlineEditPost.what+d);f.hide();if("draft"==a('input[name="post_status"]').val()){f.find("td.column-comments").hide()}inlineEditPost.addEvents(f);f.fadeIn()}else{e=e.replace(/<.[^<>]*?>/g,"");a("#edit-"+d+" .inline-edit-save").append('<span class="error">'+e+"</span>")}}else{a("#edit-"+d+" .inline-edit-save").append('<span class="error">'+inlineEditL10n.error+"</span>")}},"html");return false},revert:function(){var b;if(b=a("table.widefat tr.inline-editor").attr("id")){a("table.widefat .inline-edit-save .waiting").hide();if("bulk-edit"==b){a("table.widefat #bulk-edit").removeClass("inline-editor").hide();a("#bulk-titles").html("");a("#inlineedit").append(a("#bulk-edit"))}else{a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}}return false},getId:function(c){var d=c.tagName=="TR"?c.id:a(c).parents("tr").attr("id"),b=d.split("-");return b[b.length-1]}};a(document).ready(function(){inlineEditPost.init()})})(jQuery); -
trunk/wp-admin/js/inline-edit-tax.js
r10258 r10291 1 2 (function($) { 3 inlineEditTax = { 4 5 init : function() { 6 var t = this, row = $('#inline-edit'); 7 8 t.type = $('#the-list').attr('className').substr(5); 9 t.what = '#'+t.type+'-'; 10 11 // get all editable rows 12 t.rows = $('tr.iedit'); 13 14 // prepare the edit row 15 row.keyup(function(e) { if(e.which == 27) return inlineEditTax.revert(); }); 16 17 $('a.cancel', row).click(function() { return inlineEditTax.revert(); }); 18 $('a.save', row).click(function() { return inlineEditTax.save(this); }); 19 $('input, select', row).keydown(function(e) { if(e.which == 13) return inlineEditTax.save(this); }); 20 21 // add events 22 t.addEvents(t.rows); 23 24 $('#posts-filter input[type="submit"]').click(function(e){ 25 if ( $('form#posts-filter tr.inline-editor').length > 0 ) 26 t.revert(); 27 }); 28 }, 29 30 toggle : function(el) { 31 var t = this; 32 33 $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el); 34 }, 35 36 addEvents : function(r) { 37 r.each(function() { 38 $(this).find('a.editinline').click(function() { inlineEditTax.edit(this); return false; }); 39 }); 40 }, 41 42 edit : function(id) { 43 var t = this; 44 t.revert(); 45 46 if ( typeof(id) == 'object' ) 47 id = t.getId(id); 48 49 var editRow = $('#inline-edit').clone(true), rowData = $('#inline_'+id); 50 $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length); 51 52 if ( $(t.what+id).hasClass('alternate') ) 53 $(editRow).addClass('alternate'); 54 55 $(t.what+id).hide().after(editRow); 56 57 $(':input[name="name"]', editRow).val( $('.name', rowData).text() ); 58 $(':input[name="slug"]', editRow).val( $('.slug', rowData).text() ); 59 60 // cat parents 61 var cat_parent = $('.cat_parent', rowData).text(); 62 if ( cat_parent != '0' ) 63 $('select[name="parent"]', editRow).val(cat_parent); 64 65 // remove the current parent and children from the parent dropdown 66 var pageOpt = $('select[name="parent"] option[value="'+id+'"]', editRow); 67 if ( pageOpt.length > 0 ) { 68 var pageLevel = pageOpt[0].className.split('-')[1], nextPage = pageOpt, pageLoop = true; 69 while ( pageLoop ) { 70 var nextPage = nextPage.next('option'); 71 if (nextPage.length == 0) break; 72 var nextLevel = nextPage[0].className.split('-')[1]; 73 if ( nextLevel <= pageLevel ) { 74 pageLoop = false; 75 } else { 76 nextPage.remove(); 77 nextPage = pageOpt; 78 } 79 } 80 pageOpt.remove(); 81 } 82 83 $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show(); 84 $('.ptitle', editRow).eq(0).focus(); 85 86 return false; 87 }, 88 89 save : function(id) { 90 if( typeof(id) == 'object' ) 91 id = this.getId(id); 92 93 $('table.widefat .inline-edit-save .waiting').show(); 94 95 var params = { 96 action: 'inline-save-tax', 97 tax_type: this.type, 98 tax_ID: id 99 }; 100 101 var fields = $('#edit-'+id+' :input').fieldSerialize(); 102 params = fields + '&' + $.param(params); 103 104 // make ajax request 105 $.post('admin-ajax.php', params, 106 function(r) { 107 108 $('table.widefat .inline-edit-save .waiting').hide(); 109 110 if (r) { 111 if ( -1 != r.indexOf('<tr') ) { 112 $(inlineEditTax.what+id).remove(); 113 $('#edit-'+id).before(r).remove(); 114 115 var row = $(inlineEditTax.what+id); 116 row.hide(); 117 118 inlineEditTax.addEvents(row); 119 row.fadeIn(); 120 } else 121 $('#edit-'+id+' .inline-edit-save .error').html(r).show(); 122 } else 123 $('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show(); 124 } 125 ); 126 return false; 127 }, 128 129 revert : function() { 130 var id = $('table.widefat tr.inline-editor').attr('id'); 131 132 if ( id ) { 133 $('table.widefat .inline-edit-save .waiting').hide(); 134 $('#'+id).remove(); 135 id = id.substr( id.lastIndexOf('-') + 1 ); 136 $(this.what+id).show(); 137 } 138 139 return false; 140 }, 141 142 getId : function(o) { 143 var id = o.tagName == 'TR' ? o.id : $(o).parents('tr').attr('id'); 144 var parts = id.split('-'); 145 return parts[parts.length - 1]; 146 } 147 }; 148 149 $(document).ready(function(){inlineEditTax.init();}); 150 })(jQuery); 1 (function(a){inlineEditTax={init:function(){var b=this,c=a("#inline-edit");b.type=a("#the-list").attr("className").substr(5);b.what="#"+b.type+"-";b.rows=a("tr.iedit");c.keyup(function(d){if(d.which==27){return inlineEditTax.revert()}});a("a.cancel",c).click(function(){return inlineEditTax.revert()});a("a.save",c).click(function(){return inlineEditTax.save(this)});a("input, select",c).keydown(function(d){if(d.which==13){return inlineEditTax.save(this)}});b.addEvents(b.rows);a('#posts-filter input[type="submit"]').click(function(d){if(a("form#posts-filter tr.inline-editor").length>0){b.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},addEvents:function(b){b.each(function(){a(this).find("a.editinline").click(function(){inlineEditTax.edit(this);return false})})},edit:function(b){var i=this,d,e,f;i.revert();if(typeof(b)=="object"){b=i.getId(b)}d=a("#inline-edit").clone(true),rowData=a("#inline_"+b);a("td",d).attr("colspan",a(".widefat:first thead th:visible").length);if(a(i.what+b).hasClass("alternate")){a(d).addClass("alternate")}a(i.what+b).hide().after(d);a(':input[name="name"]',d).val(a(".name",rowData).text());a(':input[name="slug"]',d).val(a(".slug",rowData).text());e=a(".cat_parent",rowData).text();if(e!="0"){a('select[name="parent"]',d).val(e)}f=a('select[name="parent"] option[value="'+b+'"]',d);if(f.length>0){var h=f[0].className.split("-")[1],g,c=true,j;while(c){g=g.next("option");if(g.length==0){break}j=g[0].className.split("-")[1];if(j<=h){c=false}else{g.remove();g=f}}f.remove()}a(d).attr("id","edit-"+b).addClass("inline-editor").show();a(".ptitle",d).eq(0).focus();return false},save:function(d){var c,b;if(typeof(d)=="object"){d=this.getId(d)}a("table.widefat .inline-edit-save .waiting").show();c={action:"inline-save-tax",tax_type:this.type,tax_ID:d};b=a("#edit-"+d+" :input").fieldSerialize();c=b+"&"+a.param(c);a.post("admin-ajax.php",c,function(e){a("table.widefat .inline-edit-save .waiting").hide();if(e){if(-1!=e.indexOf("<tr")){a(inlineEditTax.what+d).remove();a("#edit-"+d).before(e).remove();var f=a(inlineEditTax.what+d);f.hide();inlineEditTax.addEvents(f);f.fadeIn()}else{a("#edit-"+d+" .inline-edit-save .error").html(e).show()}}else{a("#edit-"+d+" .inline-edit-save .error").html(inlineEditL10n.error).show()}});return false},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");if(b){a("table.widefat .inline-edit-save .waiting").hide();a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}return false},getId:function(c){var d=c.tagName=="TR"?c.id:a(c).parents("tr").attr("id"),b=d.split("-");return b[b.length-1]}};a(document).ready(function(){inlineEditTax.init()})})(jQuery); -
trunk/wp-admin/js/link.js
r10259 r10291 1 jQuery(document).ready( function($) { 2 3 jQuery('#link_name').focus(); 4 // postboxes 5 postboxes.add_postbox_toggles('link'); 6 7 // category tabs 8 var categoryTabs = jQuery('#category-tabs').tabs(); 9 10 // Ajax Cat 11 var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } ); 12 jQuery('#category-add-submit').click( function() { newCat.focus(); } ); 13 var noSyncChecks = false; // prophylactic. necessary? 14 var syncChecks = function() { 15 if ( noSyncChecks ) 16 return; 17 noSyncChecks = true; 18 var th = jQuery(this); 19 var c = th.is(':checked'); 20 var id = th.val().toString(); 21 jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c ); 22 noSyncChecks = false; 23 }; 24 var catAddAfter = function( r, s ) { 25 jQuery(s.what + ' response_data', r).each( function() { 26 var t = jQuery(jQuery(this).text()); 27 t.find( 'label' ).each( function() { 28 var th = jQuery(this); 29 var val = th.find('input').val(); 30 var id = th.find('input')[0].id 31 jQuery('#' + id).change( syncChecks ); 32 var name = jQuery.trim( th.text() ); 33 var o = jQuery( '<option value="' + parseInt( val, 10 ) + '"></option>' ).text( name ); 34 } ); 35 } ); 36 }; 37 jQuery('#categorychecklist').wpList( { 38 alt: '', 39 what: 'link-category', 40 response: 'category-ajax-response', 41 addAfter: catAddAfter 42 } ); 43 44 $('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');}); 45 $('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');}); 46 if ( 'pop' == getUserSetting('cats') ) 47 $('a[href="#categories-pop"]').click(); 48 49 jQuery('#category-add-toggle').click( function() { 50 jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' ); 51 categoryTabs.tabsClick( 1 ); 52 return false; 53 } ); 54 jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change(); 55 }); 1 jQuery(document).ready(function(c){var e,b,a=false,d,f;c("#link_name").focus();postboxes.add_postbox_toggles("link");e=c("#category-tabs").tabs();b=c("#newcat").one("focus",function(){c(this).val("").removeClass("form-input-tip")});c("#category-add-submit").click(function(){b.focus()});d=function(){if(a){return}a=true;var g=c(this),i=g.is(":checked"),h=g.val().toString();c("#in-category-"+h+", #in-popular-category-"+h).attr("checked",i);a=false};f=function(h,g){c(g.what+" response_data",h).each(function(){var i=c(c(this).text());i.find("label").each(function(){var k=c(this),m=k.find("input").val(),n=k.find("input")[0].id,j=c.trim(k.text()),l;c("#"+n).change(d);l=c('<option value="'+parseInt(m,10)+'"></option>').text(j)})})};c("#categorychecklist").wpList({alt:"",what:"link-category",response:"category-ajax-response",addAfter:f});c('a[href="#categories-all"]').click(function(){deleteUserSetting("cats")});c('a[href="#categories-pop"]').click(function(){setUserSetting("cats","pop")});if("pop"==getUserSetting("cats")){c('a[href="#categories-pop"]').click()}c("#category-add-toggle").click(function(){c(this).parents("div:first").toggleClass("wp-hidden-children");e.tabsClick(1);return false});c(".categorychecklist :checkbox").change(d).filter(":checked").change()}); -
trunk/wp-admin/js/media-upload.js
r9894 r10291 1 // send html to the post editor 2 function send_to_editor(h) { 3 if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) { 4 ed.focus(); 5 if (tinymce.isIE) 6 ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark); 7 8 if ( h.indexOf('[caption') === 0 ) { 9 if ( ed.plugins.wpeditimage ) 10 h = ed.plugins.wpeditimage._do_shcode(h); 11 } else if ( h.indexOf('[gallery') === 0 ) { 12 if ( ed.plugins.wpgallery ) 13 h = ed.plugins.wpgallery._do_gallery(h); 14 } 15 16 ed.execCommand('mceInsertContent', false, h); 17 18 } else if ( typeof edInsertContent == 'function' ) { 19 edInsertContent(edCanvas, h); 20 } else { 21 jQuery( edCanvas ).val( jQuery( edCanvas ).val() + h ); 22 } 23 24 tb_remove(); 25 } 26 27 // thickbox settings 28 jQuery(function($) { 29 tb_position = function() { 30 var tbWindow = $('#TB_window'); 31 var width = $(window).width(); 32 var H = $(window).height(); 33 var W = ( 720 < width ) ? 720 : width; 34 35 if ( tbWindow.size() ) { 36 tbWindow.width( W - 50 ).height( H - 45 ); 37 $('#TB_iframeContent').width( W - 50 ).height( H - 75 ); 38 tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'}); 39 if ( typeof document.body.style.maxWidth != 'undefined' ) 40 tbWindow.css({'top':'20px','margin-top':'0'}); 41 $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'}); 42 }; 43 44 return $('a.thickbox').each( function() { 45 var href = $(this).attr('href'); 46 if ( ! href ) return; 47 href = href.replace(/&width=[0-9]+/g, ''); 48 href = href.replace(/&height=[0-9]+/g, ''); 49 $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) ); 50 }); 51 }; 52 53 jQuery('a.thickbox').click(function(){ 54 if ( typeof tinyMCE != 'undefined' && tinyMCE.activeEditor ) { 55 tinyMCE.get('content').focus(); 56 tinyMCE.activeEditor.windowManager.bookmark = tinyMCE.activeEditor.selection.getBookmark('simple'); 57 } 58 }); 59 60 $(window).resize( function() { tb_position() } ); 61 }); 62 1 function send_to_editor(b){var a;if(typeof tinyMCE!="undefined"&&(a=tinyMCE.activeEditor)&&!a.isHidden()){a.focus();if(tinymce.isIE){a.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark)}if(b.indexOf("[caption")===0){if(a.plugins.wpeditimage){b=a.plugins.wpeditimage._do_shcode(b)}}else{if(b.indexOf("[gallery")===0){if(a.plugins.wpgallery){b=a.plugins.wpgallery._do_gallery(b)}}}a.execCommand("mceInsertContent",false,b)}else{if(typeof edInsertContent=="function"){edInsertContent(edCanvas,b)}else{jQuery(edCanvas).val(jQuery(edCanvas).val()+b)}}tb_remove()}jQuery(document).ready(function(a){tb_position=function(){var e=a("#TB_window"),d=a(window).width(),c=a(window).height(),b=(720<d)?720:d;if(e.size()){e.width(b-50).height(c-45);a("#TB_iframeContent").width(b-50).height(c-75);e.css({"margin-left":"-"+parseInt(((b-50)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){e.css({top:"20px","margin-top":"0"})}a("#TB_title").css({"background-color":"#222",color:"#cfcfcf"})}return a("a.thickbox").each(function(){var f=a(this).attr("href");if(!f){return}f=f.replace(/&width=[0-9]+/g,"");f=f.replace(/&height=[0-9]+/g,"");a(this).attr("href",f+"&width="+(b-80)+"&height="+(c-85))})};a("a.thickbox").click(function(){if(typeof tinyMCE!="undefined"&&tinyMCE.activeEditor){tinyMCE.get("content").focus();tinyMCE.activeEditor.windowManager.bookmark=tinyMCE.activeEditor.selection.getBookmark("simple")}});a(window).resize(function(){tb_position()})}); -
trunk/wp-admin/js/page.js
r10258 r10291 1 jQuery(document).ready( function($) { 2 postboxes.add_postbox_toggles('page'); 3 make_slugedit_clickable(); 4 5 jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } ); 6 7 var stamp = $('#timestamp').html(); 8 9 var visibility = $('#post-visibility-display').html(); 10 11 function updateVisibility() { 12 if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) { 13 $('#sticky').attr('checked', false); 14 $('#sticky-span').hide(); 15 } else { 16 $('#sticky-span').show(); 17 } 18 if ( $('#post-visibility-select input:radio:checked').val() != 'password' ) { 19 $('#password-span').hide(); 20 } else { 21 $('#password-span').show(); 22 } 23 } 24 25 function updateText() { 26 var attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val()); 27 var originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_mn').val()); 28 var currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val()); 29 if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) { 30 var publishOn = postL10n.publishOnFuture; 31 $('#publish').val( postL10n.schedule ); 32 } else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) { 33 var publishOn = postL10n.publishOn; 34 $('#publish').val( postL10n.publish ); 35 } else { 36 var publishOn = postL10n.publishOnPast; 37 $('#publish').val( postL10n.update ); 38 } 39 if ( originalDate.toUTCString() == attemptedDate.toUTCString() ) { //hack 40 $('#timestamp').html(stamp); 41 } else { 42 $('#timestamp').html( 43 publishOn + ' <b>' + 44 $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' + 45 $('#jj').val() + ', ' + 46 $('#aa').val() + ' @ ' + 47 $('#hh').val() + ':' + 48 $('#mn').val() + '</b> ' 49 ); 50 } 51 52 if ( $('#post-visibility-select input:radio:checked').val() == 'private' ) { 53 $('#publish').val( postL10n.update ); 54 if ( $('#post_status option[value=publish]').length == 0 ) { 55 $('#post_status').append('<option value="publish">' + postL10n.privatelyPublished + '</option>'); 56 } 57 $('#post_status option[value=publish]').html( postL10n.privatelyPublished ); 58 $('#post_status option[value=publish]').attr('selected', true); 59 $('.edit-post-status').hide(); 60 } else { 61 if ( $('#original_post_status').val() == 'future' || $('#original_post_status').val() == 'draft' ) { 62 if ( $('#post_status option[value=publish]').length != 0 ) { 63 $('#post_status option[value=publish]').remove(); 64 $('#post_status').val($('#hidden_post_status').val()); 65 } 66 } else { 67 $('#post_status option[value=publish]').html( postL10n.published ); 68 } 69 $('.edit-post-status').show(); 70 } 71 $('#post-status-display').html($('#post_status :selected').text()); 72 if ( $('#post_status :selected').val() == 'private' || $('#post_status :selected').val() == 'publish' ) { 73 $('#save-post').hide(); 74 } else { 75 $('#save-post').show(); 76 if ( $('#post_status :selected').val() == 'pending' ) { 77 $('#save-post').show().val( postL10n.savePending ); 78 } else { 79 $('#save-post').show().val( postL10n.saveDraft ); 80 } 81 } 82 } 83 84 $('.edit-visibility').click(function () { 85 if ($('#post-visibility-select').is(":hidden")) { 86 updateVisibility(); 87 $('#post-visibility-select').slideDown("normal"); 88 $('.edit-visibility').hide(); 89 } 90 return false; 91 }); 92 93 $('.cancel-post-visibility').click(function () { 94 $('#post-visibility-select').slideUp("normal"); 95 $('#visibility-radio-' + $('#hidden-post-visibility').val()).attr('checked', true); 96 $('#post_password').val($('#hidden_post_password').val()); 97 $('#post-visibility-display').html(visibility); 98 $('.edit-visibility').show(); 99 updateText(); 100 return false; 101 }); 102 103 $('.save-post-visibility').click(function () { // crazyhorse - multiple ok cancels 104 $('#post-visibility-select').slideUp("normal"); 105 $('.edit-visibility').show(); 106 updateText(); 107 108 $('#post-visibility-display').html( 109 postL10n[$('#post-visibility-select input:radio:checked').val()] 110 ); 111 112 return false; 113 }); 114 115 $('#post-visibility-select input:radio').change(function() { 116 updateVisibility(); 117 }); 118 119 $('.edit-timestamp').click(function () { 120 if ($('#timestampdiv').is(":hidden")) { 121 $('#timestampdiv').slideDown("normal"); 122 $('.edit-timestamp').hide(); 123 } 124 125 return false; 126 }); 127 128 $('.cancel-timestamp').click(function() { 129 $('#timestampdiv').slideUp("normal"); 130 $('#mm').val($('#hidden_mm').val()); 131 $('#jj').val($('#hidden_jj').val()); 132 $('#aa').val($('#hidden_aa').val()); 133 $('#hh').val($('#hidden_hh').val()); 134 $('#mn').val($('#hidden_mn').val()); 135 $('.edit-timestamp').show(); 136 137 updateText(); 138 return false; 139 }); 140 141 $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels 142 $('#timestampdiv').slideUp("normal"); 143 $('.edit-timestamp').show(); 144 updateText(); 145 146 return false; 147 }); 148 149 $('.edit-post-status').click(function() { 150 if ($('#post-status-select').is(":hidden")) { 151 $('#post-status-select').slideDown("normal"); 152 $(this).hide(); 153 } 154 155 return false; 156 }); 157 158 $('.save-post-status').click(function() { 159 $('#post-status-select').slideUp("normal"); 160 $('.edit-post-status').show(); 161 updateText(); 162 return false; 163 }); 164 165 $('.cancel-post-status').click(function() { 166 $('#post-status-select').slideUp("normal"); 167 $('#post_status').val($('#hidden_post_status').val()); 168 $('.edit-post-status').show(); 169 170 updateText(); 171 return false; 172 }); 173 174 // Custom Fields 175 jQuery('#the-list').wpList( { addAfter: function( xml, s ) { 176 $('table#list-table').show(); 177 if ( jQuery.isFunction( autosave_update_post_ID ) ) { 178 autosave_update_post_ID(s.parsed.responses[0].supplemental.postid); 179 } 180 }, addBefore: function( s ) { 181 s.data += '&post_id=' + jQuery('#post_ID').val(); 182 return s; 183 } 184 }); 185 186 // preview 187 $('#post-preview').click(function(e){ 188 if ( 1 > $('#post_ID').val() && autosaveFirst ) { 189 autosaveDelayPreview = true; 190 autosave(); 191 return false; 192 } 193 194 $('input#wp-preview').val('dopreview'); 195 $('form#post').attr('target', 'wp-preview').submit().attr('target', ''); 196 $('input#wp-preview').val(''); 197 return false; 198 }); 199 }); 1 jQuery(document).ready(function(e){postboxes.add_postbox_toggles("page");make_slugedit_clickable();jQuery("#title").blur(function(){if((jQuery("#post_ID").val()>0)||(jQuery("#title").val().length==0)){return}autosave()});var b=e("#timestamp").html(),a=e("#post-visibility-display").html();function d(){if(e("#post-visibility-select input:radio:checked").val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("#post-visibility-select input:radio:checked").val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var f,h,g,i;f=new Date(e("#aa").val(),e("#mm").val()-1,e("#jj").val(),e("#hh").val(),e("#mn").val());h=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());g=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(f>g&&e("#original_post_status").val()!="future"){i=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(f<=g&&e("#original_post_status").val()!="publish"){i=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{i=postL10n.publishOnPast;e("#publish").val(postL10n.update)}}if(h.toUTCString()==f.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(i+" <b>"+e("#mm option[value="+e("#mm").val()+"]").text()+" "+e("#jj").val()+", "+e("#aa").val()+" @ "+e("#hh").val()+":"+e("#mn").val()+"</b> ")}if(e("#post-visibility-select input:radio:checked").val()=="private"){e("#publish").val(postL10n.update);if(e("#post_status option[value=publish]").length==0){e("#post_status").append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}e("#post_status option[value=publish]").html(postL10n.privatelyPublished);e("#post_status option[value=publish]").attr("selected",true);e(".edit-post-status").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(e("#post_status option[value=publish]").length!=0){e("#post_status option[value=publish]").remove();e("#post_status").val(e("#hidden_post_status").val())}}else{e("#post_status option[value=publish]").html(postL10n.published)}e(".edit-post-status").show()}e("#post-status-display").html(e("#post_status :selected").text());if(e("#post_status :selected").val()=="private"||e("#post_status :selected").val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("#post_status :selected").val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}}e(".edit-visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(".edit-visibility").hide()}return false});e(".cancel-post-visibility").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#post-visibility-display").html(a);e(".edit-visibility").show();c();return false});e(".save-post-visibility").click(function(){e("#post-visibility-select").slideUp("normal");e(".edit-visibility").show();c();e("#post-visibility-display").html(postL10n[e("#post-visibility-select input:radio:checked").val()]);return false});e("#post-visibility-select input:radio").change(function(){d()});e(".edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(".edit-timestamp").hide()}return false});e(".cancel-timestamp").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e(".edit-timestamp").show();c();return false});e(".save-timestamp").click(function(){e("#timestampdiv").slideUp("normal");e(".edit-timestamp").show();c();return false});e(".edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status").click(function(){e("#post-status-select").slideUp("normal");e(".edit-post-status").show();c();return false});e(".cancel-post-status").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e(".edit-post-status").show();c();return false});jQuery("#the-list").wpList({addAfter:function(f,g){e("table#list-table").show();if(jQuery.isFunction(autosave_update_post_ID)){autosave_update_post_ID(g.parsed.responses[0].supplemental.postid)}},addBefore:function(f){f.data+="&post_id="+jQuery("#post_ID").val();return f}});e("#post-preview").click(function(f){if(1>e("#post_ID").val()&&autosaveFirst){autosaveDelayPreview=true;autosave();return false}e("input#wp-preview").val("dopreview");e("form#post").attr("target","wp-preview").submit().attr("target","");e("input#wp-preview").val("");return false})}); -
trunk/wp-admin/js/password-strength-meter.js
r10150 r10291 1 // Password strength meter 2 3 function passwordStrength(password,username) { 4 var shortPass = 1, badPass = 2, goodPass = 3, strongPass = 4; 5 6 //password < 4 7 if (password.length < 4 ) { return shortPass }; 8 9 //password == username 10 if (password.toLowerCase()==username.toLowerCase()) return badPass; 11 12 var symbolSize = 0; 13 if (password.match(/[0-9]/)) symbolSize +=10; 14 if (password.match(/[a-z]/)) symbolSize +=26; 15 if (password.match(/[A-Z]/)) symbolSize +=26; 16 if (password.match(/[^a-zA-Z0-9]/)) symbolSize +=31; 17 18 var natLog = Math.log( Math.pow(symbolSize,password.length) ); 19 var score = natLog / Math.LN2; 20 if (score < 40 ) return badPass 21 if (score < 56 ) return goodPass 22 return strongPass; 23 } 1 function passwordStrength(i,f){var h=1,e=2,b=3,a=4,d=0,g,c;if(i.length<4){return h}if(i.toLowerCase()==f.toLowerCase()){return e}if(i.match(/[0-9]/)){d+=10}if(i.match(/[a-z]/)){d+=26}if(i.match(/[A-Z]/)){d+=26}if(i.match(/[^a-zA-Z0-9]/)){d+=31}g=Math.log(Math.pow(d,i.length));c=g/Math.LN2;if(c<40){return e}if(c<56){return b}return a}; -
trunk/wp-admin/js/plugin-install.js
r9141 r10291 1 /* Plugin Browser Thickbox related JS*/ 2 jQuery(function($) { 3 var thickDims = function() { 4 var tbWindow = $('#TB_window'); 5 var width = $(window).width(); 6 var H = $(window).height(); 7 var W = ( 720 < width ) ? 720 : width; 8 9 if ( tbWindow.size() ) { 10 tbWindow.width( W - 50 ).height( H - 45 ); 11 $('#TB_iframeContent').width( W - 50 ).height( H - 75 ); 12 tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'}); 13 if ( ! ( $.browser.msie && $.browser.version.substr(0,1) < 7 ) ) 14 tbWindow.css({'top':'20px','margin-top':'0'}); 15 }; 16 17 return $('a.thickbox').each( function() { 18 var href = $(this).attr('href'); 19 if ( ! href ) 20 return; 21 href = href.replace(/&width=[0-9]+/g, ''); 22 href = href.replace(/&height=[0-9]+/g, ''); 23 $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) ); 24 }); 25 }; 26 27 thickDims().click( function() { 28 $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'}); 29 $('#TB_ajaxWindowTitle').html('<strong>' + plugininstallL10n.plugin_information + '</strong> ' + $(this).attr('title') ); 30 return false; 31 }); 32 33 $(window).resize( function() { tb_position() } ); 34 }); 35 36 /* Plugin install related JS*/ 37 jQuery(function($) { 38 $('#install-plugins tbody.plugins tr').click( function() { 39 $(this).find('.action-links a.onclick').click(); 40 return false; 41 }); 42 43 $('#plugin-information #sidemenu a').click( function() { 44 var tab = $(this).attr('name'); 45 //Flip the tab 46 $('#plugin-information-header a.current').removeClass('current'); 47 $(this).addClass('current'); 48 //Flip the content. 49 $('#section-holder div.section').hide(); //Hide 'em all 50 $('#section-' + tab).show(); 51 return false; 52 }); 53 }); 1 jQuery(document).ready(function(b){var a=function(){var f=b("#TB_window"),e=b(window).width(),d=b(window).height(),c=(720<e)?720:e;if(f.size()){f.width(c-50).height(d-45);b("#TB_iframeContent").width(c-50).height(d-75);f.css({"margin-left":"-"+parseInt(((c-50)/2),10)+"px"});if(!(b.browser.msie&&b.browser.version.substr(0,1)<7)){f.css({top:"20px","margin-top":"0"})}}return b("a.thickbox").each(function(){var g=b(this).attr("href");if(!g){return}g=g.replace(/&width=[0-9]+/g,"");g=g.replace(/&height=[0-9]+/g,"");b(this).attr("href",g+"&width="+(c-80)+"&height="+(d-85))})};a().click(function(){b("#TB_title").css({"background-color":"#222",color:"#cfcfcf"});b("#TB_ajaxWindowTitle").html("<strong>"+plugininstallL10n.plugin_information+"</strong> "+b(this).attr("title"));return false});b(window).resize(function(){tb_position()});b("#install-plugins tbody.plugins tr").click(function(){b(this).find(".action-links a.onclick").click();return false});b("#plugin-information #sidemenu a").click(function(){var c=b(this).attr("name");b("#plugin-information-header a.current").removeClass("current");b(this).addClass("current");b("#section-holder div.section").hide();b("#section-"+c).show();return false})}); -
trunk/wp-admin/js/post.js
r10258 r10291 1 // this file contains all the scripts used in the post/edit page 2 3 // return an array with any duplicate, whitespace or values removed 4 function array_unique_noempty(a) { 5 var out = []; 6 jQuery.each( a, function(key, val) { 7 val = jQuery.trim(val); 8 if ( val && jQuery.inArray(val, out) == -1 ) 9 out.push(val); 10 } ); 11 return out; 12 } 13 14 function new_tag_remove_tag() { 15 var id = jQuery( this ).attr( 'id' ); 16 var num = id.split('-check-num-')[1]; 17 var taxbox = jQuery(this).parents('.tagsdiv'); 18 var current_tags = taxbox.find( '.the-tags' ).val().split(','); 19 delete current_tags[num]; 20 var new_tags = []; 21 22 jQuery.each( current_tags, function(key, val) { 23 val = jQuery.trim(val); 24 if ( val ) { 25 new_tags.push(val); 26 } 27 }); 28 29 taxbox.find('.the-tags').val( new_tags.join(',').replace(/\s*,+\s*/, ',').replace(/,+/, ',').replace(/,+\s+,+/, ',').replace(/,+\s*$/, '').replace(/^\s*,+/, '') ); 30 31 tag_update_quickclicks(taxbox); 32 return false; 33 } 34 35 function tag_update_quickclicks(taxbox) { 36 if ( jQuery(taxbox).find('.the-tags').length == 0 ) 37 return; 38 39 var current_tags = jQuery(taxbox).find('.the-tags').val().split(','); 40 jQuery(taxbox).find('.tagchecklist').empty(); 41 shown = false; 42 43 jQuery.each( current_tags, function( key, val ) { 44 val = jQuery.trim(val); 45 if ( !val.match(/^\s+$/) && '' != val ) { 46 var button_id = jQuery(taxbox).attr('id') + '-check-num-' + key; 47 txt = '<span><a id="' + button_id + '" class="ntdelbutton">X</a> ' + val + '</span> '; 48 jQuery(taxbox).find('.tagchecklist').append(txt); 49 jQuery( '#' + button_id ).click( new_tag_remove_tag ); 50 } 51 }); 52 if ( shown ) 53 jQuery(taxbox).find('.tagchecklist').prepend('<strong>'+postL10n.tagsUsed+'</strong><br />'); 54 } 55 56 function tag_flush_to_text(id, a) { 57 a = a || false; 58 var taxbox = jQuery('#'+id); 59 var text = a ? jQuery(a).text() : taxbox.find('input.newtag').val(); 60 61 // is the input box empty (i.e. showing the 'Add new tag' tip)? 62 if ( taxbox.find('input.newtag').hasClass('form-input-tip') && ! a ) 63 return false; 64 65 var tags = taxbox.find('.the-tags').val(); 66 var newtags = tags ? tags + ',' + text : text; 67 68 // massage 69 newtags = newtags.replace(/\s+,+\s*/g, ',').replace(/,+/g, ',').replace(/,+\s+,+/g, ',').replace(/,+\s*$/g, '').replace(/^\s*,+/g, ''); 70 newtags = array_unique_noempty(newtags.split(',')).join(','); 71 taxbox.find('.the-tags').val(newtags); 72 tag_update_quickclicks(taxbox); 73 74 if ( ! a ) 75 taxbox.find('input.newtag').val('').focus(); 76 77 return false; 78 } 79 80 function tag_save_on_publish() { 81 jQuery('.tagsdiv').each( function(i) { 82 if ( !jQuery(this).find('input.newtag').hasClass('form-input-tip') ) 83 tag_flush_to_text(jQuery(this).parents('.tagsdiv').attr('id')); 84 } ); 85 } 86 87 function tag_press_key( e ) { 88 if ( 13 == e.which ) { 89 tag_flush_to_text(jQuery(e.target).parents('.tagsdiv').attr('id')); 90 return false; 91 } 92 }; 93 94 function tag_init() { 95 96 jQuery('.ajaxtag').show(); 97 jQuery('.tagsdiv').each( function(i) { 98 tag_update_quickclicks(this); 99 } ); 100 101 // add the quickadd form 102 jQuery('.ajaxtag input.tagadd').click(function(){tag_flush_to_text(jQuery(this).parents('.tagsdiv').attr('id'));}); 103 jQuery('.ajaxtag input.newtag').focus(function() { 104 if ( !this.cleared ) { 105 this.cleared = true; 106 jQuery(this).val( '' ).removeClass( 'form-input-tip' ); 107 } 108 }); 109 110 jQuery('.ajaxtag input.newtag').blur(function() { 111 if ( this.value == '' ) { 112 this.cleared = false; 113 jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' ); 114 } 115 }); 116 117 // auto-save tags on post save/publish 118 jQuery('#publish').click( tag_save_on_publish ); 119 jQuery('#save-post').click( tag_save_on_publish ); 120 121 // catch the enter key 122 jQuery('.ajaxtag input.newtag').keypress( tag_press_key ); 123 } 124 125 (function($){ 126 tagCloud = { 127 init : function() { 128 $('.tagcloud-link').click(function(){tagCloud.get($(this).attr('id')); $(this).unbind().click(function(){return false;}); return false;}); 129 }, 130 131 get : function(id) { 132 tax = id.substr(id.indexOf('-')+1); 133 134 $.post('admin-ajax.php', {'action':'get-tagcloud','tax':tax}, function(r, stat) { 135 if ( 0 == r || 'success' != stat ) 136 r = wpAjax.broken; 137 138 r = $('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+'</p>'); 139 $('a', r).click(function(){ 140 var id = $(this).parents('p').attr('id'); 141 tag_flush_to_text(id.substr(id.indexOf('-')+1), this); 142 return false; 143 }); 144 145 $('#'+id).after(r); 146 }); 147 } 148 } 149 })(jQuery); 150 151 jQuery(document).ready( function($) { 152 tagCloud.init(); 153 154 // postboxes 155 postboxes.add_postbox_toggles('post'); 156 157 // Editable slugs 158 make_slugedit_clickable(); 159 160 // prepare the tag UI 161 tag_init(); 162 163 jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } ); 164 165 // auto-suggest stuff 166 jQuery('.newtag').each(function(){ 167 var tax = $(this).parents('div.tagsdiv').attr('id'); 168 $(this).suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+tax, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } ); 169 }); 170 171 // category tabs 172 var categoryTabs =jQuery('#category-tabs').tabs(); 173 174 // Ajax Cat 175 var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } ); 176 jQuery('#category-add-sumbit').click( function() { newCat.focus(); } ); 177 var newCatParent = false; 178 var newCatParentOption = false; 179 var noSyncChecks = false; // prophylactic. necessary? 180 var syncChecks = function() { 181 if ( noSyncChecks ) 182 return; 183 noSyncChecks = true; 184 var th = jQuery(this); 185 var c = th.is(':checked'); 186 var id = th.val().toString(); 187 jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c ); 188 noSyncChecks = false; 189 }; 190 var popularCats = jQuery('#categorychecklist-pop :checkbox').map( function() { return parseInt(jQuery(this).val(), 10); } ).get().join(','); 191 var catAddBefore = function( s ) { 192 s.data += '&popular_ids=' + popularCats + '&' + jQuery( '#categorychecklist :checked' ).serialize(); 193 return s; 194 }; 195 var catAddAfter = function( r, s ) { 196 if ( !newCatParent ) newCatParent = jQuery('#newcat_parent'); 197 if ( !newCatParentOption ) newCatParentOption = newCatParent.find( 'option[value=-1]' ); 198 jQuery(s.what + ' response_data', r).each( function() { 199 var t = jQuery(jQuery(this).text()); 200 t.find( 'label' ).each( function() { 201 var th = jQuery(this); 202 var val = th.find('input').val(); 203 var id = th.find('input')[0].id 204 jQuery('#' + id).change( syncChecks ).change(); 205 if ( newCatParent.find( 'option[value=' + val + ']' ).size() ) 206 return; 207 var name = jQuery.trim( th.text() ); 208 var o = jQuery( '<option value="' + parseInt( val, 10 ) + '"></option>' ).text( name ); 209 newCatParent.prepend( o ); 210 } ); 211 newCatParentOption.attr( 'selected', true ); 212 } ); 213 }; 214 jQuery('#categorychecklist').wpList( { 215 alt: '', 216 response: 'category-ajax-response', 217 addBefore: catAddBefore, 218 addAfter: catAddAfter 219 } ); 220 jQuery('#category-add-toggle').click( function() { 221 jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' ); 222 // categoryTabs.tabs( 'select', '#categories-all' ); // this is broken (in the UI beta?) 223 categoryTabs.find( 'a[href="#categories-all"]' ).click(); 224 jQuery('#newcat').focus(); 225 return false; 226 } ); 227 228 $('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');}); 229 $('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');}); 230 if ( 'pop' == getUserSetting('cats') ) 231 $('a[href="#categories-pop"]').click(); 232 233 jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change(); 234 var stamp = $('#timestamp').html(); 235 var visibility = $('#post-visibility-display').html(); 236 var sticky = ''; 237 238 function updateVisibility() { 239 if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) { 240 $('#sticky').attr('checked', false); 241 $('#sticky-span').hide(); 242 } else { 243 $('#sticky-span').show(); 244 } 245 if ( $('#post-visibility-select input:radio:checked').val() != 'password' ) { 246 $('#password-span').hide(); 247 } else { 248 $('#password-span').show(); 249 } 250 } 251 252 function updateText() { 253 var attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val()); 254 var originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_mn').val()); 255 var currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val()); 256 if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) { 257 var publishOn = postL10n.publishOnFuture; 258 $('#publish').val( postL10n.schedule ); 259 } else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) { 260 var publishOn = postL10n.publishOn; 261 $('#publish').val( postL10n.publish ); 262 } else { 263 var publishOn = postL10n.publishOnPast; 264 $('#publish').val( postL10n.update ); 265 } 266 if ( originalDate.toUTCString() == attemptedDate.toUTCString() ) { //hack 267 $('#timestamp').html(stamp); 268 } else { 269 $('#timestamp').html( 270 publishOn + ' <b>' + 271 $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' + 272 $('#jj').val() + ', ' + 273 $('#aa').val() + ' @ ' + 274 $('#hh').val() + ':' + 275 $('#mn').val() + '</b> ' 276 ); 277 } 278 279 if ( $('#post-visibility-select input:radio:checked').val() == 'private' ) { 280 $('#publish').val( postL10n.update ); 281 if ( $('#post_status option[value=publish]').length == 0 ) { 282 $('#post_status').append('<option value="publish">' + postL10n.privatelyPublished + '</option>'); 283 } 284 $('#post_status option[value=publish]').html( postL10n.privatelyPublished ); 285 $('#post_status option[value=publish]').attr('selected', true); 286 $('.edit-post-status').hide(); 287 } else { 288 if ( $('#original_post_status').val() == 'future' || $('#original_post_status').val() == 'draft' ) { 289 if ( $('#post_status option[value=publish]').length != 0 ) { 290 $('#post_status option[value=publish]').remove(); 291 $('#post_status').val($('#hidden_post_status').val()); 292 } 293 } else { 294 $('#post_status option[value=publish]').html( postL10n.published ); 295 } 296 $('.edit-post-status').show(); 297 } 298 $('#post-status-display').html($('#post_status :selected').text()); 299 if ( $('#post_status :selected').val() == 'private' || $('#post_status :selected').val() == 'publish' ) { 300 $('#save-post').hide(); 301 } else { 302 $('#save-post').show(); 303 if ( $('#post_status :selected').val() == 'pending' ) { 304 $('#save-post').show().val( postL10n.savePending ); 305 } else { 306 $('#save-post').show().val( postL10n.saveDraft ); 307 } 308 } 309 } 310 311 $('.edit-visibility').click(function () { 312 if ($('#post-visibility-select').is(":hidden")) { 313 updateVisibility(); 314 $('#post-visibility-select').slideDown("normal"); 315 $('.edit-visibility').hide(); 316 } 317 return false; 318 }); 319 320 $('.cancel-post-visibility').click(function () { 321 $('#post-visibility-select').slideUp("normal"); 322 $('#visibility-radio-' + $('#hidden-post-visibility').val()).attr('checked', true); 323 $('#post_password').val($('#hidden_post_password').val()); 324 $('#sticky').attr('checked', $('#hidden-post-sticky').attr('checked')); 325 $('#post-visibility-display').html(visibility); 326 $('.edit-visibility').show(); 327 updateText(); 328 return false; 329 }); 330 331 $('.save-post-visibility').click(function () { // crazyhorse - multiple ok cancels 332 $('#post-visibility-select').slideUp("normal"); 333 $('.edit-visibility').show(); 334 updateText(); 335 if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) { 336 $('#sticky').attr('checked', false); 337 } 338 339 if ( true == $('#sticky').attr('checked') ) { 340 sticky = 'Sticky'; 341 } else { 342 sticky = ''; 343 } 344 345 $('#post-visibility-display').html( 346 postL10n[$('#post-visibility-select input:radio:checked').val() + sticky] 347 ); 348 349 return false; 350 }); 351 352 $('#post-visibility-select input:radio').change(function() { 353 updateVisibility(); 354 }); 355 356 $('.edit-timestamp').click(function () { 357 if ($('#timestampdiv').is(":hidden")) { 358 $('#timestampdiv').slideDown("normal"); 359 $('.edit-timestamp').hide(); 360 } 361 362 return false; 363 }); 364 365 $('.cancel-timestamp').click(function() { 366 $('#timestampdiv').slideUp("normal"); 367 $('#mm').val($('#hidden_mm').val()); 368 $('#jj').val($('#hidden_jj').val()); 369 $('#aa').val($('#hidden_aa').val()); 370 $('#hh').val($('#hidden_hh').val()); 371 $('#mn').val($('#hidden_mn').val()); 372 $('.edit-timestamp').show(); 373 updateText(); 374 return false; 375 }); 376 377 $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels 378 $('#timestampdiv').slideUp("normal"); 379 $('.edit-timestamp').show(); 380 updateText(); 381 382 return false; 383 }); 384 385 $('.edit-post-status').click(function() { 386 if ($('#post-status-select').is(":hidden")) { 387 $('#post-status-select').slideDown("normal"); 388 $(this).hide(); 389 } 390 391 return false; 392 }); 393 394 $('.save-post-status').click(function() { 395 $('#post-status-select').slideUp("normal"); 396 $('.edit-post-status').show(); 397 updateText(); 398 return false; 399 }); 400 401 $('.cancel-post-status').click(function() { 402 $('#post-status-select').slideUp("normal"); 403 $('#post_status').val($('#hidden_post_status').val()); 404 $('.edit-post-status').show(); 405 updateText(); 406 return false; 407 }); 408 409 // Custom Fields 410 jQuery('#the-list').wpList( { addAfter: function( xml, s ) { 411 $('table#list-table').show(); 412 if ( jQuery.isFunction( autosave_update_post_ID ) ) { 413 autosave_update_post_ID(s.parsed.responses[0].supplemental.postid); 414 } 415 }, addBefore: function( s ) { 416 s.data += '&post_id=' + jQuery('#post_ID').val(); 417 return s; 418 } 419 }); 420 421 // preview 422 $('#post-preview').click(function(e){ 423 if ( 1 > $('#post_ID').val() && autosaveFirst ) { 424 autosaveDelayPreview = true; 425 autosave(); 426 return false; 427 } 428 429 $('input#wp-preview').val('dopreview'); 430 $('form#post').attr('target', 'wp-preview').submit().attr('target', ''); 431 $('input#wp-preview').val(''); 432 return false; 433 }); 434 435 }); 436 437 (function($){ 438 commentsBox = { 439 st : 0, 440 441 get : function(total, num) { 442 var st = this.st; 443 if ( ! num ) 444 num = 20; 445 446 this.st += num; 447 this.total = total; 448 $('.waiting').show(); 449 450 var data = { 451 'action' : 'get-comments', 452 'mode' : 'single', 453 '_ajax_nonce' : $('#add_comment_nonce').val(), 454 'post_ID' : $('#post_ID').val(), 455 'start' : st, 456 'num' : num 457 }; 458 459 $.post('admin-ajax.php', data, 460 function(r) { 461 var r = wpAjax.parseAjaxResponse(r); 462 $('#commentstatusdiv .widefat').show(); 463 $('.waiting').hide(); 464 465 if ( 'object' == typeof r && r.responses[0] ) { 466 $('#the-comment-list').append( r.responses[0].data ); 467 468 theList = theExtraList = null; 469 $("a[className*=':']").unbind(); 470 setCommentsList(); 471 472 if ( commentsBox.st > commentsBox.total ) 473 $('#show-comments').hide(); 474 else 475 $('#show-comments').html(postL10n.showcomm); 476 return; 477 } else if ( 1 == r ) { 478 $('#show-comments').parent().html(postL10n.endcomm); 479 return; 480 } 481 482 $('#the-comment-list').append('<tr><td colspan="5">'+wpAjax.broken+'</td></tr>'); 483 } 484 ); 485 486 return false; 487 } 488 }; 489 490 })(jQuery); 491 1 function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}function new_tag_remove_tag(){var e=jQuery(this).attr("id"),a=e.split("-check-num-")[1],c=jQuery(this).parents(".tagsdiv"),b=c.find(".the-tags").val().split(","),d=[];delete b[a];jQuery.each(b,function(f,g){g=jQuery.trim(g);if(g){d.push(g)}});c.find(".the-tags").val(d.join(",").replace(/\s*,+\s*/,",").replace(/,+/,",").replace(/,+\s+,+/,",").replace(/,+\s*$/,"").replace(/^\s*,+/,""));tag_update_quickclicks(c);return false}function tag_update_quickclicks(b){if(jQuery(b).find(".the-tags").length==0){return}var a=jQuery(b).find(".the-tags").val().split(",");jQuery(b).find(".tagchecklist").empty();shown=false;jQuery.each(a,function(e,f){var c;f=jQuery.trim(f);if(!f.match(/^\s+$/)&&""!=f){var d=jQuery(b).attr("id")+"-check-num-"+e;c='<span><a id="'+d+'" class="ntdelbutton">X</a> '+f+"</span> ";jQuery(b).find(".tagchecklist").append(c);jQuery("#"+d).click(new_tag_remove_tag)}});if(shown){jQuery(b).find(".tagchecklist").prepend("<strong>"+postL10n.tagsUsed+"</strong><br />")}}function tag_flush_to_text(g,b){b=b||false;var e,f,c,d;e=jQuery("#"+g);f=b?jQuery(b).text():e.find("input.newtag").val();if(e.find("input.newtag").hasClass("form-input-tip")&&!b){return false}c=e.find(".the-tags").val();d=c?c+","+f:f;d=d.replace(/\s+,+\s*/g,",").replace(/,+/g,",").replace(/,+\s+,+/g,",").replace(/,+\s*$/g,"").replace(/^\s*,+/g,"");d=array_unique_noempty(d.split(",")).join(",");e.find(".the-tags").val(d);tag_update_quickclicks(e);if(!b){e.find("input.newtag").val("").focus()}return false}function tag_save_on_publish(){jQuery(".tagsdiv").each(function(a){if(!jQuery(this).find("input.newtag").hasClass("form-input-tip")){tag_flush_to_text(jQuery(this).parents(".tagsdiv").attr("id"))}})}function tag_press_key(a){if(13==a.which){tag_flush_to_text(jQuery(a.target).parents(".tagsdiv").attr("id"));return false}}function tag_init(){jQuery(".ajaxtag").show();jQuery(".tagsdiv").each(function(a){tag_update_quickclicks(this)});jQuery(".ajaxtag input.tagadd").click(function(){tag_flush_to_text(jQuery(this).parents(".tagsdiv").attr("id"))});jQuery(".ajaxtag input.newtag").focus(function(){if(!this.cleared){this.cleared=true;jQuery(this).val("").removeClass("form-input-tip")}});jQuery(".ajaxtag input.newtag").blur(function(){if(this.value==""){this.cleared=false;jQuery(this).val(postL10n.addTag).addClass("form-input-tip")}});jQuery("#publish").click(tag_save_on_publish);jQuery("#save-post").click(tag_save_on_publish);jQuery(".ajaxtag input.newtag").keypress(tag_press_key)}(function(a){tagCloud={init:function(){a(".tagcloud-link").click(function(){tagCloud.get(a(this).attr("id"));a(this).unbind().click(function(){return false});return false})},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post("admin-ajax.php",{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){var f=a(this).parents("p").attr("id");tag_flush_to_text(f.substr(f.indexOf("-")+1),this);return false});a("#"+c).after(e)})}}})(jQuery);jQuery(document).ready(function(f){var j,g,c=false,h=false,b=false,i,d;tagCloud.init();postboxes.add_postbox_toggles("post");make_slugedit_clickable();tag_init();f("#title").blur(function(){if((f("#post_ID").val()>0)||(f("#title").val().length==0)){return}autosave()});f(".newtag").each(function(){var k=f(this).parents("div.tagsdiv").attr("id");f(this).suggest("admin-ajax.php?action=ajax-tag-search&tax="+k,{delay:500,minchars:2,multiple:true,multipleSep:", "})});j=jQuery("#category-tabs").tabs();g=f("#newcat").one("focus",function(){f(this).val("").removeClass("form-input-tip")});f("#category-add-sumbit").click(function(){g.focus()});i=function(){if(b){return}b=true;var k=jQuery(this),m=k.is(":checked"),l=k.val().toString();f("#in-category-"+l+", #in-popular-category-"+l).attr("checked",m);b=false};popularCats=f("#categorychecklist-pop :checkbox").map(function(){return parseInt(jQuery(this).val(),10)}).get().join(",");catAddBefore=function(k){k.data+="&popular_ids="+popularCats+"&"+jQuery("#categorychecklist :checked").serialize();return k};d=function(l,k){if(!c){c=jQuery("#newcat_parent")}if(!h){h=c.find("option[value=-1]")}f(k.what+" response_data",l).each(function(){var m=f(f(this).text());m.find("label").each(function(){var p=f(this),r=p.find("input").val(),s=p.find("input")[0].id,n,q;f("#"+s).change(i).change();if(c.find("option[value="+r+"]").size()){return}n=f.trim(p.text());q=f('<option value="'+parseInt(r,10)+'"></option>').text(n);c.prepend(q)});h.attr("selected",true)})};f("#categorychecklist").wpList({alt:"",response:"category-ajax-response",addBefore:catAddBefore,addAfter:d});f("#category-add-toggle").click(function(){f(this).parents("div:first").toggleClass("wp-hidden-children");j.find('a[href="#categories-all"]').click();f("#newcat").focus();return false});f('a[href="#categories-all"]').click(function(){deleteUserSetting("cats")});f('a[href="#categories-pop"]').click(function(){setUserSetting("cats","pop")});if("pop"==getUserSetting("cats")){f('a[href="#categories-pop"]').click()}f(".categorychecklist .popular-category :checkbox").change(i).filter(":checked").change(),sticky="";function e(){if(f("#post-visibility-select input:radio:checked").val()!="public"){f("#sticky").attr("checked",false);f("#sticky-span").hide()}else{f("#sticky-span").show()}if(f("#post-visibility-select input:radio:checked").val()!="password"){f("#password-span").hide()}else{f("#password-span").show()}}function a(){var k,m,l,n;k=new Date(f("#aa").val(),f("#mm").val()-1,f("#jj").val(),f("#hh").val(),f("#mn").val());m=new Date(f("#hidden_aa").val(),f("#hidden_mm").val()-1,f("#hidden_jj").val(),f("#hidden_hh").val(),f("#hidden_mn").val());l=new Date(f("#cur_aa").val(),f("#cur_mm").val()-1,f("#cur_jj").val(),f("#cur_hh").val(),f("#cur_mn").val());if(k>l&&f("#original_post_status").val()!="future"){n=postL10n.publishOnFuture;f("#publish").val(postL10n.schedule)}else{if(k<=l&&f("#original_post_status").val()!="publish"){n=postL10n.publishOn;f("#publish").val(postL10n.publish)}else{n=postL10n.publishOnPast;f("#publish").val(postL10n.update)}}if(m.toUTCString()==k.toUTCString()){f("#timestamp").html(stamp)}else{f("#timestamp").html(n+" <b>"+f("#mm option[value="+f("#mm").val()+"]").text()+" "+f("#jj").val()+", "+f("#aa").val()+" @ "+f("#hh").val()+":"+f("#mn").val()+"</b> ")}if(f("#post-visibility-select input:radio:checked").val()=="private"){f("#publish").val(postL10n.update);if(f("#post_status option[value=publish]").length==0){f("#post_status").append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}f("#post_status option[value=publish]").html(postL10n.privatelyPublished);f("#post_status option[value=publish]").attr("selected",true);f(".edit-post-status").hide()}else{if(f("#original_post_status").val()=="future"||f("#original_post_status").val()=="draft"){if(f("#post_status option[value=publish]").length!=0){f("#post_status option[value=publish]").remove();f("#post_status").val(f("#hidden_post_status").val())}}else{f("#post_status option[value=publish]").html(postL10n.published)}f(".edit-post-status").show()}f("#post-status-display").html(f("#post_status :selected").text());if(f("#post_status :selected").val()=="private"||f("#post_status :selected").val()=="publish"){f("#save-post").hide()}else{f("#save-post").show();if(f("#post_status :selected").val()=="pending"){f("#save-post").show().val(postL10n.savePending)}else{f("#save-post").show().val(postL10n.saveDraft)}}}f(".edit-visibility").click(function(){if(f("#post-visibility-select").is(":hidden")){e();f("#post-visibility-select").slideDown("normal");f(".edit-visibility").hide()}return false});f(".cancel-post-visibility").click(function(){f("#post-visibility-select").slideUp("normal");f("#visibility-radio-"+f("#hidden-post-visibility").val()).attr("checked",true);f("#post_password").val(f("#hidden_post_password").val());f("#sticky").attr("checked",f("#hidden-post-sticky").attr("checked"));f("#post-visibility-display").html(visibility);f(".edit-visibility").show();a();return false});f(".save-post-visibility").click(function(){f("#post-visibility-select").slideUp("normal");f(".edit-visibility").show();a();if(f("#post-visibility-select input:radio:checked").val()!="public"){f("#sticky").attr("checked",false)}if(true==f("#sticky").attr("checked")){sticky="Sticky"}else{sticky=""}f("#post-visibility-display").html(postL10n[f("#post-visibility-select input:radio:checked").val()+sticky]);return false});f("#post-visibility-select input:radio").change(function(){e()});f(".edit-timestamp").click(function(){if(f("#timestampdiv").is(":hidden")){f("#timestampdiv").slideDown("normal");f(".edit-timestamp").hide()}return false});f(".cancel-timestamp").click(function(){f("#timestampdiv").slideUp("normal");f("#mm").val(f("#hidden_mm").val());f("#jj").val(f("#hidden_jj").val());f("#aa").val(f("#hidden_aa").val());f("#hh").val(f("#hidden_hh").val());f("#mn").val(f("#hidden_mn").val());f(".edit-timestamp").show();a();return false});f(".save-timestamp").click(function(){f("#timestampdiv").slideUp("normal");f(".edit-timestamp").show();a();return false});f(".edit-post-status").click(function(){if(f("#post-status-select").is(":hidden")){f("#post-status-select").slideDown("normal");f(this).hide()}return false});f(".save-post-status").click(function(){f("#post-status-select").slideUp("normal");f(".edit-post-status").show();a();return false});f(".cancel-post-status").click(function(){f("#post-status-select").slideUp("normal");f("#post_status").val(f("#hidden_post_status").val());f(".edit-post-status").show();a();return false});jQuery("#the-list").wpList({addAfter:function(k,l){f("table#list-table").show();if(jQuery.isFunction(autosave_update_post_ID)){autosave_update_post_ID(l.parsed.responses[0].supplemental.postid)}},addBefore:function(k){k.data+="&post_id="+jQuery("#post_ID").val();return k}});f("#post-preview").click(function(k){if(1>f("#post_ID").val()&&autosaveFirst){autosaveDelayPreview=true;autosave();return false}f("input#wp-preview").val("dopreview");f("form#post").attr("target","wp-preview").submit().attr("target","");f("input#wp-preview").val("");return false})});(function(a){commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a(".waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post("admin-ajax.php",e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentstatusdiv .widefat").show();a(".waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="5">'+wpAjax.broken+"</td></tr>")});return false}}})(jQuery); -
trunk/wp-admin/js/postbox.js
r10019 r10291 1 (function($) { 2 postboxes = { 3 add_postbox_toggles : function(page,args) { 4 $('.postbox h3, .postbox .handlediv').click( function() { 5 $($(this).parent().get(0)).toggleClass('closed'); 6 postboxes.save_state(page); 7 } ); 8 $('.postbox h3 a').click( function(e) { 9 e.stopPropagation(); 10 } ); 11 12 $('.hide-postbox-tog').click( function() { 13 var box = jQuery(this).val(); 14 if ( jQuery(this).attr('checked') ) { 15 jQuery('#' + box).show(); 16 if ( $.isFunction( postboxes.pbshow ) ) 17 postboxes.pbshow( box ); 18 19 } else { 20 jQuery('#' + box).hide(); 21 if ( $.isFunction( postboxes.pbhide ) ) 22 postboxes.pbhide( box ); 23 24 } 25 postboxes.save_state(page); 26 } ); 27 28 this.expandSidebar(); 29 this.init(page,args); 30 }, 31 32 expandSidebar : function(doIt) { 33 if ( doIt || $('#side-sortables > .postbox:visible').length ) { 34 if ( ! $('#post-body').hasClass('has-sidebar') ) { 35 $('#post-body').addClass('has-sidebar'); 36 var h = Math.min( $('#post-body').height(), 300 ); 37 $('#side-sortables').css({'minHeight':h+'px','height':'auto'}); 38 } 39 } else { 40 $('#post-body').removeClass('has-sidebar'); 41 $('#side-sortables').css({'minHeight':'0'}); 42 if ( $.browser.msie && $.browser.version.charAt(0) == 7 ) 43 $('#side-sortables').css({'height':'0'}); 44 } 45 }, 46 47 init : function(page, args) { 48 $.extend( this, args || {} ); 49 $('#wpbody-content').css('overflow','hidden'); 50 $('.meta-box-sortables').sortable( { 51 placeholder: 'sortable-placeholder', 52 connectWith: [ '.meta-box-sortables' ], 53 items: '> .postbox', 54 handle: '.hndle', 55 distance: 2, 56 tolerance: 'pointer', 57 toleranceMove: 'tolerance', 58 sort: function(e,ui) { 59 if ( $(document).width() - e.clientX < 300 ) { 60 if ( ! $('#post-body').hasClass('has-sidebar') ) { 61 var pos = $('#side-sortables').offset(); 62 63 $('#side-sortables').append(ui.item) 64 $(ui.placeholder).css({'top':pos.top,'left':pos.left}).width($(ui.item).width()) 65 postboxes.expandSidebar(1); 66 } 67 } 68 }, 69 stop: function() { 70 var postVars = { 71 action: 'meta-box-order', 72 _ajax_nonce: $('#meta-box-order-nonce').val(), 73 page: page 74 } 75 $('.meta-box-sortables').each( function() { 76 postVars["order[" + this.id.split('-')[0] + "]"] = $(this).sortable( 'toArray' ).join(','); 77 } ); 78 $.post( postboxL10n.requestFile, postVars, function() { 79 postboxes.expandSidebar(); 80 } ); 81 } 82 } ); 83 }, 84 85 save_state : function(page) { 86 var closed = $('.postbox').filter('.closed').map(function() { return this.id; }).get().join(','); 87 var hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(','); 88 $.post(postboxL10n.requestFile, { 89 action: 'closed-postboxes', 90 closed: closed, 91 hidden: hidden, 92 closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(), 93 page: page 94 }); 95 postboxes.expandSidebar(); 96 }, 97 98 /* Callbacks */ 99 pbshow : false, 100 101 pbhide : false 102 }; 103 104 }(jQuery)); 1 (function(a){postboxes={add_postbox_toggles:function(c,b){a(".postbox h3, .postbox .handlediv").click(function(){a(a(this).parent().get(0)).toggleClass("closed");postboxes.save_state(c)});a(".postbox h3 a").click(function(d){d.stopPropagation()});a(".hide-postbox-tog").click(function(){var d=jQuery(this).val();if(jQuery(this).attr("checked")){jQuery("#"+d).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(d)}}else{jQuery("#"+d).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(d)}}postboxes.save_state(c)});this.expandSidebar();this.init(c,b)},expandSidebar:function(b){if(b||a("#side-sortables > .postbox:visible").length){if(!a("#post-body").hasClass("has-sidebar")){a("#post-body").addClass("has-sidebar");var c=Math.min(a("#post-body").height(),300);a("#side-sortables").css({minHeight:c+"px",height:"auto"})}}else{a("#post-body").removeClass("has-sidebar");a("#side-sortables").css({minHeight:"0"});if(a.browser.msie&&a.browser.version.charAt(0)==7){a("#side-sortables").css({height:"0"})}}},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:[".meta-box-sortables"],items:"> .postbox",handle:".hndle",distance:2,tolerance:"pointer",toleranceMove:"tolerance",sort:function(f,d){if(a(document).width()-f.clientX<300){if(!a("#post-body").hasClass("has-sidebar")){var g=a("#side-sortables").offset();a("#side-sortables").append(d.item);a(d.placeholder).css({top:g.top,left:g.left}).width(a(d.item).width());postboxes.expandSidebar(1)}}},stop:function(){var d={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page:c};a(".meta-box-sortables").each(function(){d["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(postboxL10n.requestFile,d,function(){postboxes.expandSidebar()})}})},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(postboxL10n.requestFile,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d});postboxes.expandSidebar()},pbshow:false,pbhide:false}}(jQuery)); -
trunk/wp-admin/js/slug.js
r9606 r10291 1 function edit_permalink(post_id) { 2 var i, c = 0; 3 var e = jQuery('#editable-post-name'); 4 var revert_e = e.html(); 5 var real_slug = jQuery('#post_name'); 6 var revert_slug = real_slug.html(); 7 var b = jQuery('#edit-slug-buttons'); 8 var revert_b = b.html(); 9 var full = jQuery('#editable-post-name-full').html(); 10 11 b.html('<a href="" class="save button">'+slugL10n.save+'</a> <a class="cancel" href="">'+slugL10n.cancel+'</a>'); 12 b.children('.save').click(function() { 13 var new_slug = e.children('input').val(); 14 jQuery.post(slugL10n.requestFile, { 15 action: 'sample-permalink', 16 post_id: post_id, 17 new_slug: new_slug, 18 new_title: jQuery('#title').val(), 19 samplepermalinknonce: jQuery('#samplepermalinknonce').val()}, function(data) { 20 jQuery('#edit-slug-box').html(data); 21 b.html(revert_b); 22 real_slug.attr('value', new_slug); 23 make_slugedit_clickable(); 24 }); 25 return false; 26 }); 27 jQuery('#edit-slug-buttons .cancel').click(function() { 28 e.html(revert_e); 29 b.html(revert_b); 30 real_slug.attr('value', revert_slug); 31 return false; 32 }); 33 for(i=0; i < full.length; ++i) { 34 if ('%' == full.charAt(i)) c++; 35 } 36 slug_value = (c > full.length/4)? '' : full; 37 e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e){ 38 var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0; 39 // on enter, just save the new slug, don't save the post 40 if (13 == key) {b.children('.save').click();return false;} 41 if (27 == key) {b.children('.cancel').click();return false;} 42 real_slug.attr('value', this.value)}).focus(); 43 } 44 45 function make_slugedit_clickable() { 46 jQuery('#editable-post-name').click(function() {jQuery('#edit-slug-buttons').children('.edit-slug').click()}); 47 } 48 1 function edit_permalink(a){var d,h=0,g=jQuery("#editable-post-name"),j=g.html(),m=jQuery("#post_name"),n=m.html(),k=jQuery("#edit-slug-buttons"),l=k.html(),f=jQuery("#editable-post-name-full").html();k.html('<a href="" class="save button">'+slugL10n.save+'</a> <a class="cancel" href="">'+slugL10n.cancel+"</a>");k.children(".save").click(function(){var b=g.children("input").val();jQuery.post(slugL10n.requestFile,{action:"sample-permalink",post_id:a,new_slug:b,new_title:jQuery("#title").val(),samplepermalinknonce:jQuery("#samplepermalinknonce").val()},function(c){jQuery("#edit-slug-box").html(c);k.html(l);m.attr("value",b);make_slugedit_clickable()});return false});jQuery("#edit-slug-buttons .cancel").click(function(){g.html(j);k.html(l);m.attr("value",n);return false});for(d=0;d<f.length;++d){if("%"==f.charAt(d)){h++}}slug_value=(h>f.length/4)?"":f;g.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(c){var b=c.charCode?c.charCode:c.keyCode?c.keyCode:0;if(13==b){k.children(".save").click();return false}if(27==b){k.children(".cancel").click();return false}m.attr("value",this.value)}).focus()}function make_slugedit_clickable(){jQuery("#editable-post-name").click(function(){jQuery("#edit-slug-buttons").children(".edit-slug").click()})}; -
trunk/wp-admin/js/tags.js
r9735 r10291 1 jQuery(function($) { 2 var options = false 3 4 var addAfter = function( r, settings ) { 5 var name = $("<span>" + $('name', r).text() + "</span>").html(); 6 var id = $('tag', r).attr('id'); 7 options[options.length] = new Option(name, id); 8 9 } 10 11 var addAfter2 = function( x, r ) { 12 var t = $(r.parsed.responses[0].data); 13 if ( t.length == 1 ) 14 inlineEditTax.addEvents($(t.id)); 15 } 16 17 var delAfter = function( r, settings ) { 18 var id = $('tag', r).attr('id'); 19 for ( var o = 0; o < options.length; o++ ) 20 if ( id == options[o].value ) 21 options[o] = null; 22 } 23 24 if ( options ) 25 $('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } ); 26 else 27 $('#the-list').wpList({ addAfter: addAfter2 }); 28 29 columns.init('edit-tags'); 30 }); 1 jQuery(document).ready(function(c){var b=false,e,d,a;e=function(h,g){var f=c("<span>"+c("name",h).text()+"</span>").html(),i=c("tag",h).attr("id");b[b.length]=new Option(f,i)};d=function(f,h){var g=c(h.parsed.responses[0].data);if(g.length==1){inlineEditTax.addEvents(c(g.id))}};a=function(g,f){var i=c("tag",g).attr("id"),h;for(h=0;h<b.length;h++){if(i==b[h].value){b[h]=null}}};if(b){c("#the-list").wpList({addAfter:e,delAfter:a})}else{c("#the-list").wpList({addAfter:d})}columns.init("edit-tags")}); -
trunk/wp-admin/js/theme-preview.js
r10054 r10291 1 2 jQuery(function($) { 3 if ( 'undefined' == typeof $.fn.pngFix ) 4 $.fn.pngFix = function() { return this; } 5 6 var thickDims = function() { 7 var tbWindow = $('#TB_window'); 8 var H = $(window).height(); 9 var W = $(window).width(); 10 11 if ( tbWindow.size() ) { 12 tbWindow.width( W - 90 ).height( H - 60 ); 13 $('#TB_iframeContent').width( W - 90 ).height( H - 90 ); 14 tbWindow.css({'margin-left': '-' + parseInt((( W - 90 ) / 2),10) + 'px'}); 15 if ( typeof document.body.style.maxWidth != 'undefined' ) 16 tbWindow.css({'top':'30px','margin-top':'0'}); 17 }; 18 19 return $('a.thickbox').each( function() { 20 var href = $(this).parents('.available-theme').find('.previewlink').attr('href'); 21 if ( ! href ) return; 22 href = href.replace(/&width=[0-9]+/g, ''); 23 href = href.replace(/&height=[0-9]+/g, ''); 24 $(this).attr( 'href', href + '&width=' + ( W - 110 ) + '&height=' + ( H - 100 ) ); 25 }); 26 }; 27 28 thickDims() 29 .click( function() { 30 var alink = $(this).parents('.available-theme').find('.activatelink'); 31 var url = alink.attr('href'); 32 var text = alink.html(); 33 34 $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'}); 35 $('#TB_closeAjaxWindow').css({'float':'left'}); 36 $('#TB_ajaxWindowTitle').css({'float':'right'}) 37 .append(' <a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>'); 38 39 $('#TB_iframeContent').width('100%'); 40 return false; 41 } ); 42 43 $(window).resize( function() { thickDims() } ); 44 }); 1 jQuery(document).ready(function(b){if("undefined"==typeof b.fn.pngFix){b.fn.pngFix=function(){return this}}var a=function(){var e=b("#TB_window"),d=b(window).height(),c=b(window).width();if(e.size()){e.width(c-90).height(d-60);b("#TB_iframeContent").width(c-90).height(d-90);e.css({"margin-left":"-"+parseInt(((c-90)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){e.css({top:"30px","margin-top":"0"})}}return b("a.thickbox").each(function(){var f=b(this).parents(".available-theme").find(".previewlink").attr("href");if(!f){return}f=f.replace(/&width=[0-9]+/g,"");f=f.replace(/&height=[0-9]+/g,"");b(this).attr("href",f+"&width="+(c-110)+"&height="+(d-100))})};a().click(function(){var d=b(this).parents(".available-theme").find(".activatelink"),c=d.attr("href"),e=d.html();b("#TB_title").css({"background-color":"#222",color:"#cfcfcf"});b("#TB_closeAjaxWindow").css({"float":"left"});b("#TB_ajaxWindowTitle").css({"float":"right"}).append(' <a href="'+c+'" target="_top" class="tb-theme-preview-link">'+e+"</a>");b("#TB_iframeContent").width("100%");return false});b(window).resize(function(){a()})}); -
trunk/wp-admin/js/widgets.js
r9822 r10291 1 jQuery(function($) { 2 $('.noscript-action').remove(); 3 4 var reminded = false; 5 var lameWidgetReminder = function() { 6 if ( reminded ) 7 return; 8 window.onbeforeunload = function () { return widgetsL10n.lamerReminder }; 9 $('h2:first').after( '<div class="updated"><p>' + widgetsL10n.lameReminder + '</p></div>' ); 10 $('#current-widgets .submit input[name=save-widgets]').css( 'background-color', '#ffffe0' ).click( function() { 11 window.onbeforeunload = null; 12 } ); 13 reminded = true; 14 }; 15 16 var increment = 1; 17 18 // Open or close widget control form 19 var toggleWidget = function( li, disableFields ) { 20 var width = li.find('input.widget-width').val(); 21 22 // it seems IE chokes on these animations because of the positioning/floating 23 var widgetAnim = $.browser.msie ? function() { 24 var t = $(this); 25 if ( t.is(':visible') ) { 26 if ( disableFields ) { t.find( ':input:enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); } 27 li.css( 'marginLeft', 0 ); 28 t.siblings('div').children('h4').children('a').text( widgetsL10n.edit ); 29 } else { 30 t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open 31 if ( width > 250 ) 32 li.css( 'marginLeft', ( width - 250 ) * -1 ); 33 t.siblings('div').children('h4').children('a').text( widgetsL10n.cancel ); 34 } 35 t.toggle(); 36 } : function() { 37 var t = $(this); 38 39 if ( t.is(':visible') ) { 40 if ( disableFields ) { t.find( ':input:enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); } 41 if ( width > 250 ) 42 li.animate( { marginLeft: 0 } ); 43 t.siblings('div').children('h4').children('a').text( widgetsL10n.edit ); 44 } else { 45 t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open 46 if ( width > 250 ) 47 li.animate( { marginLeft: ( width - 250 ) * -1 } ); 48 t.siblings('div').children('h4').children('a').text( widgetsL10n.cancel ); 49 } 50 t.animate( { height: 'toggle' } ); 51 }; 52 53 return li.children('div.widget-control').each( widgetAnim ).end(); 54 }; 55 56 // onclick for edit/cancel links 57 var editClick = function() { 58 var q = wpAjax.unserialize( this.href ); 59 // if link is in available widgets list, make sure it points to the current sidebar 60 if ( ( q.sidebar && q.sidebar == $('#sidebar').val() ) || q.add ) { 61 var w = q.edit || q.add; 62 toggleWidget( $('#current-sidebar .widget-control-list input[@name^="widget-id"][@value=' + w + ']').parents('li:first'), false ).blur(); 63 return false; 64 } else if ( q.sidebar ) { // otherwise, redirect to correct page 65 return true; 66 } 67 68 // If link is in current widgets list, just open the form 69 toggleWidget( $(this).parents('li:first'), true ).blur(); 70 return false; 71 }; 72 73 // onclick for add links 74 var addClick = function() { 75 var oldLi = $(this).parents('li:first').find('ul.widget-control-info li'); 76 var newLi = oldLi.clone(); 77 78 if ( newLi.html().match( /%i%/ ) ) { 79 // supplid form is a template, replace %i% by unique id 80 var i = $('#generated-time').val() + increment.toString(); 81 increment++; 82 newLi.html( newLi.html().replace( /%i%/g, i ) ); 83 } else { 84 $(this).text( widgetsL10n.edit ).unbind().click( editClick ); 85 // save form content in textarea so we don't have any conflicting HTML ids 86 oldLi.html( '<textarea>' + oldLi.html() + '</textarea>' ); 87 } 88 89 // add event handlers 90 addWidgetControls( newLi ); 91 92 // add widget to sidebar sortable 93 widgetSortable.append( newLi ).SortableAddItem( newLi[0] ); 94 95 // increment widget counter 96 var n = parseInt( $('#widget-count').text(), 10 ) + 1; 97 $('#widget-count').text( n.toString() ) 98 99 lameWidgetReminder(); 100 return false; 101 }; 102 103 // add event handlers to all links found in context 104 var addWidgetControls = function( context ) { 105 if ( !context ) 106 context = document; 107 108 $('a.widget-control-edit', context).click( editClick ); 109 110 // onclick for save links 111 $('a.widget-control-save', context).click( function() { 112 lameWidgetReminder(); 113 toggleWidget( $(this).parents('li:first'), false ).blur() 114 return false; 115 } ); 116 117 // onclick for remove links 118 $('a.widget-control-remove', context).click( function() { 119 var w = $(this).parents('li:first').find('input[@name^="widget-id"]').val(); 120 $(this).parents('li:first').remove(); 121 var t = $('#widget-list ul#widget-control-info-' + w + ' textarea'); 122 t.parent().html( t.text() ).parents('li.widget-list-item:first').children( 'h4' ).children('a.widget-action') 123 .show().text( widgetsL10n.add ).unbind().click( addClick ); 124 var n = parseInt( $('#widget-count').text(), 10 ) - 1; 125 $('#widget-count').text( n.toString() ) 126 return false; 127 } ); 128 } 129 130 addWidgetControls(); 131 132 $('a.widget-control-add').click( addClick ); 133 134 var widgetSortable; 135 var widgetSortableInit = function() { 136 try { // a hack to make sortables work in jQuery 1.2+ and IE7 137 $('#current-sidebar .widget-control-list').SortableDestroy(); 138 } catch(e) {} 139 widgetSortable = $('#current-sidebar .widget-control-list').Sortable( { 140 accept: 'widget-sortable', 141 helperclass: 'sorthelper', 142 handle: 'h4.widget-title', 143 onStop: widgetSortableInit 144 } ); 145 } 146 147 // initialize sortable 148 widgetSortableInit(); 149 150 }); 1 jQuery(function(e){e(".noscript-action").remove();var a=false;var h=function(){if(a){return}window.onbeforeunload=function(){return widgetsL10n.lamerReminder};e("h2:first").after('<div class="updated"><p>'+widgetsL10n.lameReminder+"</p></div>");e("#current-widgets .submit input[name=save-widgets]").css("background-color","#ffffe0").click(function(){window.onbeforeunload=null});a=true};var j=1;var g=function(k,m){var l=k.find("input.widget-width").val();var n=e.browser.msie?function(){var o=e(this);if(o.is(":visible")){if(m){o.find(":input:enabled").not('[name="widget-id[]"], [name*="[submit]"]').attr("disabled","disabled")}k.css("marginLeft",0);o.siblings("div").children("h4").children("a").text(widgetsL10n.edit)}else{o.find(":disabled").attr("disabled","");if(l>250){k.css("marginLeft",(l-250)*-1)}o.siblings("div").children("h4").children("a").text(widgetsL10n.cancel)}o.toggle()}:function(){var o=e(this);if(o.is(":visible")){if(m){o.find(":input:enabled").not('[name="widget-id[]"], [name*="[submit]"]').attr("disabled","disabled")}if(l>250){k.animate({marginLeft:0})}o.siblings("div").children("h4").children("a").text(widgetsL10n.edit)}else{o.find(":disabled").attr("disabled","");if(l>250){k.animate({marginLeft:(l-250)*-1})}o.siblings("div").children("h4").children("a").text(widgetsL10n.cancel)}o.animate({height:"toggle"})};return k.children("div.widget-control").each(n).end()};var b=function(){var l=wpAjax.unserialize(this.href);if((l.sidebar&&l.sidebar==e("#sidebar").val())||l.add){var k=l.edit||l.add;g(e('#current-sidebar .widget-control-list input[@name^="widget-id"][@value='+k+"]").parents("li:first"),false).blur();return false}else{if(l.sidebar){return true}}g(e(this).parents("li:first"),true).blur();return false};var c=function(){var o=e(this).parents("li:first").find("ul.widget-control-info li");var l=o.clone();if(l.html().match(/%i%/)){var k=e("#generated-time").val()+j.toString();j++;l.html(l.html().replace(/%i%/g,k))}else{e(this).text(widgetsL10n.edit).unbind().click(b);o.html("<textarea>"+o.html()+"</textarea>")}f(l);i.append(l).SortableAddItem(l[0]);var m=parseInt(e("#widget-count").text(),10)+1;e("#widget-count").text(m.toString());h();return false};var f=function(k){if(!k){k=document}e("a.widget-control-edit",k).click(b);e("a.widget-control-save",k).click(function(){h();g(e(this).parents("li:first"),false).blur();return false});e("a.widget-control-remove",k).click(function(){var l=e(this).parents("li:first").find('input[@name^="widget-id"]').val();e(this).parents("li:first").remove();var m=e("#widget-list ul#widget-control-info-"+l+" textarea");m.parent().html(m.text()).parents("li.widget-list-item:first").children("h4").children("a.widget-action").show().text(widgetsL10n.add).unbind().click(c);var o=parseInt(e("#widget-count").text(),10)-1;e("#widget-count").text(o.toString());return false})};f();e("a.widget-control-add").click(c);var i;var d=function(){try{e("#current-sidebar .widget-control-list").SortableDestroy()}catch(k){}i=e("#current-sidebar .widget-control-list").Sortable({accept:"widget-sortable",helperclass:"sorthelper",handle:"h4.widget-title",onStop:d})};d()}); -
trunk/wp-admin/js/word-count.js
r8600 r10291 1 // Word count 2 (function(JQ) { 3 wpWordCount = { 4 5 init : function() { 6 var t = this, last = 0, co = JQ('#content'); 7 8 JQ('#wp-word-count').html( wordCountL10n.count.replace( /%d/, '<span id="word-count">0</span>' ) ); 9 t.block = 0; 10 t.wc(co.val()); 11 co.keyup( function(e) { 12 if ( e.keyCode == last ) return true; 13 if ( 13 == e.keyCode || 8 == last || 46 == last ) t.wc(co.val()); 14 last = e.keyCode; 15 return true; 16 }); 17 }, 18 19 wc : function(tx) { 20 var t = this, w = JQ('#word-count'), tc = 0; 21 22 if ( t.block ) return; 23 t.block = 1; 24 25 setTimeout( function() { 26 if ( tx ) { 27 tx = tx.replace( /<.[^<>]*?>/g, ' ' ).replace( / /gi, ' ' ); 28 tx = tx.replace( /[0-9.(),;:!?%#$¿'"_+=\\/-]*/g, '' ); 29 tx.replace( /\S\s+/g, function(){tc++;} ); 30 } 31 w.html(tc.toString()); 32 33 setTimeout( function() { t.block = 0; }, 2000 ); 34 }, 1 ); 35 } 36 } 37 }(jQuery)); 38 39 jQuery(document).ready( function(){ wpWordCount.init(); } ); 1 (function(a){wpWordCount={init:function(){var b=this,c=0,d=a("#content");a("#wp-word-count").html(wordCountL10n.count.replace(/%d/,'<span id="word-count">0</span>'));b.block=0;b.wc(d.val());d.keyup(function(f){if(f.keyCode==c){return true}if(13==f.keyCode||8==c||46==c){b.wc(d.val())}c=f.keyCode;return true})},wc:function(d){var e=this,c=a("#word-count"),b=0;if(e.block){return}e.block=1;setTimeout(function(){if(d){d=d.replace(/<.[^<>]*?>/g," ").replace(/ /gi," ");d=d.replace(/[0-9.(),;:!?%#$¿'"_+=\\/-]*/g,"");d.replace(/\S\s+/g,function(){b++})}c.html(b.toString());setTimeout(function(){e.block=0},2000)},1)}};a(document).ready(function(){wpWordCount.init()})}(jQuery)); -
trunk/wp-admin/js/wp-gears.js
r10150 r10291 1 2 wpGears = { 3 4 createStore : function() { 5 if ( 'undefined' == typeof google || ! google.gears ) return; 6 7 if ( 'undefined' == typeof localServer ) 8 localServer = google.gears.factory.create("beta.localserver"); 9 10 store = localServer.createManagedStore(this.storeName()); 11 store.manifestUrl = "gears-manifest.php"; 12 store.checkForUpdate(); 13 this.message(3); 14 }, 15 16 getPermission : function() { 17 var perm = true; 18 19 if ( 'undefined' != typeof google && google.gears ) { 20 if ( ! google.gears.factory.hasPermission ) 21 perm = google.gears.factory.getPermission( 'WordPress', 'images/logo.gif' ); 22 23 if ( perm ) 24 try { this.createStore(); } catch(e) { this.message(); } // silence if canceled 25 else 26 this.message(4); 27 } 28 }, 29 30 storeName : function() { 31 var name = window.location.protocol + window.location.host; 32 33 name = name.replace(/[\/\\:*"?<>|;,]+/g, '_'); // gears beta doesn't allow certain chars in the store name 34 name = 'wp_' + name.substring(0, 60); // max length of name is 64 chars 35 36 return name; 37 }, 38 39 message : function(show) { 40 var t = this, msg1 = t.I('gears-msg1'), msg2 = t.I('gears-msg2'), msg3 = t.I('gears-msg3'), msg4 = t.I('gears-msg4'), num = t.I('gears-upd-number'), wait = t.I('gears-wait'); 41 42 if ( ! msg1 ) return; 43 44 if ( 'undefined' != typeof google && google.gears ) { 45 if ( show && show == 4 ) { 46 msg1.style.display = msg2.style.display = msg3.style.display = 'none'; 47 msg4.style.display = 'block'; 48 } else if ( google.gears.factory.hasPermission ) { 49 msg1.style.display = msg2.style.display = msg4.style.display = 'none'; 50 msg3.style.display = 'block'; 51 52 if ( 'undefined' == typeof store ) 53 t.createStore(); 54 55 store.oncomplete = function(){wait.innerHTML = (' ' + wpGearsL10n.updateCompleted);}; 56 store.onerror = function(){wait.innerHTML = (' ' + wpGearsL10n.error + ' ' + store.lastErrorMessage);}; 57 store.onprogress = function(e){if(num) num.innerHTML = (' ' + e.filesComplete + ' / ' + e.filesTotal);}; 58 } else { 59 msg1.style.display = msg3.style.display = msg4.style.display = 'none'; 60 msg2.style.display = 'block'; 61 } 62 } 63 }, 64 65 I : function(id) { 66 return document.getElementById(id); 67 } 68 }; 69 70 (function() { 71 if ( 'undefined' != typeof google && google.gears ) return; 72 73 var gf = false; 74 if ( 'undefined' != typeof GearsFactory ) { 75 gf = new GearsFactory(); 76 } else { 77 try { 78 gf = new ActiveXObject('Gears.Factory'); 79 if ( factory.getBuildInfo().indexOf('ie_mobile') != -1 ) 80 gf.privateSetGlobalObject(this); 81 } catch (e) { 82 if ( ( 'undefined' != typeof navigator.mimeTypes ) && navigator.mimeTypes['application/x-googlegears'] ) { 83 gf = document.createElement("object"); 84 gf.style.display = "none"; 85 gf.width = 0; 86 gf.height = 0; 87 gf.type = "application/x-googlegears"; 88 document.documentElement.appendChild(gf); 89 } 90 } 91 } 92 93 if ( ! gf ) return; 94 if ( 'undefined' == typeof google ) google = {}; 95 if ( ! google.gears ) google.gears = { factory : gf }; 96 })(); 1 var wpGears={createStore:function(){if("undefined"==typeof google||!google.gears){return}if("undefined"==typeof localServer){localServer=google.gears.factory.create("beta.localserver")}store=localServer.createManagedStore(this.storeName());store.manifestUrl="gears-manifest.php";store.checkForUpdate();this.message(3)},getPermission:function(){var a=true;if("undefined"!=typeof google&&google.gears){if(!google.gears.factory.hasPermission){a=google.gears.factory.getPermission("WordPress","images/logo.gif")}if(a){try{this.createStore()}catch(b){this.message()}}else{this.message(4)}}},storeName:function(){var a=window.location.protocol+window.location.host;a=a.replace(/[\/\\:*"?<>|;,]+/g,"_");a="wp_"+a.substring(0,60);return a},message:function(a){var d=this,g=d.I("gears-msg1"),f=d.I("gears-msg2"),e=d.I("gears-msg3"),c=d.I("gears-msg4"),b=d.I("gears-upd-number"),h=d.I("gears-wait");if(!g){return}if("undefined"!=typeof google&&google.gears){if(a&&a==4){g.style.display=f.style.display=e.style.display="none";c.style.display="block"}else{if(google.gears.factory.hasPermission){g.style.display=f.style.display=c.style.display="none";e.style.display="block";if("undefined"==typeof store){d.createStore()}store.oncomplete=function(){h.innerHTML=(" "+wpGearsL10n.updateCompleted)};store.onerror=function(){h.innerHTML=(" "+wpGearsL10n.error+" "+store.lastErrorMessage)};store.onprogress=function(i){if(b){b.innerHTML=(" "+i.filesComplete+" / "+i.filesTotal)}}}else{g.style.display=e.style.display=c.style.display="none";f.style.display="block"}}}},I:function(a){return document.getElementById(a)}};(function(){if("undefined"!=typeof google&&google.gears){return}var a=false;if("undefined"!=typeof GearsFactory){a=new GearsFactory()}else{try{a=new ActiveXObject("Gears.Factory");if(factory.getBuildInfo().indexOf("ie_mobile")!=-1){a.privateSetGlobalObject(this)}}catch(b){if(("undefined"!=typeof navigator.mimeTypes)&&navigator.mimeTypes["application/x-googlegears"]){a=document.createElement("object");a.style.display="none";a.width=0;a.height=0;a.type="application/x-googlegears";document.documentElement.appendChild(a)}}}if(!a){return}if("undefined"==typeof google){google={}}if(!google.gears){google.gears={factory:a}}})(); -
trunk/wp-admin/js/xfn.js
r5631 r10291 1 function GetElementsWithClassName(elementName, className) { 2 var allElements = document.getElementsByTagName(elementName); 3 var elemColl = new Array(); 4 for (i = 0; i < allElements.length; i++) { 5 if (allElements[i].className == className) { 6 elemColl[elemColl.length] = allElements[i]; 7 } 8 } 9 return elemColl; 10 } 11 12 function meChecked() { 13 var undefined; 14 var eMe = document.getElementById('me'); 15 if (eMe == undefined) return false; 16 else return eMe.checked; 17 } 18 19 function upit() { 20 var isMe = meChecked(); //document.getElementById('me').checked; 21 var inputColl = GetElementsWithClassName('input', 'valinp'); 22 var results = document.getElementById('link_rel'); 23 var linkText, linkUrl, inputs = ''; 24 for (i = 0; i < inputColl.length; i++) { 25 inputColl[i].disabled = isMe; 26 inputColl[i].parentNode.className = isMe ? 'disabled' : ''; 27 if (!isMe && inputColl[i].checked && inputColl[i].value != '') { 28 inputs += inputColl[i].value + ' '; 29 } 30 } 31 inputs = inputs.substr(0,inputs.length - 1); 32 if (isMe) inputs='me'; 33 results.value = inputs; 34 } 35 36 function blurry() { 37 if (!document.getElementById) return; 38 39 var aInputs = document.getElementsByTagName('input'); 40 41 for (var i = 0; i < aInputs.length; i++) { 42 aInputs[i].onclick = aInputs[i].onkeyup = upit; 43 } 44 } 45 46 addLoadEvent(blurry); 1 function GetElementsWithClassName(a,c){var d=document.getElementsByTagName(a),e=new Array(),b;for(b=0;b<d.length;b++){if(d[b].className==c){e[e.length]=d[b]}}return e}function meChecked(){var b,a=document.getElementById("me");if(a==b){return false}else{return a.checked}}function upit(){var b=meChecked(),e=GetElementsWithClassName("input","valinp"),d=document.getElementById("link_rel"),a="",c;for(c=0;c<e.length;c++){e[c].disabled=b;e[c].parentNode.className=b?"disabled":"";if(!b&&e[c].checked&&e[c].value!=""){a+=e[c].value+" "}}a=a.substr(0,a.length-1);if(b){a="me"}d.value=a}function blurry(){if(!document.getElementById){return}var b=document.getElementsByTagName("input"),a;for(a=0;a<b.length;a++){b[a].onclick=b[a].onkeyup=upit}}addLoadEvent(blurry); -
trunk/wp-includes/js/autosave.js
r10251 r10291 1 var autosaveLast = ''; 2 var autosavePeriodical; 3 var autosaveOldMessage = ''; 4 var autosaveDelayPreview = false; 5 var autosaveFirst = true; 6 7 jQuery(function($) { 8 autosaveLast = $('#post #title').val()+$('#post #content').val(); 9 autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true}); 10 11 //Disable autosave after the form has been submitted 12 $("#post").submit(function() { $.cancel(autosavePeriodical); }); 13 }); 14 15 function autosave_parse_response(response) { 16 var res = wpAjax.parseAjaxResponse(response, 'autosave'); // parse the ajax response 17 var message = ''; 18 19 if ( res && res.responses && res.responses.length ) { 20 message = res.responses[0].data; // The saved message or error. 21 // someone else is editing: disable autosave, set errors 22 if ( res.responses[0].supplemental ) { 23 if ( 'disable' == res.responses[0].supplemental['disable_autosave'] ) { 24 autosave = function() {}; 25 res = { errors: true }; 26 } 27 jQuery.each(res.responses[0].supplemental, function(selector, value) { 28 if ( selector.match(/^replace-/) ) { 29 jQuery('#'+selector.replace('replace-', '')).val(value); 30 } 31 }); 32 } 33 34 // if no errors: add slug UI 35 if ( !res.errors ) { 36 var postID = parseInt( res.responses[0].id, 10 ); 37 if ( !isNaN(postID) && postID > 0 ) { 38 autosave_update_slug(postID); 39 } 40 } 41 } 42 if ( message ) { jQuery('#autosave').html(message); } // update autosave message 43 else if ( autosaveOldMessage && res ) { jQuery('#autosave').html( autosaveOldMessage ); } 44 return res; 45 } 46 47 // called when autosaving pre-existing post 48 function autosave_saved(response) { 49 autosave_parse_response(response); // parse the ajax response 50 autosave_enable_buttons(); // re-enable disabled form buttons 51 } 52 53 // called when autosaving new post 54 function autosave_saved_new(response) { 55 var res = autosave_parse_response(response); // parse the ajax response 56 // if no errors: update post_ID from the temporary value, grab new save-nonce for that new ID 57 if ( res && res.responses.length && !res.errors ) { 58 var tempID = jQuery('#post_ID').val(); 59 var postID = parseInt( res.responses[0].id, 10 ); 60 autosave_update_post_ID( postID ); // disabled form buttons are re-enabled here 61 if ( tempID < 0 && postID > 0 ) // update media buttons 62 jQuery('#media-buttons a').each(function(){ 63 this.href = this.href.replace(tempID, postID); 64 }); 65 // activate preview 66 autosaveFirst = false; 67 if ( autosaveDelayPreview ) 68 jQuery('#post-preview').click(); 69 } else { 70 autosave_enable_buttons(); // re-enable disabled form buttons 71 } 72 } 73 74 function autosave_update_post_ID( postID ) { 75 if ( !isNaN(postID) && postID > 0 ) { 76 if ( postID == parseInt(jQuery('#post_ID').val(), 10) ) { return; } // no need to do this more than once 77 jQuery('#post_ID').attr({name: "post_ID"}); 78 jQuery('#post_ID').val(postID); 79 // We need new nonces 80 jQuery.post(autosaveL10n.requestFile, { 81 action: "autosave-generate-nonces", 82 post_ID: postID, 83 autosavenonce: jQuery('#autosavenonce').val(), 84 post_type: jQuery('#post_type').val() 85 }, function(html) { 86 jQuery('#_wpnonce').val(html); 87 autosave_enable_buttons(); // re-enable disabled form buttons 88 }); 89 jQuery('#hiddenaction').val('editpost'); 90 } 91 } 92 93 function autosave_update_slug(post_id) { 94 // create slug area only if not already there 95 if ( jQuery.isFunction(make_slugedit_clickable) && !jQuery('#edit-slug-box > *').size() ) { 96 jQuery.post( 97 slugL10n.requestFile, 98 { 99 action: 'sample-permalink', 100 post_id: post_id, 101 new_title: jQuery('#title').val(), 102 samplepermalinknonce: jQuery('#samplepermalinknonce').val() 103 }, 104 function(data) { 105 jQuery('#edit-slug-box').html(data); 106 make_slugedit_clickable(); 107 } 108 ); 109 } 110 } 111 112 function autosave_loading() { 113 jQuery('#autosave').html(autosaveL10n.savingText); 114 } 115 116 function autosave_enable_buttons() { 117 jQuery(".submitbox :button:disabled, .submitbox :submit:disabled").attr('disabled', ''); 118 } 119 120 function autosave_disable_buttons() { 121 jQuery(".submitbox :button:enabled, .submitbox :submit:enabled").attr('disabled', 'disabled'); 122 setTimeout(autosave_enable_buttons, 5000); // Re-enable 5 sec later. Just gives autosave a head start to avoid collisions. 123 } 124 125 var autosave = function() { 126 // (bool) is rich editor enabled and active 127 var rich = (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden(); 128 var post_data = { 129 action: "autosave", 130 post_ID: jQuery("#post_ID").val() || 0, 131 post_title: jQuery("#title").val() || "", 132 autosavenonce: jQuery('#autosavenonce').val(), 133 //tags_input: jQuery("#tags-input").val() || "", 134 post_type: jQuery('#post_type').val() || "", 135 autosave: 1 136 }; 137 138 jQuery('.tags-input').each( function() { 139 post_data[this.name] = this.value; 140 } ); 141 142 // We always send the ajax request in order to keep the post lock fresh. 143 // This (bool) tells whether or not to write the post to the DB during the ajax request. 144 var doAutoSave = true; 145 146 // No autosave while thickbox is open (media buttons) 147 if ( jQuery("#TB_window").css('display') == 'block' ) 148 doAutoSave = false; 149 150 /* Gotta do this up here so we can check the length when tinyMCE is in use */ 151 if ( rich ) { 152 var ed = tinyMCE.activeEditor; 153 if ( 'mce_fullscreen' == ed.id ) 154 tinyMCE.get('content').setContent(ed.getContent({format : 'raw'}), {format : 'raw'}); 155 tinyMCE.get('content').save(); 156 } 157 158 post_data["content"] = jQuery("#content").val(); 159 if ( jQuery('#post_name').val() ) 160 post_data["post_name"] = jQuery('#post_name').val(); 161 162 // Nothing to save or no change. 163 if( (post_data["post_title"].length==0 && post_data["content"].length==0) || post_data["post_title"] + post_data["content"] == autosaveLast) { 164 doAutoSave = false 165 } 166 167 autosave_disable_buttons(); 168 169 var origStatus = jQuery('#original_post_status').val(); 170 171 autosaveLast = jQuery("#title").val()+jQuery("#content").val(); 172 goodcats = ([]); 173 jQuery("[@name='post_category[]']:checked").each( function(i) { 174 goodcats.push(this.value); 175 } ); 176 post_data["catslist"] = goodcats.join(","); 177 178 if ( jQuery("#comment_status").attr("checked") ) 179 post_data["comment_status"] = 'open'; 180 if ( jQuery("#ping_status").attr("checked") ) 181 post_data["ping_status"] = 'open'; 182 if ( jQuery("#excerpt").size() ) 183 post_data["excerpt"] = jQuery("#excerpt").val(); 184 if ( jQuery("#post_author").size() ) 185 post_data["post_author"] = jQuery("#post_author").val(); 186 post_data["user_ID"] = jQuery("#user-id").val(); 187 188 // Don't run while the TinyMCE spellcheck is on. Why? Who knows. 189 if ( rich && tinyMCE.activeEditor.plugins.spellchecker && tinyMCE.activeEditor.plugins.spellchecker.active ) { 190 doAutoSave = false; 191 } 192 193 if ( parseInt(post_data["post_ID"], 10) < 1 ) { 194 post_data["temp_ID"] = post_data["post_ID"]; 195 var successCallback = autosave_saved_new; // new post 196 } else { 197 var successCallback = autosave_saved; // pre-existing post 198 } 199 200 if ( !doAutoSave ) { 201 post_data['autosave'] = 0; 202 } 203 204 autosaveOldMessage = jQuery('#autosave').html(); 205 206 jQuery.ajax({ 207 data: post_data, 208 beforeSend: doAutoSave ? autosave_loading : null, 209 type: "POST", 210 url: autosaveL10n.requestFile, 211 success: successCallback 212 }); 213 } 1 var autosaveLast="",autosavePeriodical,autosaveOldMessage="",autosaveDelayPreview=false,autosaveFirst=true;jQuery(function(a){autosaveLast=a("#post #title").val()+a("#post #content").val();autosavePeriodical=a.schedule({time:autosaveL10n.autosaveInterval*1000,func:function(){autosave()},repeat:true,protect:true});a("#post").submit(function(){a.cancel(autosavePeriodical)})});function autosave_parse_response(b){var c=wpAjax.parseAjaxResponse(b,"autosave"),d="",a;if(c&&c.responses&&c.responses.length){d=c.responses[0].data;if(c.responses[0].supplemental){if("disable"==c.responses[0].supplemental.disable_autosave){autosave=function(){};c={errors:true}}jQuery.each(c.responses[0].supplemental,function(e,f){if(e.match(/^replace-/)){jQuery("#"+e.replace("replace-","")).val(f)}})}if(!c.errors){a=parseInt(c.responses[0].id,10);if(!isNaN(a)&&a>0){autosave_update_slug(a)}}}if(d){jQuery("#autosave").html(d)}else{if(autosaveOldMessage&&c){jQuery("#autosave").html(autosaveOldMessage)}}return c}function autosave_saved(a){autosave_parse_response(a);autosave_enable_buttons()}function autosave_saved_new(b){var d=autosave_parse_response(b),c,a;if(d&&d.responses.length&&!d.errors){c=jQuery("#post_ID").val();a=parseInt(d.responses[0].id,10);autosave_update_post_ID(a);if(c<0&&a>0){jQuery("#media-buttons a").each(function(){this.href=this.href.replace(c,a)})}autosaveFirst=false;if(autosaveDelayPreview){jQuery("#post-preview").click()}}else{autosave_enable_buttons()}}function autosave_update_post_ID(a){if(!isNaN(a)&&a>0){if(a==parseInt(jQuery("#post_ID").val(),10)){return}jQuery("#post_ID").attr({name:"post_ID"});jQuery("#post_ID").val(a);jQuery.post(autosaveL10n.requestFile,{action:"autosave-generate-nonces",post_ID:a,autosavenonce:jQuery("#autosavenonce").val(),post_type:jQuery("#post_type").val()},function(b){jQuery("#_wpnonce").val(b);autosave_enable_buttons()});jQuery("#hiddenaction").val("editpost")}}function autosave_update_slug(a){if(jQuery.isFunction(make_slugedit_clickable)&&!jQuery("#edit-slug-box > *").size()){jQuery.post(slugL10n.requestFile,{action:"sample-permalink",post_id:a,new_title:jQuery("#title").val(),samplepermalinknonce:jQuery("#samplepermalinknonce").val()},function(b){jQuery("#edit-slug-box").html(b);make_slugedit_clickable()})}}function autosave_loading(){jQuery("#autosave").html(autosaveL10n.savingText)}function autosave_enable_buttons(){jQuery(".submitbox :button:disabled, .submitbox :submit:disabled").attr("disabled","")}function autosave_disable_buttons(){jQuery(".submitbox :button:enabled, .submitbox :submit:enabled").attr("disabled","disabled");setTimeout(autosave_enable_buttons,5000)}var autosave=function(){var c=(typeof tinyMCE!="undefined")&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden(),d,f,b,e,a;d={action:"autosave",post_ID:jQuery("#post_ID").val()||0,post_title:jQuery("#title").val()||"",autosavenonce:jQuery("#autosavenonce").val(),post_type:jQuery("#post_type").val()||"",autosave:1};jQuery(".tags-input").each(function(){d[this.name]=this.value});f=true;if(jQuery("#TB_window").css("display")=="block"){f=false}if(c){b=tinyMCE.activeEditor;if("mce_fullscreen"==b.id){tinyMCE.get("content").setContent(b.getContent({format:"raw"}),{format:"raw"})}tinyMCE.get("content").save()}d.content=jQuery("#content").val();if(jQuery("#post_name").val()){d.post_name=jQuery("#post_name").val()}if((d.post_title.length==0&&d.content.length==0)||d.post_title+d.content==autosaveLast){f=false}autosave_disable_buttons();e=jQuery("#original_post_status").val();autosaveLast=jQuery("#title").val()+jQuery("#content").val();goodcats=([]);jQuery("[@name='post_category[]']:checked").each(function(g){goodcats.push(this.value)});d.catslist=goodcats.join(",");if(jQuery("#comment_status").attr("checked")){d.comment_status="open"}if(jQuery("#ping_status").attr("checked")){d.ping_status="open"}if(jQuery("#excerpt").size()){d.excerpt=jQuery("#excerpt").val()}if(jQuery("#post_author").size()){d.post_author=jQuery("#post_author").val()}d.user_ID=jQuery("#user-id").val();if(c&&tinyMCE.activeEditor.plugins.spellchecker&&tinyMCE.activeEditor.plugins.spellchecker.active){f=false}if(parseInt(d.post_ID,10)<1){d.temp_ID=d.post_ID;a=autosave_saved_new}else{a=autosave_saved}if(!f){d.autosave=0}autosaveOldMessage=jQuery("#autosave").html();jQuery.ajax({data:d,beforeSend:f?autosave_loading:null,type:"POST",url:autosaveL10n.requestFile,success:a})}; -
trunk/wp-includes/js/colorpicker.js
r7104 r10291 1 // =================================================================== 2 // Author: Matt Kruse <matt@mattkruse.com> 3 // WWW: http://www.mattkruse.com/ 4 // 5 // NOTICE: You may use this code for any purpose, commercial or 6 // private, without any further permission from the author. You may 7 // remove this notice from your final code if you wish, however it is 8 // appreciated by the author if at least my web site address is kept. 9 // 10 // You may *NOT* re-distribute this code in any way except through its 11 // use. That means, you can include it in your product, or your web 12 // site, or any other form where the code is actually being used. You 13 // may not put the plain javascript up on your site for download or 14 // include it in your javascript libraries for download. 15 // If you wish to share this code with others, please just point them 16 // to the URL instead. 17 // Please DO NOT link directly to my .js files from your site. Copy 18 // the files to your server and use them there. Thank you. 19 // =================================================================== 20 21 22 /* SOURCE FILE: AnchorPosition.js */ 23 24 /* 25 AnchorPosition.js 26 Author: Matt Kruse 27 Last modified: 10/11/02 28 29 DESCRIPTION: These functions find the position of an <A> tag in a document, 30 so other elements can be positioned relative to it. 31 32 COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small 33 positioning errors - usually with Window positioning - occur on the 34 Macintosh platform. 35 36 FUNCTIONS: 37 getAnchorPosition(anchorname) 38 Returns an Object() having .x and .y properties of the pixel coordinates 39 of the upper-left corner of the anchor. Position is relative to the PAGE. 40 41 getAnchorWindowPosition(anchorname) 42 Returns an Object() having .x and .y properties of the pixel coordinates 43 of the upper-left corner of the anchor, relative to the WHOLE SCREEN. 44 45 NOTES: 46 47 1) For popping up separate browser windows, use getAnchorWindowPosition. 48 Otherwise, use getAnchorPosition 49 50 2) Your anchor tag MUST contain both NAME and ID attributes which are the 51 same. For example: 52 <A NAME="test" ID="test"> </A> 53 54 3) There must be at least a space between <A> </A> for IE5.5 to see the 55 anchor tag correctly. Do not do <A></A> with no space. 56 */ 57 58 // getAnchorPosition(anchorname) 59 // This function returns an object having .x and .y properties which are the coordinates 60 // of the named anchor, relative to the page. 61 function getAnchorPosition(anchorname) { 62 // This function will return an Object with x and y properties 63 var useWindow=false; 64 var coordinates=new Object(); 65 var x=0,y=0; 66 // Browser capability sniffing 67 var use_gebi=false, use_css=false, use_layers=false; 68 if (document.getElementById) { use_gebi=true; } 69 else if (document.all) { use_css=true; } 70 else if (document.layers) { use_layers=true; } 71 // Logic to find position 72 if (use_gebi && document.all) { 73 x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]); 74 y=AnchorPosition_getPageOffsetTop(document.all[anchorname]); 75 } 76 else if (use_gebi) { 77 var o=document.getElementById(anchorname); 78 x=AnchorPosition_getPageOffsetLeft(o); 79 y=AnchorPosition_getPageOffsetTop(o); 80 } 81 else if (use_css) { 82 x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]); 83 y=AnchorPosition_getPageOffsetTop(document.all[anchorname]); 84 } 85 else if (use_layers) { 86 var found=0; 87 for (var i=0; i<document.anchors.length; i++) { 88 if (document.anchors[i].name==anchorname) { found=1; break; } 89 } 90 if (found==0) { 91 coordinates.x=0; coordinates.y=0; return coordinates; 92 } 93 x=document.anchors[i].x; 94 y=document.anchors[i].y; 95 } 96 else { 97 coordinates.x=0; coordinates.y=0; return coordinates; 98 } 99 coordinates.x=x; 100 coordinates.y=y; 101 return coordinates; 102 } 103 104 // getAnchorWindowPosition(anchorname) 105 // This function returns an object having .x and .y properties which are the coordinates 106 // of the named anchor, relative to the window 107 function getAnchorWindowPosition(anchorname) { 108 var coordinates=getAnchorPosition(anchorname); 109 var x=0; 110 var y=0; 111 if (document.getElementById) { 112 if (isNaN(window.screenX)) { 113 x=coordinates.x-document.body.scrollLeft+window.screenLeft; 114 y=coordinates.y-document.body.scrollTop+window.screenTop; 115 } 116 else { 117 x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset; 118 y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset; 119 } 120 } 121 else if (document.all) { 122 x=coordinates.x-document.body.scrollLeft+window.screenLeft; 123 y=coordinates.y-document.body.scrollTop+window.screenTop; 124 } 125 else if (document.layers) { 126 x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset; 127 y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset; 128 } 129 coordinates.x=x; 130 coordinates.y=y; 131 return coordinates; 132 } 133 134 // Functions for IE to get position of an object 135 function AnchorPosition_getPageOffsetLeft (el) { 136 var ol=el.offsetLeft; 137 while ((el=el.offsetParent) != null) { ol += el.offsetLeft; } 138 return ol; 139 } 140 function AnchorPosition_getWindowOffsetLeft (el) { 141 return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft; 142 } 143 function AnchorPosition_getPageOffsetTop (el) { 144 var ot=el.offsetTop; 145 while((el=el.offsetParent) != null) { ot += el.offsetTop; } 146 return ot; 147 } 148 function AnchorPosition_getWindowOffsetTop (el) { 149 return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop; 150 } 151 152 /* SOURCE FILE: PopupWindow.js */ 153 154 /* 155 PopupWindow.js 156 Author: Matt Kruse 157 Last modified: 02/16/04 158 159 DESCRIPTION: This object allows you to easily and quickly popup a window 160 in a certain place. The window can either be a DIV or a separate browser 161 window. 162 163 COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small 164 positioning errors - usually with Window positioning - occur on the 165 Macintosh platform. Due to bugs in Netscape 4.x, populating the popup 166 window with <STYLE> tags may cause errors. 167 168 USAGE: 169 // Create an object for a WINDOW popup 170 var win = new PopupWindow(); 171 172 // Create an object for a DIV window using the DIV named 'mydiv' 173 var win = new PopupWindow('mydiv'); 174 175 // Set the window to automatically hide itself when the user clicks 176 // anywhere else on the page except the popup 177 win.autoHide(); 178 179 // Show the window relative to the anchor name passed in 180 win.showPopup(anchorname); 181 182 // Hide the popup 183 win.hidePopup(); 184 185 // Set the size of the popup window (only applies to WINDOW popups 186 win.setSize(width,height); 187 188 // Populate the contents of the popup window that will be shown. If you 189 // change the contents while it is displayed, you will need to refresh() 190 win.populate(string); 191 192 // set the URL of the window, rather than populating its contents 193 // manually 194 win.setUrl("http://www.site.com/"); 195 196 // Refresh the contents of the popup 197 win.refresh(); 198 199 // Specify how many pixels to the right of the anchor the popup will appear 200 win.offsetX = 50; 201 202 // Specify how many pixels below the anchor the popup will appear 203 win.offsetY = 100; 204 205 NOTES: 206 1) Requires the functions in AnchorPosition.js 207 208 2) Your anchor tag MUST contain both NAME and ID attributes which are the 209 same. For example: 210 <A NAME="test" ID="test"> </A> 211 212 3) There must be at least a space between <A> </A> for IE5.5 to see the 213 anchor tag correctly. Do not do <A></A> with no space. 214 215 4) When a PopupWindow object is created, a handler for 'onmouseup' is 216 attached to any event handler you may have already defined. Do NOT define 217 an event handler for 'onmouseup' after you define a PopupWindow object or 218 the autoHide() will not work correctly. 219 */ 220 221 // Set the position of the popup window based on the anchor 222 function PopupWindow_getXYPosition(anchorname) { 223 var coordinates; 224 if (this.type == "WINDOW") { 225 coordinates = getAnchorWindowPosition(anchorname); 226 } 227 else { 228 coordinates = getAnchorPosition(anchorname); 229 } 230 this.x = coordinates.x; 231 this.y = coordinates.y; 232 } 233 // Set width/height of DIV/popup window 234 function PopupWindow_setSize(width,height) { 235 this.width = width; 236 this.height = height; 237 } 238 // Fill the window with contents 239 function PopupWindow_populate(contents) { 240 this.contents = contents; 241 this.populated = false; 242 } 243 // Set the URL to go to 244 function PopupWindow_setUrl(url) { 245 this.url = url; 246 } 247 // Set the window popup properties 248 function PopupWindow_setWindowProperties(props) { 249 this.windowProperties = props; 250 } 251 // Refresh the displayed contents of the popup 252 function PopupWindow_refresh() { 253 if (this.divName != null) { 254 // refresh the DIV object 255 if (this.use_gebi) { 256 document.getElementById(this.divName).innerHTML = this.contents; 257 } 258 else if (this.use_css) { 259 document.all[this.divName].innerHTML = this.contents; 260 } 261 else if (this.use_layers) { 262 var d = document.layers[this.divName]; 263 d.document.open(); 264 d.document.writeln(this.contents); 265 d.document.close(); 266 } 267 } 268 else { 269 if (this.popupWindow != null && !this.popupWindow.closed) { 270 if (this.url!="") { 271 this.popupWindow.location.href=this.url; 272 } 273 else { 274 this.popupWindow.document.open(); 275 this.popupWindow.document.writeln(this.contents); 276 this.popupWindow.document.close(); 277 } 278 this.popupWindow.focus(); 279 } 280 } 281 } 282 // Position and show the popup, relative to an anchor object 283 function PopupWindow_showPopup(anchorname) { 284 this.getXYPosition(anchorname); 285 this.x += this.offsetX; 286 this.y += this.offsetY; 287 if (!this.populated && (this.contents != "")) { 288 this.populated = true; 289 this.refresh(); 290 } 291 if (this.divName != null) { 292 // Show the DIV object 293 if (this.use_gebi) { 294 document.getElementById(this.divName).style.left = this.x + "px"; 295 document.getElementById(this.divName).style.top = this.y; 296 document.getElementById(this.divName).style.visibility = "visible"; 297 } 298 else if (this.use_css) { 299 document.all[this.divName].style.left = this.x; 300 document.all[this.divName].style.top = this.y; 301 document.all[this.divName].style.visibility = "visible"; 302 } 303 else if (this.use_layers) { 304 document.layers[this.divName].left = this.x; 305 document.layers[this.divName].top = this.y; 306 document.layers[this.divName].visibility = "visible"; 307 } 308 } 309 else { 310 if (this.popupWindow == null || this.popupWindow.closed) { 311 // If the popup window will go off-screen, move it so it doesn't 312 if (this.x<0) { this.x=0; } 313 if (this.y<0) { this.y=0; } 314 if (screen && screen.availHeight) { 315 if ((this.y + this.height) > screen.availHeight) { 316 this.y = screen.availHeight - this.height; 317 } 318 } 319 if (screen && screen.availWidth) { 320 if ((this.x + this.width) > screen.availWidth) { 321 this.x = screen.availWidth - this.width; 322 } 323 } 324 var avoidAboutBlank = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) || navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled ); 325 this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+""); 326 } 327 this.refresh(); 328 } 329 } 330 // Hide the popup 331 function PopupWindow_hidePopup() { 332 if (this.divName != null) { 333 if (this.use_gebi) { 334 document.getElementById(this.divName).style.visibility = "hidden"; 335 } 336 else if (this.use_css) { 337 document.all[this.divName].style.visibility = "hidden"; 338 } 339 else if (this.use_layers) { 340 document.layers[this.divName].visibility = "hidden"; 341 } 342 } 343 else { 344 if (this.popupWindow && !this.popupWindow.closed) { 345 this.popupWindow.close(); 346 this.popupWindow = null; 347 } 348 } 349 } 350 // Pass an event and return whether or not it was the popup DIV that was clicked 351 function PopupWindow_isClicked(e) { 352 if (this.divName != null) { 353 if (this.use_layers) { 354 var clickX = e.pageX; 355 var clickY = e.pageY; 356 var t = document.layers[this.divName]; 357 if ((clickX > t.left) && (clickX < t.left+t.clip.width) && (clickY > t.top) && (clickY < t.top+t.clip.height)) { 358 return true; 359 } 360 else { return false; } 361 } 362 else if (document.all) { // Need to hard-code this to trap IE for error-handling 363 var t = window.event.srcElement; 364 while (t.parentElement != null) { 365 if (t.id==this.divName) { 366 return true; 367 } 368 t = t.parentElement; 369 } 370 return false; 371 } 372 else if (this.use_gebi && e) { 373 var t = e.originalTarget; 374 while (t.parentNode != null) { 375 if (t.id==this.divName) { 376 return true; 377 } 378 t = t.parentNode; 379 } 380 return false; 381 } 382 return false; 383 } 384 return false; 385 } 386 387 // Check an onMouseDown event to see if we should hide 388 function PopupWindow_hideIfNotClicked(e) { 389 if (this.autoHideEnabled && !this.isClicked(e)) { 390 this.hidePopup(); 391 } 392 } 393 // Call this to make the DIV disable automatically when mouse is clicked outside it 394 function PopupWindow_autoHide() { 395 this.autoHideEnabled = true; 396 } 397 // This global function checks all PopupWindow objects onmouseup to see if they should be hidden 398 function PopupWindow_hidePopupWindows(e) { 399 for (var i=0; i<popupWindowObjects.length; i++) { 400 if (popupWindowObjects[i] != null) { 401 var p = popupWindowObjects[i]; 402 p.hideIfNotClicked(e); 403 } 404 } 405 } 406 // Run this immediately to attach the event listener 407 function PopupWindow_attachListener() { 408 if (document.layers) { 409 document.captureEvents(Event.MOUSEUP); 410 } 411 window.popupWindowOldEventListener = document.onmouseup; 412 if (window.popupWindowOldEventListener != null) { 413 document.onmouseup = new Function("window.popupWindowOldEventListener(); PopupWindow_hidePopupWindows();"); 414 } 415 else { 416 document.onmouseup = PopupWindow_hidePopupWindows; 417 } 418 } 419 // CONSTRUCTOR for the PopupWindow object 420 // Pass it a DIV name to use a DHTML popup, otherwise will default to window popup 421 function PopupWindow() { 422 if (!window.popupWindowIndex) { window.popupWindowIndex = 0; } 423 if (!window.popupWindowObjects) { window.popupWindowObjects = new Array(); } 424 if (!window.listenerAttached) { 425 window.listenerAttached = true; 426 PopupWindow_attachListener(); 427 } 428 this.index = popupWindowIndex++; 429 popupWindowObjects[this.index] = this; 430 this.divName = null; 431 this.popupWindow = null; 432 this.width=0; 433 this.height=0; 434 this.populated = false; 435 this.visible = false; 436 this.autoHideEnabled = false; 437 438 this.contents = ""; 439 this.url=""; 440 this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no"; 441 if (arguments.length>0) { 442 this.type="DIV"; 443 this.divName = arguments[0]; 444 } 445 else { 446 this.type="WINDOW"; 447 } 448 this.use_gebi = false; 449 this.use_css = false; 450 this.use_layers = false; 451 if (document.getElementById) { this.use_gebi = true; } 452 else if (document.all) { this.use_css = true; } 453 else if (document.layers) { this.use_layers = true; } 454 else { this.type = "WINDOW"; } 455 this.offsetX = 0; 456 this.offsetY = 0; 457 // Method mappings 458 this.getXYPosition = PopupWindow_getXYPosition; 459 this.populate = PopupWindow_populate; 460 this.setUrl = PopupWindow_setUrl; 461 this.setWindowProperties = PopupWindow_setWindowProperties; 462 this.refresh = PopupWindow_refresh; 463 this.showPopup = PopupWindow_showPopup; 464 this.hidePopup = PopupWindow_hidePopup; 465 this.setSize = PopupWindow_setSize; 466 this.isClicked = PopupWindow_isClicked; 467 this.autoHide = PopupWindow_autoHide; 468 this.hideIfNotClicked = PopupWindow_hideIfNotClicked; 469 } 470 471 /* SOURCE FILE: ColorPicker2.js */ 472 473 /* 474 Last modified: 02/24/2003 475 476 DESCRIPTION: This widget is used to select a color, in hexadecimal #RRGGBB 477 form. It uses a color "swatch" to display the standard 216-color web-safe 478 palette. The user can then click on a color to select it. 479 480 COMPATABILITY: See notes in AnchorPosition.js and PopupWindow.js. 481 Only the latest DHTML-capable browsers will show the color and hex values 482 at the bottom as your mouse goes over them. 483 484 USAGE: 485 // Create a new ColorPicker object using DHTML popup 486 var cp = new ColorPicker(); 487 488 // Create a new ColorPicker object using Window Popup 489 var cp = new ColorPicker('window'); 490 491 // Add a link in your page to trigger the popup. For example: 492 <A HREF="#" onClick="cp.show('pick');return false;" NAME="pick" ID="pick">Pick</A> 493 494 // Or use the built-in "select" function to do the dirty work for you: 495 <A HREF="#" onClick="cp.select(document.forms[0].color,'pick');return false;" NAME="pick" ID="pick">Pick</A> 496 497 // If using DHTML popup, write out the required DIV tag near the bottom 498 // of your page. 499 <SCRIPT LANGUAGE="JavaScript">cp.writeDiv()</SCRIPT> 500 501 // Write the 'pickColor' function that will be called when the user clicks 502 // a color and do something with the value. This is only required if you 503 // want to do something other than simply populate a form field, which is 504 // what the 'select' function will give you. 505 function pickColor(color) { 506 field.value = color; 507 } 508 509 NOTES: 510 1) Requires the functions in AnchorPosition.js and PopupWindow.js 511 512 2) Your anchor tag MUST contain both NAME and ID attributes which are the 513 same. For example: 514 <A NAME="test" ID="test"> </A> 515 516 3) There must be at least a space between <A> </A> for IE5.5 to see the 517 anchor tag correctly. Do not do <A></A> with no space. 518 519 4) When a ColorPicker object is created, a handler for 'onmouseup' is 520 attached to any event handler you may have already defined. Do NOT define 521 an event handler for 'onmouseup' after you define a ColorPicker object or 522 the color picker will not hide itself correctly. 523 */ 524 ColorPicker_targetInput = null; 525 function ColorPicker_writeDiv() { 526 document.writeln("<DIV ID=\"colorPickerDiv\" STYLE=\"position:absolute;visibility:hidden;\"> </DIV>"); 527 } 528 529 function ColorPicker_show(anchorname) { 530 this.showPopup(anchorname); 531 } 532 533 function ColorPicker_pickColor(color,obj) { 534 obj.hidePopup(); 535 pickColor(color); 536 } 537 538 // A Default "pickColor" function to accept the color passed back from popup. 539 // User can over-ride this with their own function. 540 function pickColor(color) { 541 if (ColorPicker_targetInput==null) { 542 alert("Target Input is null, which means you either didn't use the 'select' function or you have no defined your own 'pickColor' function to handle the picked color!"); 543 return; 544 } 545 ColorPicker_targetInput.value = color; 546 } 547 548 // This function is the easiest way to popup the window, select a color, and 549 // have the value populate a form field, which is what most people want to do. 550 function ColorPicker_select(inputobj,linkname) { 551 if (inputobj.type!="text" && inputobj.type!="hidden" && inputobj.type!="textarea") { 552 alert("colorpicker.select: Input object passed is not a valid form input object"); 553 window.ColorPicker_targetInput=null; 554 return; 555 } 556 window.ColorPicker_targetInput = inputobj; 557 this.show(linkname); 558 } 559 560 // This function runs when you move your mouse over a color block, if you have a newer browser 561 function ColorPicker_highlightColor(c) { 562 var thedoc = (arguments.length>1)?arguments[1]:window.document; 563 var d = thedoc.getElementById("colorPickerSelectedColor"); 564 d.style.backgroundColor = c; 565 d = thedoc.getElementById("colorPickerSelectedColorValue"); 566 d.innerHTML = c; 567 } 568 569 function ColorPicker() { 570 var windowMode = false; 571 // Create a new PopupWindow object 572 if (arguments.length==0) { 573 var divname = "colorPickerDiv"; 574 } 575 else if (arguments[0] == "window") { 576 var divname = ''; 577 windowMode = true; 578 } 579 else { 580 var divname = arguments[0]; 581 } 582 583 if (divname != "") { 584 var cp = new PopupWindow(divname); 585 } 586 else { 587 var cp = new PopupWindow(); 588 cp.setSize(225,250); 589 } 590 591 // Object variables 592 cp.currentValue = "#FFFFFF"; 593 594 // Method Mappings 595 cp.writeDiv = ColorPicker_writeDiv; 596 cp.highlightColor = ColorPicker_highlightColor; 597 cp.show = ColorPicker_show; 598 cp.select = ColorPicker_select; 599 600 // Code to populate color picker window 601 var colors = new Array( "#4180B6","#69AEE7","#000000","#000033","#000066","#000099","#0000CC","#0000FF","#330000","#330033","#330066","#330099", 602 "#3300CC","#3300FF","#660000","#660033","#660066","#660099","#6600CC","#6600FF","#990000","#990033","#990066","#990099", 603 "#9900CC","#9900FF","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#FF0000","#FF0033","#FF0066","#FF0099", 604 "#FF00CC","#FF00FF","#7FFFFF","#7FFFFF","#7FF7F7","#7FEFEF","#7FE7E7","#7FDFDF","#7FD7D7","#7FCFCF","#7FC7C7","#7FBFBF", 605 "#7FB7B7","#7FAFAF","#7FA7A7","#7F9F9F","#7F9797","#7F8F8F","#7F8787","#7F7F7F","#7F7777","#7F6F6F","#7F6767","#7F5F5F", 606 "#7F5757","#7F4F4F","#7F4747","#7F3F3F","#7F3737","#7F2F2F","#7F2727","#7F1F1F","#7F1717","#7F0F0F","#7F0707","#7F0000", 607 608 "#4180B6","#69AEE7","#003300","#003333","#003366","#003399","#0033CC","#0033FF","#333300","#333333","#333366","#333399", 609 "#3333CC","#3333FF","#663300","#663333","#663366","#663399","#6633CC","#6633FF","#993300","#993333","#993366","#993399", 610 "#9933CC","#9933FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#FF3300","#FF3333","#FF3366","#FF3399", 611 "#FF33CC","#FF33FF","#FF7FFF","#FF7FFF","#F77FF7","#EF7FEF","#E77FE7","#DF7FDF","#D77FD7","#CF7FCF","#C77FC7","#BF7FBF", 612 "#B77FB7","#AF7FAF","#A77FA7","#9F7F9F","#977F97","#8F7F8F","#877F87","#7F7F7F","#777F77","#6F7F6F","#677F67","#5F7F5F", 613 "#577F57","#4F7F4F","#477F47","#3F7F3F","#377F37","#2F7F2F","#277F27","#1F7F1F","#177F17","#0F7F0F","#077F07","#007F00", 614 615 "#4180B6","#69AEE7","#006600","#006633","#006666","#006699","#0066CC","#0066FF","#336600","#336633","#336666","#336699", 616 "#3366CC","#3366FF","#666600","#666633","#666666","#666699","#6666CC","#6666FF","#996600","#996633","#996666","#996699", 617 "#9966CC","#9966FF","#CC6600","#CC6633","#CC6666","#CC6699","#CC66CC","#CC66FF","#FF6600","#FF6633","#FF6666","#FF6699", 618 "#FF66CC","#FF66FF","#FFFF7F","#FFFF7F","#F7F77F","#EFEF7F","#E7E77F","#DFDF7F","#D7D77F","#CFCF7F","#C7C77F","#BFBF7F", 619 "#B7B77F","#AFAF7F","#A7A77F","#9F9F7F","#97977F","#8F8F7F","#87877F","#7F7F7F","#77777F","#6F6F7F","#67677F","#5F5F7F", 620 "#57577F","#4F4F7F","#47477F","#3F3F7F","#37377F","#2F2F7F","#27277F","#1F1F7F","#17177F","#0F0F7F","#07077F","#00007F", 621 622 "#4180B6","#69AEE7","#009900","#009933","#009966","#009999","#0099CC","#0099FF","#339900","#339933","#339966","#339999", 623 "#3399CC","#3399FF","#669900","#669933","#669966","#669999","#6699CC","#6699FF","#999900","#999933","#999966","#999999", 624 "#9999CC","#9999FF","#CC9900","#CC9933","#CC9966","#CC9999","#CC99CC","#CC99FF","#FF9900","#FF9933","#FF9966","#FF9999", 625 "#FF99CC","#FF99FF","#3FFFFF","#3FFFFF","#3FF7F7","#3FEFEF","#3FE7E7","#3FDFDF","#3FD7D7","#3FCFCF","#3FC7C7","#3FBFBF", 626 "#3FB7B7","#3FAFAF","#3FA7A7","#3F9F9F","#3F9797","#3F8F8F","#3F8787","#3F7F7F","#3F7777","#3F6F6F","#3F6767","#3F5F5F", 627 "#3F5757","#3F4F4F","#3F4747","#3F3F3F","#3F3737","#3F2F2F","#3F2727","#3F1F1F","#3F1717","#3F0F0F","#3F0707","#3F0000", 628 629 "#4180B6","#69AEE7","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#33CC00","#33CC33","#33CC66","#33CC99", 630 "#33CCCC","#33CCFF","#66CC00","#66CC33","#66CC66","#66CC99","#66CCCC","#66CCFF","#99CC00","#99CC33","#99CC66","#99CC99", 631 "#99CCCC","#99CCFF","#CCCC00","#CCCC33","#CCCC66","#CCCC99","#CCCCCC","#CCCCFF","#FFCC00","#FFCC33","#FFCC66","#FFCC99", 632 "#FFCCCC","#FFCCFF","#FF3FFF","#FF3FFF","#F73FF7","#EF3FEF","#E73FE7","#DF3FDF","#D73FD7","#CF3FCF","#C73FC7","#BF3FBF", 633 "#B73FB7","#AF3FAF","#A73FA7","#9F3F9F","#973F97","#8F3F8F","#873F87","#7F3F7F","#773F77","#6F3F6F","#673F67","#5F3F5F", 634 "#573F57","#4F3F4F","#473F47","#3F3F3F","#373F37","#2F3F2F","#273F27","#1F3F1F","#173F17","#0F3F0F","#073F07","#003F00", 635 636 "#4180B6","#69AEE7","#00FF00","#00FF33","#00FF66","#00FF99","#00FFCC","#00FFFF","#33FF00","#33FF33","#33FF66","#33FF99", 637 "#33FFCC","#33FFFF","#66FF00","#66FF33","#66FF66","#66FF99","#66FFCC","#66FFFF","#99FF00","#99FF33","#99FF66","#99FF99", 638 "#99FFCC","#99FFFF","#CCFF00","#CCFF33","#CCFF66","#CCFF99","#CCFFCC","#CCFFFF","#FFFF00","#FFFF33","#FFFF66","#FFFF99", 639 "#FFFFCC","#FFFFFF","#FFFF3F","#FFFF3F","#F7F73F","#EFEF3F","#E7E73F","#DFDF3F","#D7D73F","#CFCF3F","#C7C73F","#BFBF3F", 640 "#B7B73F","#AFAF3F","#A7A73F","#9F9F3F","#97973F","#8F8F3F","#87873F","#7F7F3F","#77773F","#6F6F3F","#67673F","#5F5F3F", 641 "#57573F","#4F4F3F","#47473F","#3F3F3F","#37373F","#2F2F3F","#27273F","#1F1F3F","#17173F","#0F0F3F","#07073F","#00003F", 642 643 "#4180B6","#69AEE7","#FFFFFF","#FFEEEE","#FFDDDD","#FFCCCC","#FFBBBB","#FFAAAA","#FF9999","#FF8888","#FF7777","#FF6666", 644 "#FF5555","#FF4444","#FF3333","#FF2222","#FF1111","#FF0000","#FF0000","#FF0000","#FF0000","#EE0000","#DD0000","#CC0000", 645 "#BB0000","#AA0000","#990000","#880000","#770000","#660000","#550000","#440000","#330000","#220000","#110000","#000000", 646 "#000000","#000000","#000000","#001111","#002222","#003333","#004444","#005555","#006666","#007777","#008888","#009999", 647 "#00AAAA","#00BBBB","#00CCCC","#00DDDD","#00EEEE","#00FFFF","#00FFFF","#00FFFF","#00FFFF","#11FFFF","#22FFFF","#33FFFF", 648 "#44FFFF","#55FFFF","#66FFFF","#77FFFF","#88FFFF","#99FFFF","#AAFFFF","#BBFFFF","#CCFFFF","#DDFFFF","#EEFFFF","#FFFFFF", 649 650 "#4180B6","#69AEE7","#FFFFFF","#EEFFEE","#DDFFDD","#CCFFCC","#BBFFBB","#AAFFAA","#99FF99","#88FF88","#77FF77","#66FF66", 651 "#55FF55","#44FF44","#33FF33","#22FF22","#11FF11","#00FF00","#00FF00","#00FF00","#00FF00","#00EE00","#00DD00","#00CC00", 652 "#00BB00","#00AA00","#009900","#008800","#007700","#006600","#005500","#004400","#003300","#002200","#001100","#000000", 653 "#000000","#000000","#000000","#110011","#220022","#330033","#440044","#550055","#660066","#770077","#880088","#990099", 654 "#AA00AA","#BB00BB","#CC00CC","#DD00DD","#EE00EE","#FF00FF","#FF00FF","#FF00FF","#FF00FF","#FF11FF","#FF22FF","#FF33FF", 655 "#FF44FF","#FF55FF","#FF66FF","#FF77FF","#FF88FF","#FF99FF","#FFAAFF","#FFBBFF","#FFCCFF","#FFDDFF","#FFEEFF","#FFFFFF", 656 657 "#4180B6","#69AEE7","#FFFFFF","#EEEEFF","#DDDDFF","#CCCCFF","#BBBBFF","#AAAAFF","#9999FF","#8888FF","#7777FF","#6666FF", 658 "#5555FF","#4444FF","#3333FF","#2222FF","#1111FF","#0000FF","#0000FF","#0000FF","#0000FF","#0000EE","#0000DD","#0000CC", 659 "#0000BB","#0000AA","#000099","#000088","#000077","#000066","#000055","#000044","#000033","#000022","#000011","#000000", 660 "#000000","#000000","#000000","#111100","#222200","#333300","#444400","#555500","#666600","#777700","#888800","#999900", 661 "#AAAA00","#BBBB00","#CCCC00","#DDDD00","#EEEE00","#FFFF00","#FFFF00","#FFFF00","#FFFF00","#FFFF11","#FFFF22","#FFFF33", 662 "#FFFF44","#FFFF55","#FFFF66","#FFFF77","#FFFF88","#FFFF99","#FFFFAA","#FFFFBB","#FFFFCC","#FFFFDD","#FFFFEE","#FFFFFF", 663 664 "#4180B6","#69AEE7","#FFFFFF","#FFFFFF","#FBFBFB","#F7F7F7","#F3F3F3","#EFEFEF","#EBEBEB","#E7E7E7","#E3E3E3","#DFDFDF", 665 "#DBDBDB","#D7D7D7","#D3D3D3","#CFCFCF","#CBCBCB","#C7C7C7","#C3C3C3","#BFBFBF","#BBBBBB","#B7B7B7","#B3B3B3","#AFAFAF", 666 "#ABABAB","#A7A7A7","#A3A3A3","#9F9F9F","#9B9B9B","#979797","#939393","#8F8F8F","#8B8B8B","#878787","#838383","#7F7F7F", 667 "#7B7B7B","#777777","#737373","#6F6F6F","#6B6B6B","#676767","#636363","#5F5F5F","#5B5B5B","#575757","#535353","#4F4F4F", 668 "#4B4B4B","#474747","#434343","#3F3F3F","#3B3B3B","#373737","#333333","#2F2F2F","#2B2B2B","#272727","#232323","#1F1F1F", 669 "#1B1B1B","#171717","#131313","#0F0F0F","#0B0B0B","#070707","#030303","#000000","#000000","#000000","#000000","#000000"); 670 var total = colors.length; 671 var width = 72; 672 var cp_contents = ""; 673 var windowRef = (windowMode)?"window.opener.":""; 674 if (windowMode) { 675 cp_contents += "<html><head><title>Select Color</title></head>"; 676 cp_contents += "<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0><span style='text-align: center;'>"; 677 } 678 cp_contents += "<table style='border: none;' cellspacing=0 cellpadding=0>"; 679 var use_highlight = (document.getElementById || document.all)?true:false; 680 for (var i=0; i<total; i++) { 681 if ((i % width) == 0) { cp_contents += "<tr>"; } 682 if (use_highlight) { var mo = 'onMouseOver="'+windowRef+'ColorPicker_highlightColor(\''+colors[i]+'\',window.document)"'; } 683 else { mo = ""; } 684 cp_contents += '<td style="background-color: '+colors[i]+';"><a href="javascript:void()" onclick="'+windowRef+'ColorPicker_pickColor(\''+colors[i]+'\','+windowRef+'window.popupWindowObjects['+cp.index+']);return false;" '+mo+'> </a></td>'; 685 if ( ((i+1)>=total) || (((i+1) % width) == 0)) { 686 cp_contents += "</tr>"; 687 } 688 } 689 // If the browser supports dynamically changing TD cells, add the fancy stuff 690 if (document.getElementById) { 691 var width1 = Math.floor(width/2); 692 var width2 = width = width1; 693 cp_contents += "<tr><td colspan='"+width1+"' style='background-color: #FFF;' ID='colorPickerSelectedColor'> </td><td colspan='"+width2+"' style='text-align: center;' id='colorPickerSelectedColorValue'>#FFFFFF</td></tr>"; 694 } 695 cp_contents += "</table>"; 696 if (windowMode) { 697 cp_contents += "</span></body></html>"; 698 } 699 // end populate code 700 701 // Write the contents to the popup object 702 cp.populate(cp_contents+"\n"); 703 // Move the table down a bit so you can see it 704 cp.offsetY = 25; 705 cp.autoHide(); 706 return cp; 707 } 1 function getAnchorPosition(b){var e=false;var k=new Object();var j=0,g=0;var d=false,f=false,h=false;if(document.getElementById){d=true}else{if(document.all){f=true}else{if(document.layers){h=true}}}if(d&&document.all){j=AnchorPosition_getPageOffsetLeft(document.all[b]);g=AnchorPosition_getPageOffsetTop(document.all[b])}else{if(d){var a=document.getElementById(b);j=AnchorPosition_getPageOffsetLeft(a);g=AnchorPosition_getPageOffsetTop(a)}else{if(f){j=AnchorPosition_getPageOffsetLeft(document.all[b]);g=AnchorPosition_getPageOffsetTop(document.all[b])}else{if(h){var l=0;for(var c=0;c<document.anchors.length;c++){if(document.anchors[c].name==b){l=1;break}}if(l==0){k.x=0;k.y=0;return k}j=document.anchors[c].x;g=document.anchors[c].y}else{k.x=0;k.y=0;return k}}}}k.x=j;k.y=g;return k}function getAnchorWindowPosition(b){var c=getAnchorPosition(b);var a=0;var d=0;if(document.getElementById){if(isNaN(window.screenX)){a=c.x-document.body.scrollLeft+window.screenLeft;d=c.y-document.body.scrollTop+window.screenTop}else{a=c.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;d=c.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset}}else{if(document.all){a=c.x-document.body.scrollLeft+window.screenLeft;d=c.y-document.body.scrollTop+window.screenTop}else{if(document.layers){a=c.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;d=c.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset}}}c.x=a;c.y=d;return c}function AnchorPosition_getPageOffsetLeft(b){var a=b.offsetLeft;while((b=b.offsetParent)!=null){a+=b.offsetLeft}return a}function AnchorPosition_getWindowOffsetLeft(a){return AnchorPosition_getPageOffsetLeft(a)-document.body.scrollLeft}function AnchorPosition_getPageOffsetTop(a){var b=a.offsetTop;while((a=a.offsetParent)!=null){b+=a.offsetTop}return b}function AnchorPosition_getWindowOffsetTop(a){return AnchorPosition_getPageOffsetTop(a)-document.body.scrollTop}function PopupWindow_getXYPosition(a){var b;if(this.type=="WINDOW"){b=getAnchorWindowPosition(a)}else{b=getAnchorPosition(a)}this.x=b.x;this.y=b.y}function PopupWindow_setSize(b,a){this.width=b;this.height=a}function PopupWindow_populate(a){this.contents=a;this.populated=false}function PopupWindow_setUrl(a){this.url=a}function PopupWindow_setWindowProperties(a){this.windowProperties=a}function PopupWindow_refresh(){if(this.divName!=null){if(this.use_gebi){document.getElementById(this.divName).innerHTML=this.contents}else{if(this.use_css){document.all[this.divName].innerHTML=this.contents}else{if(this.use_layers){var a=document.layers[this.divName];a.document.open();a.document.writeln(this.contents);a.document.close()}}}}else{if(this.popupWindow!=null&&!this.popupWindow.closed){if(this.url!=""){this.popupWindow.location.href=this.url}else{this.popupWindow.document.open();this.popupWindow.document.writeln(this.contents);this.popupWindow.document.close()}this.popupWindow.focus()}}}function PopupWindow_showPopup(a){this.getXYPosition(a);this.x+=this.offsetX;this.y+=this.offsetY;if(!this.populated&&(this.contents!="")){this.populated=true;this.refresh()}if(this.divName!=null){if(this.use_gebi){document.getElementById(this.divName).style.left=this.x+"px";document.getElementById(this.divName).style.top=this.y;document.getElementById(this.divName).style.visibility="visible"}else{if(this.use_css){document.all[this.divName].style.left=this.x;document.all[this.divName].style.top=this.y;document.all[this.divName].style.visibility="visible"}else{if(this.use_layers){document.layers[this.divName].left=this.x;document.layers[this.divName].top=this.y;document.layers[this.divName].visibility="visible"}}}}else{if(this.popupWindow==null||this.popupWindow.closed){if(this.x<0){this.x=0}if(this.y<0){this.y=0}if(screen&&screen.availHeight){if((this.y+this.height)>screen.availHeight){this.y=screen.availHeight-this.height}}if(screen&&screen.availWidth){if((this.x+this.width)>screen.availWidth){this.x=screen.availWidth-this.width}}var b=window.opera||(document.layers&&!navigator.mimeTypes["*"])||navigator.vendor=="KDE"||(document.childNodes&&!document.all&&!navigator.taintEnabled);this.popupWindow=window.open(b?"":"about:blank","window_"+a,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"")}this.refresh()}}function PopupWindow_hidePopup(){if(this.divName!=null){if(this.use_gebi){document.getElementById(this.divName).style.visibility="hidden"}else{if(this.use_css){document.all[this.divName].style.visibility="hidden"}else{if(this.use_layers){document.layers[this.divName].visibility="hidden"}}}}else{if(this.popupWindow&&!this.popupWindow.closed){this.popupWindow.close();this.popupWindow=null}}}function PopupWindow_isClicked(c){if(this.divName!=null){if(this.use_layers){var d=c.pageX;var b=c.pageY;var a=document.layers[this.divName];if((d>a.left)&&(d<a.left+a.clip.width)&&(b>a.top)&&(b<a.top+a.clip.height)){return true}else{return false}}else{if(document.all){var a=window.event.srcElement;while(a.parentElement!=null){if(a.id==this.divName){return true}a=a.parentElement}return false}else{if(this.use_gebi&&c){var a=c.originalTarget;while(a.parentNode!=null){if(a.id==this.divName){return true}a=a.parentNode}return false}}}return false}return false}function PopupWindow_hideIfNotClicked(a){if(this.autoHideEnabled&&!this.isClicked(a)){this.hidePopup()}}function PopupWindow_autoHide(){this.autoHideEnabled=true}function PopupWindow_hidePopupWindows(c){for(var a=0;a<popupWindowObjects.length;a++){if(popupWindowObjects[a]!=null){var b=popupWindowObjects[a];b.hideIfNotClicked(c)}}}function PopupWindow_attachListener(){if(document.layers){document.captureEvents(Event.MOUSEUP)}window.popupWindowOldEventListener=document.onmouseup;if(window.popupWindowOldEventListener!=null){document.onmouseup=new Function("window.popupWindowOldEventListener(); PopupWindow_hidePopupWindows();")}else{document.onmouseup=PopupWindow_hidePopupWindows}}function PopupWindow(){if(!window.popupWindowIndex){window.popupWindowIndex=0}if(!window.popupWindowObjects){window.popupWindowObjects=new Array()}if(!window.listenerAttached){window.listenerAttached=true;PopupWindow_attachListener()}this.index=popupWindowIndex++;popupWindowObjects[this.index]=this;this.divName=null;this.popupWindow=null;this.width=0;this.height=0;this.populated=false;this.visible=false;this.autoHideEnabled=false;this.contents="";this.url="";this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";if(arguments.length>0){this.type="DIV";this.divName=arguments[0]}else{this.type="WINDOW"}this.use_gebi=false;this.use_css=false;this.use_layers=false;if(document.getElementById){this.use_gebi=true}else{if(document.all){this.use_css=true}else{if(document.layers){this.use_layers=true}else{this.type="WINDOW"}}}this.offsetX=0;this.offsetY=0;this.getXYPosition=PopupWindow_getXYPosition;this.populate=PopupWindow_populate;this.setUrl=PopupWindow_setUrl;this.setWindowProperties=PopupWindow_setWindowProperties;this.refresh=PopupWindow_refresh;this.showPopup=PopupWindow_showPopup;this.hidePopup=PopupWindow_hidePopup;this.setSize=PopupWindow_setSize;this.isClicked=PopupWindow_isClicked;this.autoHide=PopupWindow_autoHide;this.hideIfNotClicked=PopupWindow_hideIfNotClicked}ColorPicker_targetInput=null;function ColorPicker_writeDiv(){document.writeln('<DIV ID="colorPickerDiv" STYLE="position:absolute;visibility:hidden;"> </DIV>')}function ColorPicker_show(a){this.showPopup(a)}function ColorPicker_pickColor(a,b){b.hidePopup();pickColor(a)}function pickColor(a){if(ColorPicker_targetInput==null){alert("Target Input is null, which means you either didn't use the 'select' function or you have no defined your own 'pickColor' function to handle the picked color!");return}ColorPicker_targetInput.value=a}function ColorPicker_select(b,a){if(b.type!="text"&&b.type!="hidden"&&b.type!="textarea"){alert("colorpicker.select: Input object passed is not a valid form input object");window.ColorPicker_targetInput=null;return}window.ColorPicker_targetInput=b;this.show(a)}function ColorPicker_highlightColor(e){var a=(arguments.length>1)?arguments[1]:window.document;var b=a.getElementById("colorPickerSelectedColor");b.style.backgroundColor=e;b=a.getElementById("colorPickerSelectedColorValue");b.innerHTML=e}function ColorPicker(){var g=false;if(arguments.length==0){var e="colorPickerDiv"}else{if(arguments[0]=="window"){var e="";g=true}else{var e=arguments[0]}}if(e!=""){var m=new PopupWindow(e)}else{var m=new PopupWindow();m.setSize(225,250)}m.currentValue="#FFFFFF";m.writeDiv=ColorPicker_writeDiv;m.highlightColor=ColorPicker_highlightColor;m.show=ColorPicker_show;m.select=ColorPicker_select;var a=new Array("#4180B6","#69AEE7","#000000","#000033","#000066","#000099","#0000CC","#0000FF","#330000","#330033","#330066","#330099","#3300CC","#3300FF","#660000","#660033","#660066","#660099","#6600CC","#6600FF","#990000","#990033","#990066","#990099","#9900CC","#9900FF","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#7FFFFF","#7FFFFF","#7FF7F7","#7FEFEF","#7FE7E7","#7FDFDF","#7FD7D7","#7FCFCF","#7FC7C7","#7FBFBF","#7FB7B7","#7FAFAF","#7FA7A7","#7F9F9F","#7F9797","#7F8F8F","#7F8787","#7F7F7F","#7F7777","#7F6F6F","#7F6767","#7F5F5F","#7F5757","#7F4F4F","#7F4747","#7F3F3F","#7F3737","#7F2F2F","#7F2727","#7F1F1F","#7F1717","#7F0F0F","#7F0707","#7F0000","#4180B6","#69AEE7","#003300","#003333","#003366","#003399","#0033CC","#0033FF","#333300","#333333","#333366","#333399","#3333CC","#3333FF","#663300","#663333","#663366","#663399","#6633CC","#6633FF","#993300","#993333","#993366","#993399","#9933CC","#9933FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF7FFF","#FF7FFF","#F77FF7","#EF7FEF","#E77FE7","#DF7FDF","#D77FD7","#CF7FCF","#C77FC7","#BF7FBF","#B77FB7","#AF7FAF","#A77FA7","#9F7F9F","#977F97","#8F7F8F","#877F87","#7F7F7F","#777F77","#6F7F6F","#677F67","#5F7F5F","#577F57","#4F7F4F","#477F47","#3F7F3F","#377F37","#2F7F2F","#277F27","#1F7F1F","#177F17","#0F7F0F","#077F07","#007F00","#4180B6","#69AEE7","#006600","#006633","#006666","#006699","#0066CC","#0066FF","#336600","#336633","#336666","#336699","#3366CC","#3366FF","#666600","#666633","#666666","#666699","#6666CC","#6666FF","#996600","#996633","#996666","#996699","#9966CC","#9966FF","#CC6600","#CC6633","#CC6666","#CC6699","#CC66CC","#CC66FF","#FF6600","#FF6633","#FF6666","#FF6699","#FF66CC","#FF66FF","#FFFF7F","#FFFF7F","#F7F77F","#EFEF7F","#E7E77F","#DFDF7F","#D7D77F","#CFCF7F","#C7C77F","#BFBF7F","#B7B77F","#AFAF7F","#A7A77F","#9F9F7F","#97977F","#8F8F7F","#87877F","#7F7F7F","#77777F","#6F6F7F","#67677F","#5F5F7F","#57577F","#4F4F7F","#47477F","#3F3F7F","#37377F","#2F2F7F","#27277F","#1F1F7F","#17177F","#0F0F7F","#07077F","#00007F","#4180B6","#69AEE7","#009900","#009933","#009966","#009999","#0099CC","#0099FF","#339900","#339933","#339966","#339999","#3399CC","#3399FF","#669900","#669933","#669966","#669999","#6699CC","#6699FF","#999900","#999933","#999966","#999999","#9999CC","#9999FF","#CC9900","#CC9933","#CC9966","#CC9999","#CC99CC","#CC99FF","#FF9900","#FF9933","#FF9966","#FF9999","#FF99CC","#FF99FF","#3FFFFF","#3FFFFF","#3FF7F7","#3FEFEF","#3FE7E7","#3FDFDF","#3FD7D7","#3FCFCF","#3FC7C7","#3FBFBF","#3FB7B7","#3FAFAF","#3FA7A7","#3F9F9F","#3F9797","#3F8F8F","#3F8787","#3F7F7F","#3F7777","#3F6F6F","#3F6767","#3F5F5F","#3F5757","#3F4F4F","#3F4747","#3F3F3F","#3F3737","#3F2F2F","#3F2727","#3F1F1F","#3F1717","#3F0F0F","#3F0707","#3F0000","#4180B6","#69AEE7","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#66CC00","#66CC33","#66CC66","#66CC99","#66CCCC","#66CCFF","#99CC00","#99CC33","#99CC66","#99CC99","#99CCCC","#99CCFF","#CCCC00","#CCCC33","#CCCC66","#CCCC99","#CCCCCC","#CCCCFF","#FFCC00","#FFCC33","#FFCC66","#FFCC99","#FFCCCC","#FFCCFF","#FF3FFF","#FF3FFF","#F73FF7","#EF3FEF","#E73FE7","#DF3FDF","#D73FD7","#CF3FCF","#C73FC7","#BF3FBF","#B73FB7","#AF3FAF","#A73FA7","#9F3F9F","#973F97","#8F3F8F","#873F87","#7F3F7F","#773F77","#6F3F6F","#673F67","#5F3F5F","#573F57","#4F3F4F","#473F47","#3F3F3F","#373F37","#2F3F2F","#273F27","#1F3F1F","#173F17","#0F3F0F","#073F07","#003F00","#4180B6","#69AEE7","#00FF00","#00FF33","#00FF66","#00FF99","#00FFCC","#00FFFF","#33FF00","#33FF33","#33FF66","#33FF99","#33FFCC","#33FFFF","#66FF00","#66FF33","#66FF66","#66FF99","#66FFCC","#66FFFF","#99FF00","#99FF33","#99FF66","#99FF99","#99FFCC","#99FFFF","#CCFF00","#CCFF33","#CCFF66","#CCFF99","#CCFFCC","#CCFFFF","#FFFF00","#FFFF33","#FFFF66","#FFFF99","#FFFFCC","#FFFFFF","#FFFF3F","#FFFF3F","#F7F73F","#EFEF3F","#E7E73F","#DFDF3F","#D7D73F","#CFCF3F","#C7C73F","#BFBF3F","#B7B73F","#AFAF3F","#A7A73F","#9F9F3F","#97973F","#8F8F3F","#87873F","#7F7F3F","#77773F","#6F6F3F","#67673F","#5F5F3F","#57573F","#4F4F3F","#47473F","#3F3F3F","#37373F","#2F2F3F","#27273F","#1F1F3F","#17173F","#0F0F3F","#07073F","#00003F","#4180B6","#69AEE7","#FFFFFF","#FFEEEE","#FFDDDD","#FFCCCC","#FFBBBB","#FFAAAA","#FF9999","#FF8888","#FF7777","#FF6666","#FF5555","#FF4444","#FF3333","#FF2222","#FF1111","#FF0000","#FF0000","#FF0000","#FF0000","#EE0000","#DD0000","#CC0000","#BB0000","#AA0000","#990000","#880000","#770000","#660000","#550000","#440000","#330000","#220000","#110000","#000000","#000000","#000000","#000000","#001111","#002222","#003333","#004444","#005555","#006666","#007777","#008888","#009999","#00AAAA","#00BBBB","#00CCCC","#00DDDD","#00EEEE","#00FFFF","#00FFFF","#00FFFF","#00FFFF","#11FFFF","#22FFFF","#33FFFF","#44FFFF","#55FFFF","#66FFFF","#77FFFF","#88FFFF","#99FFFF","#AAFFFF","#BBFFFF","#CCFFFF","#DDFFFF","#EEFFFF","#FFFFFF","#4180B6","#69AEE7","#FFFFFF","#EEFFEE","#DDFFDD","#CCFFCC","#BBFFBB","#AAFFAA","#99FF99","#88FF88","#77FF77","#66FF66","#55FF55","#44FF44","#33FF33","#22FF22","#11FF11","#00FF00","#00FF00","#00FF00","#00FF00","#00EE00","#00DD00","#00CC00","#00BB00","#00AA00","#009900","#008800","#007700","#006600","#005500","#004400","#003300","#002200","#001100","#000000","#000000","#000000","#000000","#110011","#220022","#330033","#440044","#550055","#660066","#770077","#880088","#990099","#AA00AA","#BB00BB","#CC00CC","#DD00DD","#EE00EE","#FF00FF","#FF00FF","#FF00FF","#FF00FF","#FF11FF","#FF22FF","#FF33FF","#FF44FF","#FF55FF","#FF66FF","#FF77FF","#FF88FF","#FF99FF","#FFAAFF","#FFBBFF","#FFCCFF","#FFDDFF","#FFEEFF","#FFFFFF","#4180B6","#69AEE7","#FFFFFF","#EEEEFF","#DDDDFF","#CCCCFF","#BBBBFF","#AAAAFF","#9999FF","#8888FF","#7777FF","#6666FF","#5555FF","#4444FF","#3333FF","#2222FF","#1111FF","#0000FF","#0000FF","#0000FF","#0000FF","#0000EE","#0000DD","#0000CC","#0000BB","#0000AA","#000099","#000088","#000077","#000066","#000055","#000044","#000033","#000022","#000011","#000000","#000000","#000000","#000000","#111100","#222200","#333300","#444400","#555500","#666600","#777700","#888800","#999900","#AAAA00","#BBBB00","#CCCC00","#DDDD00","#EEEE00","#FFFF00","#FFFF00","#FFFF00","#FFFF00","#FFFF11","#FFFF22","#FFFF33","#FFFF44","#FFFF55","#FFFF66","#FFFF77","#FFFF88","#FFFF99","#FFFFAA","#FFFFBB","#FFFFCC","#FFFFDD","#FFFFEE","#FFFFFF","#4180B6","#69AEE7","#FFFFFF","#FFFFFF","#FBFBFB","#F7F7F7","#F3F3F3","#EFEFEF","#EBEBEB","#E7E7E7","#E3E3E3","#DFDFDF","#DBDBDB","#D7D7D7","#D3D3D3","#CFCFCF","#CBCBCB","#C7C7C7","#C3C3C3","#BFBFBF","#BBBBBB","#B7B7B7","#B3B3B3","#AFAFAF","#ABABAB","#A7A7A7","#A3A3A3","#9F9F9F","#9B9B9B","#979797","#939393","#8F8F8F","#8B8B8B","#878787","#838383","#7F7F7F","#7B7B7B","#777777","#737373","#6F6F6F","#6B6B6B","#676767","#636363","#5F5F5F","#5B5B5B","#575757","#535353","#4F4F4F","#4B4B4B","#474747","#434343","#3F3F3F","#3B3B3B","#373737","#333333","#2F2F2F","#2B2B2B","#272727","#232323","#1F1F1F","#1B1B1B","#171717","#131313","#0F0F0F","#0B0B0B","#070707","#030303","#000000","#000000","#000000","#000000","#000000");var n=a.length;var c=72;var k="";var j=(g)?"window.opener.":"";if(g){k+="<html><head><title>Select Color</title></head>";k+="<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0><span style='text-align: center;'>"}k+="<table style='border: none;' cellspacing=0 cellpadding=0>";var l=(document.getElementById||document.all)?true:false;for(var h=0;h<n;h++){if((h%c)==0){k+="<tr>"}if(l){var f='onMouseOver="'+j+"ColorPicker_highlightColor('"+a[h]+"',window.document)\""}else{f=""}k+='<td style="background-color: '+a[h]+';"><a href="javascript:void()" onclick="'+j+"ColorPicker_pickColor('"+a[h]+"',"+j+"window.popupWindowObjects["+m.index+']);return false;" '+f+"> </a></td>";if(((h+1)>=n)||(((h+1)%c)==0)){k+="</tr>"}}if(document.getElementById){var d=Math.floor(c/2);var b=c=d;k+="<tr><td colspan='"+d+"' style='background-color: #FFF;' ID='colorPickerSelectedColor'> </td><td colspan='"+b+"' style='text-align: center;' id='colorPickerSelectedColorValue'>#FFFFFF</td></tr>"}k+="</table>";if(g){k+="</span></body></html>"}m.populate(k+"\n");m.offsetY=25;m.autoHide();return m}; -
trunk/wp-includes/js/comment-reply.js
r10169 r10291 1 2 addComment = { 3 moveForm : function(commId, parentId, respondId, postId) { 4 var t = this, div, comm = t.I(commId), respond = t.I(respondId), cancel = t.I('cancel-comment-reply-link'), parent = t.I('comment_parent'), post = t.I('comment_post_ID'); 5 6 if ( ! comm || ! respond || ! cancel || ! parent ) 7 return; 8 9 t.respondId = respondId; 10 postId = postId || false; 11 12 if ( ! t.I('wp-temp-form-div') ) { 13 div = document.createElement('div'); 14 div.id = 'wp-temp-form-div'; 15 div.style.display = 'none'; 16 respond.parentNode.insertBefore(div, respond); 17 } 18 19 comm.parentNode.insertBefore(respond, comm.nextSibling); 20 if ( post && postId ) 21 post.value = postId; 22 parent.value = parentId; 23 cancel.style.display = ''; 24 25 cancel.onclick = function() { 26 var t = addComment, temp = t.I('wp-temp-form-div'), respond = t.I(t.respondId); 27 28 if ( ! temp || ! respond ) 29 return; 30 31 t.I('comment_parent').value = '0'; 32 temp.parentNode.insertBefore(respond, temp); 33 temp.parentNode.removeChild(temp); 34 this.style.display = 'none'; 35 this.onclick = null; 36 return false; 37 } 38 39 try { t.I('comment').focus(); } 40 catch(e) {} 41 42 return false; 43 }, 44 45 I : function(e) { 46 return document.getElementById(e); 47 } 48 } 1 addComment={moveForm:function(d,f,i,c){var m=this,a,h=m.I(d),b=m.I(i),l=m.I("cancel-comment-reply-link"),j=m.I("comment_parent"),k=m.I("comment_post_ID");if(!h||!b||!l||!j){return}m.respondId=i;c=c||false;if(!m.I("wp-temp-form-div")){a=document.createElement("div");a.id="wp-temp-form-div";a.style.display="none";b.parentNode.insertBefore(a,b)}h.parentNode.insertBefore(b,h.nextSibling);if(k&&c){k.value=c}j.value=f;l.style.display="";l.onclick=function(){var n=addComment,e=n.I("wp-temp-form-div"),o=n.I(n.respondId);if(!e||!o){return}n.I("comment_parent").value="0";e.parentNode.insertBefore(o,e);e.parentNode.removeChild(e);this.style.display="none";this.onclick=null;return false};try{m.I("comment").focus()}catch(g){}return false},I:function(a){return document.getElementById(a)}}; -
trunk/wp-includes/js/hoverIntent.js
r9578 r10291 1 /** 2 * hoverIntent is similar to jQuery's built-in "hover" function except that 3 * instead of firing the onMouseOver event immediately, hoverIntent checks 4 * to see if the user's mouse has slowed down (beneath the sensitivity 5 * threshold) before firing the onMouseOver event. 6 * 7 * hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+ 8 * <http://cherne.net/brian/resources/jquery.hoverIntent.html> 9 * 10 * hoverIntent is currently available for use in all personal or commercial 11 * projects under both MIT and GPL licenses. This means that you can choose 12 * the license that best suits your project, and use it accordingly. 13 * 14 * // basic usage (just like .hover) receives onMouseOver and onMouseOut functions 15 * $("ul li").hoverIntent( showNav , hideNav ); 16 * 17 * // advanced usage receives configuration object only 18 * $("ul li").hoverIntent({ 19 * sensitivity: 7, // number = sensitivity threshold (must be 1 or higher) 20 * interval: 100, // number = milliseconds of polling interval 21 * over: showNav, // function = onMouseOver callback (required) 22 * timeout: 0, // number = milliseconds delay before onMouseOut function call 23 * out: hideNav // function = onMouseOut callback (required) 24 * }); 25 * 26 * @param f onMouseOver function || An object with configuration options 27 * @param g onMouseOut function || Nothing (use configuration options object) 28 * @author Brian Cherne <brian@cherne.net> 29 */ 30 (function($) { 31 $.fn.hoverIntent = function(f,g) { 32 // default configuration options 33 var cfg = { 34 sensitivity: 7, 35 interval: 100, 36 timeout: 0 37 }; 38 // override configuration options with user supplied object 39 cfg = $.extend(cfg, g ? { over: f, out: g } : f ); 40 41 // instantiate variables 42 // cX, cY = current X and Y position of mouse, updated by mousemove event 43 // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval 44 var cX, cY, pX, pY; 45 46 // A private function for getting mouse position 47 var track = function(ev) { 48 cX = ev.pageX; 49 cY = ev.pageY; 50 }; 51 52 // A private function for comparing current and previous mouse position 53 var compare = function(ev,ob) { 54 ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); 55 // compare mouse positions to see if they've crossed the threshold 56 if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) { 57 $(ob).unbind("mousemove",track); 58 // set hoverIntent state to true (so mouseOut can be called) 59 ob.hoverIntent_s = 1; 60 return cfg.over.apply(ob,[ev]); 61 } else { 62 // set previous coordinates for next time 63 pX = cX; pY = cY; 64 // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs) 65 ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval ); 66 } 67 }; 68 69 // A private function for delaying the mouseOut function 70 var delay = function(ev,ob) { 71 ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); 72 ob.hoverIntent_s = 0; 73 return cfg.out.apply(ob,[ev]); 74 }; 75 76 // workaround for Mozilla bug: not firing mouseout/mouseleave on absolute positioned elements over textareas and input type="text" 77 var handleHover = function(e) { 78 var t = this; 79 80 // next two lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut 81 var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget; 82 while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } } 83 if ( p == this ) { 84 if ( $.browser.mozilla ) { 85 if ( e.type == "mouseout" ) { 86 t.mtout = setTimeout( function(){doHover(e,t);}, 30 ); 87 } else { 88 if (t.mtout) { t.mtout = clearTimeout(t.mtout); } 89 } 90 } 91 return; 92 } else { 93 if (t.mtout) { t.mtout = clearTimeout(t.mtout); } 94 doHover(e,t); 95 } 96 }; 97 98 // A private function for handling mouse 'hovering' 99 var doHover = function(e,ob) { 100 101 // copy objects to be passed into t (required for event object to be passed in IE) 102 var ev = jQuery.extend({},e); 103 104 // cancel hoverIntent timer if it exists 105 if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); } 106 107 // else e.type == "onmouseover" 108 if (e.type == "mouseover") { 109 // set "previous" X and Y position based on initial entry point 110 pX = ev.pageX; pY = ev.pageY; 111 // update "current" X and Y position based on mousemove 112 $(ob).bind("mousemove",track); 113 // start polling interval (self-calling timeout) to compare mouse coordinates over time 114 if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );} 115 116 // else e.type == "onmouseout" 117 } else { 118 // unbind expensive mousemove event 119 $(ob).unbind("mousemove",track); 120 // if hoverIntent state is true, then call the mouseOut function after the specified delay 121 if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );} 122 } 123 }; 124 125 // bind the function to the two event listeners 126 return this.mouseover(handleHover).mouseout(handleHover); 127 }; 128 })(jQuery); 1 (function(a){a.fn.hoverIntent=function(l,j){var m={sensitivity:7,interval:100,timeout:0};m=a.extend(m,j?{over:l,out:j}:l);var o,n,h,d;var e=function(f){o=f.pageX;n=f.pageY};var c=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-o)+Math.abs(d-n))<m.sensitivity){a(f).unbind("mousemove",e);f.hoverIntent_s=1;return m.over.apply(f,[g])}else{h=o;d=n;f.hoverIntent_t=setTimeout(function(){c(g,f)},m.interval)}};var i=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return m.out.apply(f,[g])};var b=function(q){var f=this;var g=(q.type=="mouseover"?q.fromElement:q.toElement)||q.relatedTarget;while(g&&g!=this){try{g=g.parentNode}catch(q){g=this}}if(g==this){if(a.browser.mozilla){if(q.type=="mouseout"){f.mtout=setTimeout(function(){k(q,f)},30)}else{if(f.mtout){f.mtout=clearTimeout(f.mtout)}}}return}else{if(f.mtout){f.mtout=clearTimeout(f.mtout)}k(q,f)}};var k=function(p,f){var g=jQuery.extend({},p);if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(p.type=="mouseover"){h=g.pageX;d=g.pageY;a(f).bind("mousemove",e);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){c(g,f)},m.interval)}}else{a(f).unbind("mousemove",e);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){i(g,f)},m.timeout)}}};return this.mouseover(b).mouseout(b)}})(jQuery); -
trunk/wp-includes/js/jquery/jquery.color.js
r7131 r10291 1 /* 2 * jQuery Color Animations 3 * Copyright 2007 John Resig 4 * Released under the MIT and GPL licenses. 5 */ 6 7 (function(jQuery){ 8 9 // We override the animation for all of these color styles 10 jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){ 11 jQuery.fx.step[attr] = function(fx){ 12 if ( fx.state == 0 ) { 13 fx.start = getColor( fx.elem, attr ); 14 fx.end = getRGB( fx.end ); 15 } 16 17 fx.elem.style[attr] = "rgb(" + [ 18 Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0), 19 Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0), 20 Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0) 21 ].join(",") + ")"; 22 } 23 }); 24 25 // Color Conversion functions from highlightFade 26 // By Blair Mitchelmore 27 // http://jquery.offput.ca/highlightFade/ 28 29 // Parse strings looking for color tuples [255,255,255] 30 function getRGB(color) { 31 var result; 32 33 // Check if we're already dealing with an array of colors 34 if ( color && color.constructor == Array && color.length == 3 ) 35 return color; 36 37 // Look for rgb(num,num,num) 38 if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) 39 return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])]; 40 41 // Look for rgb(num%,num%,num%) 42 if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) 43 return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; 44 45 // Look for #a0b1c2 46 if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) 47 return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; 48 49 // Look for #fff 50 if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) 51 return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; 52 53 // Look for rgba(0, 0, 0, 0) == transparent in Safari 3 54 if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) 55 return colors['transparent'] 56 57 // Otherwise, we're most likely dealing with a named color 58 return colors[jQuery.trim(color).toLowerCase()]; 59 } 60 61 function getColor(elem, attr) { 62 var color; 63 64 do { 65 color = jQuery.curCSS(elem, attr); 66 67 // Keep going until we find an element that has color, or we hit the body 68 if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") ) 69 break; 70 71 attr = "backgroundColor"; 72 } while ( elem = elem.parentNode ); 73 74 return getRGB(color); 75 }; 76 77 // Some named colors to work with 78 // From Interface by Stefan Petre 79 // http://interface.eyecon.ro/ 80 81 var colors = { 82 aqua:[0,255,255], 83 azure:[240,255,255], 84 beige:[245,245,220], 85 black:[0,0,0], 86 blue:[0,0,255], 87 brown:[165,42,42], 88 cyan:[0,255,255], 89 darkblue:[0,0,139], 90 darkcyan:[0,139,139], 91 darkgrey:[169,169,169], 92 darkgreen:[0,100,0], 93 darkkhaki:[189,183,107], 94 darkmagenta:[139,0,139], 95 darkolivegreen:[85,107,47], 96 darkorange:[255,140,0], 97 darkorchid:[153,50,204], 98 darkred:[139,0,0], 99 darksalmon:[233,150,122], 100 darkviolet:[148,0,211], 101 fuchsia:[255,0,255], 102 gold:[255,215,0], 103 green:[0,128,0], 104 indigo:[75,0,130], 105 khaki:[240,230,140], 106 lightblue:[173,216,230], 107 lightcyan:[224,255,255], 108 lightgreen:[144,238,144], 109 lightgrey:[211,211,211], 110 lightpink:[255,182,193], 111 lightyellow:[255,255,224], 112 lime:[0,255,0], 113 magenta:[255,0,255], 114 maroon:[128,0,0], 115 navy:[0,0,128], 116 olive:[128,128,0], 117 orange:[255,165,0], 118 pink:[255,192,203], 119 purple:[128,0,128], 120 violet:[128,0,128], 121 red:[255,0,0], 122 silver:[192,192,192], 123 white:[255,255,255], 124 yellow:[255,255,0], 125 transparent: [255,255,255] 126 }; 127 128 })(jQuery); 1 (function(d){d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(f,e){d.fx.step[e]=function(g){if(g.state==0){g.start=c(g.elem,e);g.end=b(g.end)}g.elem.style[e]="rgb("+[Math.max(Math.min(parseInt((g.pos*(g.end[0]-g.start[0]))+g.start[0]),255),0),Math.max(Math.min(parseInt((g.pos*(g.end[1]-g.start[1]))+g.start[1]),255),0),Math.max(Math.min(parseInt((g.pos*(g.end[2]-g.start[2]))+g.start[2]),255),0)].join(",")+")"}});function b(f){var e;if(f&&f.constructor==Array&&f.length==3){return f}if(e=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(f)){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}if(e=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(f)){return[parseFloat(e[1])*2.55,parseFloat(e[2])*2.55,parseFloat(e[3])*2.55]}if(e=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(f)){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}if(e=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(f)){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}if(e=/rgba\(0, 0, 0, 0\)/.exec(f)){return a.transparent}return a[d.trim(f).toLowerCase()]}function c(g,e){var f;do{f=d.curCSS(g,e);if(f!=""&&f!="transparent"||d.nodeName(g,"body")){break}e="backgroundColor"}while(g=g.parentNode);return b(f)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]}})(jQuery); -
trunk/wp-includes/js/jquery/jquery.form.js
r7131 r10291 1 /* 2 * jQuery Form Plugin 3 * version: 2.02 (12/16/2007) 4 * @requires jQuery v1.1 or later 5 * 6 * Examples at: http://malsup.com/jquery/form/ 7 * Dual licensed under the MIT and GPL licenses: 8 * http://www.opensource.org/licenses/mit-license.php 9 * http://www.gnu.org/licenses/gpl.html 10 * 11 * Revision: $Id$ 12 */ 13 (function($) { 14 /** 15 * ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX. 16 * 17 * ajaxSubmit accepts a single argument which can be either a success callback function 18 * or an options Object. If a function is provided it will be invoked upon successful 19 * completion of the submit and will be passed the response from the server. 20 * If an options Object is provided, the following attributes are supported: 21 * 22 * target: Identifies the element(s) in the page to be updated with the server response. 23 * This value may be specified as a jQuery selection string, a jQuery object, 24 * or a DOM element. 25 * default value: null 26 * 27 * url: URL to which the form data will be submitted. 28 * default value: value of form's 'action' attribute 29 * 30 * type: The method in which the form data should be submitted, 'GET' or 'POST'. 31 * default value: value of form's 'method' attribute (or 'GET' if none found) 32 * 33 * data: Additional data to add to the request, specified as key/value pairs (see $.ajax). 34 * 35 * beforeSubmit: Callback method to be invoked before the form is submitted. 36 * default value: null 37 * 38 * success: Callback method to be invoked after the form has been successfully submitted 39 * and the response has been returned from the server 40 * default value: null 41 * 42 * dataType: Expected dataType of the response. One of: null, 'xml', 'script', or 'json' 43 * default value: null 44 * 45 * semantic: Boolean flag indicating whether data must be submitted in semantic order (slower). 46 * default value: false 47 * 48 * resetForm: Boolean flag indicating whether the form should be reset if the submit is successful 49 * 50 * clearForm: Boolean flag indicating whether the form should be cleared if the submit is successful 51 * 52 * 53 * The 'beforeSubmit' callback can be provided as a hook for running pre-submit logic or for 54 * validating the form data. If the 'beforeSubmit' callback returns false then the form will 55 * not be submitted. The 'beforeSubmit' callback is invoked with three arguments: the form data 56 * in array format, the jQuery object, and the options object passed into ajaxSubmit. 57 * The form data array takes the following form: 58 * 59 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ] 60 * 61 * If a 'success' callback method is provided it is invoked after the response has been returned 62 * from the server. It is passed the responseText or responseXML value (depending on dataType). 63 * See jQuery.ajax for further details. 64 * 65 * 66 * The dataType option provides a means for specifying how the server response should be handled. 67 * This maps directly to the jQuery.httpData method. The following values are supported: 68 * 69 * 'xml': if dataType == 'xml' the server response is treated as XML and the 'success' 70 * callback method, if specified, will be passed the responseXML value 71 * 'json': if dataType == 'json' the server response will be evaluted and passed to 72 * the 'success' callback, if specified 73 * 'script': if dataType == 'script' the server response is evaluated in the global context 74 * 75 * 76 * Note that it does not make sense to use both the 'target' and 'dataType' options. If both 77 * are provided the target will be ignored. 78 * 79 * The semantic argument can be used to force form serialization in semantic order. 80 * This is normally true anyway, unless the form contains input elements of type='image'. 81 * If your form must be submitted with name/value pairs in semantic order and your form 82 * contains an input of type='image" then pass true for this arg, otherwise pass false 83 * (or nothing) to avoid the overhead for this logic. 84 * 85 * 86 * When used on its own, ajaxSubmit() is typically bound to a form's submit event like this: 87 * 88 * $("#form-id").submit(function() { 89 * $(this).ajaxSubmit(options); 90 * return false; // cancel conventional submit 91 * }); 92 * 93 * When using ajaxForm(), however, this is done for you. 94 * 95 * @example 96 * $('#myForm').ajaxSubmit(function(data) { 97 * alert('Form submit succeeded! Server returned: ' + data); 98 * }); 99 * @desc Submit form and alert server response 100 * 101 * 102 * @example 103 * var options = { 104 * target: '#myTargetDiv' 105 * }; 106 * $('#myForm').ajaxSubmit(options); 107 * @desc Submit form and update page element with server response 108 * 109 * 110 * @example 111 * var options = { 112 * success: function(responseText) { 113 * alert(responseText); 114 * } 115 * }; 116 * $('#myForm').ajaxSubmit(options); 117 * @desc Submit form and alert the server response 118 * 119 * 120 * @example 121 * var options = { 122 * beforeSubmit: function(formArray, jqForm) { 123 * if (formArray.length == 0) { 124 * alert('Please enter data.'); 125 * return false; 126 * } 127 * } 128 * }; 129 * $('#myForm').ajaxSubmit(options); 130 * @desc Pre-submit validation which aborts the submit operation if form data is empty 131 * 132 * 133 * @example 134 * var options = { 135 * url: myJsonUrl.php, 136 * dataType: 'json', 137 * success: function(data) { 138 * // 'data' is an object representing the the evaluated json data 139 * } 140 * }; 141 * $('#myForm').ajaxSubmit(options); 142 * @desc json data returned and evaluated 143 * 144 * 145 * @example 146 * var options = { 147 * url: myXmlUrl.php, 148 * dataType: 'xml', 149 * success: function(responseXML) { 150 * // responseXML is XML document object 151 * var data = $('myElement', responseXML).text(); 152 * } 153 * }; 154 * $('#myForm').ajaxSubmit(options); 155 * @desc XML data returned from server 156 * 157 * 158 * @example 159 * var options = { 160 * resetForm: true 161 * }; 162 * $('#myForm').ajaxSubmit(options); 163 * @desc submit form and reset it if successful 164 * 165 * @example 166 * $('#myForm).submit(function() { 167 * $(this).ajaxSubmit(); 168 * return false; 169 * }); 170 * @desc Bind form's submit event to use ajaxSubmit 171 * 172 * 173 * @name ajaxSubmit 174 * @type jQuery 175 * @param options object literal containing options which control the form submission process 176 * @cat Plugins/Form 177 * @return jQuery 178 */ 179 $.fn.ajaxSubmit = function(options) { 180 if (typeof options == 'function') 181 options = { success: options }; 182 183 options = $.extend({ 184 url: this.attr('action') || window.location.toString(), 185 type: this.attr('method') || 'GET' 186 }, options || {}); 187 188 // hook for manipulating the form data before it is extracted; 189 // convenient for use with rich editors like tinyMCE or FCKEditor 190 var veto = {}; 191 $.event.trigger('form.pre.serialize', [this, options, veto]); 192 if (veto.veto) return this; 193 194 var a = this.formToArray(options.semantic); 195 if (options.data) { 196 for (var n in options.data) 197 a.push( { name: n, value: options.data[n] } ); 198 } 199 200 // give pre-submit callback an opportunity to abort the submit 201 if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return this; 202 203 // fire vetoable 'validate' event 204 $.event.trigger('form.submit.validate', [a, this, options, veto]); 205 if (veto.veto) return this; 206 207 var q = $.param(a);//.replace(/%20/g,'+'); 208 209 if (options.type.toUpperCase() == 'GET') { 210 options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; 211 options.data = null; // data is null for 'get' 212 } 213 else 214 options.data = q; // data is the query string for 'post' 215 216 var $form = this, callbacks = []; 217 if (options.resetForm) callbacks.push(function() { $form.resetForm(); }); 218 if (options.clearForm) callbacks.push(function() { $form.clearForm(); }); 219 220 // perform a load on the target only if dataType is not provided 221 if (!options.dataType && options.target) { 222 var oldSuccess = options.success || function(){}; 223 callbacks.push(function(data) { 224 if (this.evalScripts) 225 $(options.target).attr("innerHTML", data).evalScripts().each(oldSuccess, arguments); 226 else // jQuery v1.1.4 227 $(options.target).html(data).each(oldSuccess, arguments); 228 }); 229 } 230 else if (options.success) 231 callbacks.push(options.success); 232 233 options.success = function(data, status) { 234 for (var i=0, max=callbacks.length; i < max; i++) 235 callbacks[i](data, status, $form); 236 }; 237 238 // are there files to upload? 239 var files = $('input:file', this).fieldValue(); 240 var found = false; 241 for (var j=0; j < files.length; j++) 242 if (files[j]) 243 found = true; 244 245 // options.iframe allows user to force iframe mode 246 if (options.iframe || found) { 247 // hack to fix Safari hang (thanks to Tim Molendijk for this) 248 // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d 249 if ($.browser.safari && options.closeKeepAlive) 250 $.get(options.closeKeepAlive, fileUpload); 251 else 252 fileUpload(); 253 } 254 else 255 $.ajax(options); 256 257 // fire 'notify' event 258 $.event.trigger('form.submit.notify', [this, options]); 259 return this; 260 261 262 // private function for handling file uploads (hat tip to YAHOO!) 263 function fileUpload() { 264 var form = $form[0]; 265 var opts = $.extend({}, $.ajaxSettings, options); 266 267 var id = 'jqFormIO' + $.fn.ajaxSubmit.counter++; 268 var $io = $('<iframe id="' + id + '" name="' + id + '" />'); 269 var io = $io[0]; 270 var op8 = $.browser.opera && window.opera.version() < 9; 271 if ($.browser.msie || op8) io.src = 'javascript:false;document.write("");'; 272 $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' }); 273 274 var xhr = { // mock object 275 responseText: null, 276 responseXML: null, 277 status: 0, 278 statusText: 'n/a', 279 getAllResponseHeaders: function() {}, 280 getResponseHeader: function() {}, 281 setRequestHeader: function() {} 282 }; 283 284 var g = opts.global; 285 // trigger ajax global events so that activity/block indicators work like normal 286 if (g && ! $.active++) $.event.trigger("ajaxStart"); 287 if (g) $.event.trigger("ajaxSend", [xhr, opts]); 288 289 var cbInvoked = 0; 290 var timedOut = 0; 291 292 // take a breath so that pending repaints get some cpu time before the upload starts 293 setTimeout(function() { 294 // make sure form attrs are set 295 var encAttr = form.encoding ? 'encoding' : 'enctype'; 296 var t = $form.attr('target'); 297 $form.attr({ 298 target: id, 299 method: 'POST', 300 action: opts.url 301 }); 302 form[encAttr] = 'multipart/form-data'; 303 304 // support timout 305 if (opts.timeout) 306 setTimeout(function() { timedOut = true; cb(); }, opts.timeout); 307 308 // add iframe to doc and submit the form 309 $io.appendTo('body'); 310 io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false); 311 form.submit(); 312 $form.attr('target', t); // reset target 313 }, 10); 314 315 function cb() { 316 if (cbInvoked++) return; 317 318 io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false); 319 320 var ok = true; 321 try { 322 if (timedOut) throw 'timeout'; 323 // extract the server response from the iframe 324 var data, doc; 325 doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document; 326 xhr.responseText = doc.body ? doc.body.innerHTML : null; 327 xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc; 328 329 if (opts.dataType == 'json' || opts.dataType == 'script') { 330 var ta = doc.getElementsByTagName('textarea')[0]; 331 data = ta ? ta.value : xhr.responseText; 332 if (opts.dataType == 'json') 333 eval("data = " + data); 334 else 335 $.globalEval(data); 336 } 337 else if (opts.dataType == 'xml') { 338 data = xhr.responseXML; 339 if (!data && xhr.responseText != null) 340 data = toXml(xhr.responseText); 341 } 342 else { 343 data = xhr.responseText; 344 } 345 } 346 catch(e){ 347 ok = false; 348 $.handleError(opts, xhr, 'error', e); 349 } 350 351 // ordering of these callbacks/triggers is odd, but that's how $.ajax does it 352 if (ok) { 353 opts.success(data, 'success'); 354 if (g) $.event.trigger("ajaxSuccess", [xhr, opts]); 355 } 356 if (g) $.event.trigger("ajaxComplete", [xhr, opts]); 357 if (g && ! --$.active) $.event.trigger("ajaxStop"); 358 if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error'); 359 360 // clean up 361 setTimeout(function() { 362 $io.remove(); 363 xhr.responseXML = null; 364 }, 100); 365 }; 366 367 function toXml(s, doc) { 368 if (window.ActiveXObject) { 369 doc = new ActiveXObject('Microsoft.XMLDOM'); 370 doc.async = 'false'; 371 doc.loadXML(s); 372 } 373 else 374 doc = (new DOMParser()).parseFromString(s, 'text/xml'); 375 return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null; 376 }; 377 }; 378 }; 379 $.fn.ajaxSubmit.counter = 0; // used to create unique iframe ids 380 381 /** 382 * ajaxForm() provides a mechanism for fully automating form submission. 383 * 384 * The advantages of using this method instead of ajaxSubmit() are: 385 * 386 * 1: This method will include coordinates for <input type="image" /> elements (if the element 387 * is used to submit the form). 388 * 2. This method will include the submit element's name/value data (for the element that was 389 * used to submit the form). 390 * 3. This method binds the submit() method to the form for you. 391 * 392 * Note that for accurate x/y coordinates of image submit elements in all browsers 393 * you need to also use the "dimensions" plugin (this method will auto-detect its presence). 394 * 395 * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely 396 * passes the options argument along after properly binding events for submit elements and 397 * the form itself. See ajaxSubmit for a full description of the options argument. 398 * 399 * 400 * @example 401 * var options = { 402 * target: '#myTargetDiv' 403 * }; 404 * $('#myForm').ajaxSForm(options); 405 * @desc Bind form's submit event so that 'myTargetDiv' is updated with the server response 406 * when the form is submitted. 407 * 408 * 409 * @example 410 * var options = { 411 * success: function(responseText) { 412 * alert(responseText); 413 * } 414 * }; 415 * $('#myForm').ajaxSubmit(options); 416 * @desc Bind form's submit event so that server response is alerted after the form is submitted. 417 * 418 * 419 * @example 420 * var options = { 421 * beforeSubmit: function(formArray, jqForm) { 422 * if (formArray.length == 0) { 423 * alert('Please enter data.'); 424 * return false; 425 * } 426 * } 427 * }; 428 * $('#myForm').ajaxSubmit(options); 429 * @desc Bind form's submit event so that pre-submit callback is invoked before the form 430 * is submitted. 431 * 432 * 433 * @name ajaxForm 434 * @param options object literal containing options which control the form submission process 435 * @return jQuery 436 * @cat Plugins/Form 437 * @type jQuery 438 */ 439 $.fn.ajaxForm = function(options) { 440 return this.ajaxFormUnbind().submit(submitHandler).each(function() { 441 // store options in hash 442 this.formPluginId = $.fn.ajaxForm.counter++; 443 $.fn.ajaxForm.optionHash[this.formPluginId] = options; 444 $(":submit,input:image", this).click(clickHandler); 445 }); 446 }; 447 448 $.fn.ajaxForm.counter = 1; 449 $.fn.ajaxForm.optionHash = {}; 450 451 function clickHandler(e) { 452 var $form = this.form; 453 $form.clk = this; 454 if (this.type == 'image') { 455 if (e.offsetX != undefined) { 456 $form.clk_x = e.offsetX; 457 $form.clk_y = e.offsetY; 458 } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin 459 var offset = $(this).offset(); 460 $form.clk_x = e.pageX - offset.left; 461 $form.clk_y = e.pageY - offset.top; 462 } else { 463 $form.clk_x = e.pageX - this.offsetLeft; 464 $form.clk_y = e.pageY - this.offsetTop; 465 } 466 } 467 // clear form vars 468 setTimeout(function() { $form.clk = $form.clk_x = $form.clk_y = null; }, 10); 469 }; 470 471 function submitHandler() { 472 // retrieve options from hash 473 var id = this.formPluginId; 474 var options = $.fn.ajaxForm.optionHash[id]; 475 $(this).ajaxSubmit(options); 476 return false; 477 }; 478 479 /** 480 * ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm 481 * 482 * @name ajaxFormUnbind 483 * @return jQuery 484 * @cat Plugins/Form 485 * @type jQuery 486 */ 487 $.fn.ajaxFormUnbind = function() { 488 this.unbind('submit', submitHandler); 489 return this.each(function() { 490 $(":submit,input:image", this).unbind('click', clickHandler); 491 }); 492 493 }; 494 495 /** 496 * formToArray() gathers form element data into an array of objects that can 497 * be passed to any of the following ajax functions: $.get, $.post, or load. 498 * Each object in the array has both a 'name' and 'value' property. An example of 499 * an array for a simple login form might be: 500 * 501 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ] 502 * 503 * It is this array that is passed to pre-submit callback functions provided to the 504 * ajaxSubmit() and ajaxForm() methods. 505 * 506 * The semantic argument can be used to force form serialization in semantic order. 507 * This is normally true anyway, unless the form contains input elements of type='image'. 508 * If your form must be submitted with name/value pairs in semantic order and your form 509 * contains an input of type='image" then pass true for this arg, otherwise pass false 510 * (or nothing) to avoid the overhead for this logic. 511 * 512 * @example var data = $("#myForm").formToArray(); 513 * $.post( "myscript.cgi", data ); 514 * @desc Collect all the data from a form and submit it to the server. 515 * 516 * @name formToArray 517 * @param semantic true if serialization must maintain strict semantic ordering of elements (slower) 518 * @type Array<Object> 519 * @cat Plugins/Form 520 */ 521 $.fn.formToArray = function(semantic) { 522 var a = []; 523 if (this.length == 0) return a; 524 525 var form = this[0]; 526 var els = semantic ? form.getElementsByTagName('*') : form.elements; 527 if (!els) return a; 528 for(var i=0, max=els.length; i < max; i++) { 529 var el = els[i]; 530 var n = el.name; 531 if (!n) continue; 532 533 if (semantic && form.clk && el.type == "image") { 534 // handle image inputs on the fly when semantic == true 535 if(!el.disabled && form.clk == el) 536 a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); 537 continue; 538 } 539 540 var v = $.fieldValue(el, true); 541 if (v && v.constructor == Array) { 542 for(var j=0, jmax=v.length; j < jmax; j++) 543 a.push({name: n, value: v[j]}); 544 } 545 else if (v !== null && typeof v != 'undefined') 546 a.push({name: n, value: v}); 547 } 548 549 if (!semantic && form.clk) { 550 // input type=='image' are not found in elements array! handle them here 551 var inputs = form.getElementsByTagName("input"); 552 for(var i=0, max=inputs.length; i < max; i++) { 553 var input = inputs[i]; 554 var n = input.name; 555 if(n && !input.disabled && input.type == "image" && form.clk == input) 556 a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); 557 } 558 } 559 return a; 560 }; 561 562 563 /** 564 * Serializes form data into a 'submittable' string. This method will return a string 565 * in the format: name1=value1&name2=value2 566 * 567 * The semantic argument can be used to force form serialization in semantic order. 568 * If your form must be submitted with name/value pairs in semantic order then pass 569 * true for this arg, otherwise pass false (or nothing) to avoid the overhead for 570 * this logic (which can be significant for very large forms). 571 * 572 * @example var data = $("#myForm").formSerialize(); 573 * $.ajax('POST', "myscript.cgi", data); 574 * @desc Collect all the data from a form into a single string 575 * 576 * @name formSerialize 577 * @param semantic true if serialization must maintain strict semantic ordering of elements (slower) 578 * @type String 579 * @cat Plugins/Form 580 */ 581 $.fn.formSerialize = function(semantic) { 582 //hand off to jQuery.param for proper encoding 583 return $.param(this.formToArray(semantic)); 584 }; 585 586 587 /** 588 * Serializes all field elements in the jQuery object into a query string. 589 * This method will return a string in the format: name1=value1&name2=value2 590 * 591 * The successful argument controls whether or not serialization is limited to 592 * 'successful' controls (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). 593 * The default value of the successful argument is true. 594 * 595 * @example var data = $("input").formSerialize(); 596 * @desc Collect the data from all successful input elements into a query string 597 * 598 * @example var data = $(":radio").formSerialize(); 599 * @desc Collect the data from all successful radio input elements into a query string 600 * 601 * @example var data = $("#myForm :checkbox").formSerialize(); 602 * @desc Collect the data from all successful checkbox input elements in myForm into a query string 603 * 604 * @example var data = $("#myForm :checkbox").formSerialize(false); 605 * @desc Collect the data from all checkbox elements in myForm (even the unchecked ones) into a query string 606 * 607 * @example var data = $(":input").formSerialize(); 608 * @desc Collect the data from all successful input, select, textarea and button elements into a query string 609 * 610 * @name fieldSerialize 611 * @param successful true if only successful controls should be serialized (default is true) 612 * @type String 613 * @cat Plugins/Form 614 */ 615 $.fn.fieldSerialize = function(successful) { 616 var a = []; 617 this.each(function() { 618 var n = this.name; 619 if (!n) return; 620 var v = $.fieldValue(this, successful); 621 if (v && v.constructor == Array) { 622 for (var i=0,max=v.length; i < max; i++) 623 a.push({name: n, value: v[i]}); 624 } 625 else if (v !== null && typeof v != 'undefined') 626 a.push({name: this.name, value: v}); 627 }); 628 //hand off to jQuery.param for proper encoding 629 return $.param(a); 630 }; 631 632 633 /** 634 * Returns the value(s) of the element in the matched set. For example, consider the following form: 635 * 636 * <form><fieldset> 637 * <input name="A" type="text" /> 638 * <input name="A" type="text" /> 639 * <input name="B" type="checkbox" value="B1" /> 640 * <input name="B" type="checkbox" value="B2"/> 641 * <input name="C" type="radio" value="C1" /> 642 * <input name="C" type="radio" value="C2" /> 643 * </fieldset></form> 644 * 645 * var v = $(':text').fieldValue(); 646 * // if no values are entered into the text inputs 647 * v == ['',''] 648 * // if values entered into the text inputs are 'foo' and 'bar' 649 * v == ['foo','bar'] 650 * 651 * var v = $(':checkbox').fieldValue(); 652 * // if neither checkbox is checked 653 * v === undefined 654 * // if both checkboxes are checked 655 * v == ['B1', 'B2'] 656 * 657 * var v = $(':radio').fieldValue(); 658 * // if neither radio is checked 659 * v === undefined 660 * // if first radio is checked 661 * v == ['C1'] 662 * 663 * The successful argument controls whether or not the field element must be 'successful' 664 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). 665 * The default value of the successful argument is true. If this value is false the value(s) 666 * for each element is returned. 667 * 668 * Note: This method *always* returns an array. If no valid value can be determined the 669 * array will be empty, otherwise it will contain one or more values. 670 * 671 * @example var data = $("#myPasswordElement").fieldValue(); 672 * alert(data[0]); 673 * @desc Alerts the current value of the myPasswordElement element 674 * 675 * @example var data = $("#myForm :input").fieldValue(); 676 * @desc Get the value(s) of the form elements in myForm 677 * 678 * @example var data = $("#myForm :checkbox").fieldValue(); 679 * @desc Get the value(s) for the successful checkbox element(s) in the jQuery object. 680 * 681 * @example var data = $("#mySingleSelect").fieldValue(); 682 * @desc Get the value(s) of the select control 683 * 684 * @example var data = $(':text').fieldValue(); 685 * @desc Get the value(s) of the text input or textarea elements 686 * 687 * @example var data = $("#myMultiSelect").fieldValue(); 688 * @desc Get the values for the select-multiple control 689 * 690 * @name fieldValue 691 * @param Boolean successful true if only the values for successful controls should be returned (default is true) 692 * @type Array<String> 693 * @cat Plugins/Form 694 */ 695 $.fn.fieldValue = function(successful) { 696 for (var val=[], i=0, max=this.length; i < max; i++) { 697 var el = this[i]; 698 var v = $.fieldValue(el, successful); 699 if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) 700 continue; 701 v.constructor == Array ? $.merge(val, v) : val.push(v); 702 } 703 return val; 704 }; 705 706 /** 707 * Returns the value of the field element. 708 * 709 * The successful argument controls whether or not the field element must be 'successful' 710 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). 711 * The default value of the successful argument is true. If the given element is not 712 * successful and the successful arg is not false then the returned value will be null. 713 * 714 * Note: If the successful flag is true (default) but the element is not successful, the return will be null 715 * Note: The value returned for a successful select-multiple element will always be an array. 716 * Note: If the element has no value the return value will be undefined. 717 * 718 * @example var data = jQuery.fieldValue($("#myPasswordElement")[0]); 719 * @desc Gets the current value of the myPasswordElement element 720 * 721 * @name fieldValue 722 * @param Element el The DOM element for which the value will be returned 723 * @param Boolean successful true if value returned must be for a successful controls (default is true) 724 * @type String or Array<String> or null or undefined 725 * @cat Plugins/Form 726 */ 727 $.fieldValue = function(el, successful) { 728 var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); 729 if (typeof successful == 'undefined') successful = true; 730 731 if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || 732 (t == 'checkbox' || t == 'radio') && !el.checked || 733 (t == 'submit' || t == 'image') && el.form && el.form.clk != el || 734 tag == 'select' && el.selectedIndex == -1)) 735 return null; 736 737 if (tag == 'select') { 738 var index = el.selectedIndex; 739 if (index < 0) return null; 740 var a = [], ops = el.options; 741 var one = (t == 'select-one'); 742 var max = (one ? index+1 : ops.length); 743 for(var i=(one ? index : 0); i < max; i++) { 744 var op = ops[i]; 745 if (op.selected) { 746 // extra pain for IE... 747 var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value; 748 if (one) return v; 749 a.push(v); 750 } 751 } 752 return a; 753 } 754 return el.value; 755 }; 756 757 758 /** 759 * Clears the form data. Takes the following actions on the form's input fields: 760 * - input text fields will have their 'value' property set to the empty string 761 * - select elements will have their 'selectedIndex' property set to -1 762 * - checkbox and radio inputs will have their 'checked' property set to false 763 * - inputs of type submit, button, reset, and hidden will *not* be effected 764 * - button elements will *not* be effected 765 * 766 * @example $('form').clearForm(); 767 * @desc Clears all forms on the page. 768 * 769 * @name clearForm 770 * @type jQuery 771 * @cat Plugins/Form 772 */ 773 $.fn.clearForm = function() { 774 return this.each(function() { 775 $('input,select,textarea', this).clearFields(); 776 }); 777 }; 778 779 /** 780 * Clears the selected form elements. Takes the following actions on the matched elements: 781 * - input text fields will have their 'value' property set to the empty string 782 * - select elements will have their 'selectedIndex' property set to -1 783 * - checkbox and radio inputs will have their 'checked' property set to false 784 * - inputs of type submit, button, reset, and hidden will *not* be effected 785 * - button elements will *not* be effected 786 * 787 * @example $('.myInputs').clearFields(); 788 * @desc Clears all inputs with class myInputs 789 * 790 * @name clearFields 791 * @type jQuery 792 * @cat Plugins/Form 793 */ 794 $.fn.clearFields = $.fn.clearInputs = function() { 795 return this.each(function() { 796 var t = this.type, tag = this.tagName.toLowerCase(); 797 if (t == 'text' || t == 'password' || tag == 'textarea') 798 this.value = ''; 799 else if (t == 'checkbox' || t == 'radio') 800 this.checked = false; 801 else if (tag == 'select') 802 this.selectedIndex = -1; 803 }); 804 }; 805 806 807 /** 808 * Resets the form data. Causes all form elements to be reset to their original value. 809 * 810 * @example $('form').resetForm(); 811 * @desc Resets all forms on the page. 812 * 813 * @name resetForm 814 * @type jQuery 815 * @cat Plugins/Form 816 */ 817 $.fn.resetForm = function() { 818 return this.each(function() { 819 // guard against an input with the name of 'reset' 820 // note that IE reports the reset function as an 'object' 821 if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) 822 this.reset(); 823 }); 824 }; 825 826 827 /** 828 * Enables or disables any matching elements. 829 * 830 * @example $(':radio').enabled(false); 831 * @desc Disables all radio buttons 832 * 833 * @name select 834 * @type jQuery 835 * @cat Plugins/Form 836 */ 837 $.fn.enable = function(b) { 838 if (b == undefined) b = true; 839 return this.each(function() { 840 this.disabled = !b 841 }); 842 }; 843 844 /** 845 * Checks/unchecks any matching checkboxes or radio buttons and 846 * selects/deselects and matching option elements. 847 * 848 * @example $(':checkbox').selected(); 849 * @desc Checks all checkboxes 850 * 851 * @name select 852 * @type jQuery 853 * @cat Plugins/Form 854 */ 855 $.fn.select = function(select) { 856 if (select == undefined) select = true; 857 return this.each(function() { 858 var t = this.type; 859 if (t == 'checkbox' || t == 'radio') 860 this.checked = select; 861 else if (this.tagName.toLowerCase() == 'option') { 862 var $sel = $(this).parent('select'); 863 if (select && $sel[0] && $sel[0].type == 'select-one') { 864 // deselect all other options 865 $sel.find('option').select(false); 866 } 867 this.selected = select; 868 } 869 }); 870 }; 871 872 })(jQuery); 1 (function($){$.fn.ajaxSubmit=function(options){if(typeof options=="function"){options={success:options}}options=$.extend({url:this.attr("action")||window.location.toString(),type:this.attr("method")||"GET"},options||{});var veto={};$.event.trigger("form.pre.serialize",[this,options,veto]);if(veto.veto){return this}var a=this.formToArray(options.semantic);if(options.data){for(var n in options.data){a.push({name:n,value:options.data[n]})}}if(options.beforeSubmit&&options.beforeSubmit(a,this,options)===false){return this}$.event.trigger("form.submit.validate",[a,this,options,veto]);if(veto.veto){return this}var q=$.param(a);if(options.type.toUpperCase()=="GET"){options.url+=(options.url.indexOf("?")>=0?"&":"?")+q;options.data=null}else{options.data=q}var $form=this,callbacks=[];if(options.resetForm){callbacks.push(function(){$form.resetForm()})}if(options.clearForm){callbacks.push(function(){$form.clearForm()})}if(!options.dataType&&options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){if(this.evalScripts){$(options.target).attr("innerHTML",data).evalScripts().each(oldSuccess,arguments)}else{$(options.target).html(data).each(oldSuccess,arguments)}})}else{if(options.success){callbacks.push(options.success)}}options.success=function(data,status){for(var i=0,max=callbacks.length;i<max;i++){callbacks[i](data,status,$form)}};var files=$("input:file",this).fieldValue();var found=false;for(var j=0;j<files.length;j++){if(files[j]){found=true}}if(options.iframe||found){if($.browser.safari&&options.closeKeepAlive){$.get(options.closeKeepAlive,fileUpload)}else{fileUpload()}}else{$.ajax(options)}$.event.trigger("form.submit.notify",[this,options]);return this;function fileUpload(){var form=$form[0];var opts=$.extend({},$.ajaxSettings,options);var id="jqFormIO"+$.fn.ajaxSubmit.counter++;var $io=$('<iframe id="'+id+'" name="'+id+'" />');var io=$io[0];var op8=$.browser.opera&&window.opera.version()<9;if($.browser.msie||op8){io.src='javascript:false;document.write("");'}$io.css({position:"absolute",top:"-1000px",left:"-1000px"});var xhr={responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){}};var g=opts.global;if(g&&!$.active++){$.event.trigger("ajaxStart")}if(g){$.event.trigger("ajaxSend",[xhr,opts])}var cbInvoked=0;var timedOut=0;setTimeout(function(){var encAttr=form.encoding?"encoding":"enctype";var t=$form.attr("target");$form.attr({target:id,method:"POST",action:opts.url});form[encAttr]="multipart/form-data";if(opts.timeout){setTimeout(function(){timedOut=true;cb()},opts.timeout)}$io.appendTo("body");io.attachEvent?io.attachEvent("onload",cb):io.addEventListener("load",cb,false);form.submit();$form.attr("target",t)},10);function cb(){if(cbInvoked++){return}io.detachEvent?io.detachEvent("onload",cb):io.removeEventListener("load",cb,false);var ok=true;try{if(timedOut){throw"timeout"}var data,doc;doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;xhr.responseText=doc.body?doc.body.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;if(opts.dataType=="json"||opts.dataType=="script"){var ta=doc.getElementsByTagName("textarea")[0];data=ta?ta.value:xhr.responseText;if(opts.dataType=="json"){eval("data = "+data)}else{$.globalEval(data)}}else{if(opts.dataType=="xml"){data=xhr.responseXML;if(!data&&xhr.responseText!=null){data=toXml(xhr.responseText)}}else{data=xhr.responseText}}}catch(e){ok=false;$.handleError(opts,xhr,"error",e)}if(ok){opts.success(data,"success");if(g){$.event.trigger("ajaxSuccess",[xhr,opts])}}if(g){$.event.trigger("ajaxComplete",[xhr,opts])}if(g&&!--$.active){$.event.trigger("ajaxStop")}if(opts.complete){opts.complete(xhr,ok?"success":"error")}setTimeout(function(){$io.remove();xhr.responseXML=null},100)}function toXml(s,doc){if(window.ActiveXObject){doc=new ActiveXObject("Microsoft.XMLDOM");doc.async="false";doc.loadXML(s)}else{doc=(new DOMParser()).parseFromString(s,"text/xml")}return(doc&&doc.documentElement&&doc.documentElement.tagName!="parsererror")?doc:null}}};$.fn.ajaxSubmit.counter=0;$.fn.ajaxForm=function(options){return this.ajaxFormUnbind().submit(submitHandler).each(function(){this.formPluginId=$.fn.ajaxForm.counter++;$.fn.ajaxForm.optionHash[this.formPluginId]=options;$(":submit,input:image",this).click(clickHandler)})};$.fn.ajaxForm.counter=1;$.fn.ajaxForm.optionHash={};function clickHandler(e){var $form=this.form;$form.clk=this;if(this.type=="image"){if(e.offsetX!=undefined){$form.clk_x=e.offsetX;$form.clk_y=e.offsetY}else{if(typeof $.fn.offset=="function"){var offset=$(this).offset();$form.clk_x=e.pageX-offset.left;$form.clk_y=e.pageY-offset.top}else{$form.clk_x=e.pageX-this.offsetLeft;$form.clk_y=e.pageY-this.offsetTop}}}setTimeout(function(){$form.clk=$form.clk_x=$form.clk_y=null},10)}function submitHandler(){var id=this.formPluginId;var options=$.fn.ajaxForm.optionHash[id];$(this).ajaxSubmit(options);return false}$.fn.ajaxFormUnbind=function(){this.unbind("submit",submitHandler);return this.each(function(){$(":submit,input:image",this).unbind("click",clickHandler)})};$.fn.formToArray=function(semantic){var a=[];if(this.length==0){return a}var form=this[0];var els=semantic?form.getElementsByTagName("*"):form.elements;if(!els){return a}for(var i=0,max=els.length;i<max;i++){var el=els[i];var n=el.name;if(!n){continue}if(semantic&&form.clk&&el.type=="image"){if(!el.disabled&&form.clk==el){a.push({name:n+".x",value:form.clk_x},{name:n+".y",value:form.clk_y})}continue}var v=$.fieldValue(el,true);if(v&&v.constructor==Array){for(var j=0,jmax=v.length;j<jmax;j++){a.push({name:n,value:v[j]})}}else{if(v!==null&&typeof v!="undefined"){a.push({name:n,value:v})}}}if(!semantic&&form.clk){var inputs=form.getElementsByTagName("input");for(var i=0,max=inputs.length;i<max;i++){var input=inputs[i];var n=input.name;if(n&&!input.disabled&&input.type=="image"&&form.clk==input){a.push({name:n+".x",value:form.clk_x},{name:n+".y",value:form.clk_y})}}}return a};$.fn.formSerialize=function(semantic){return $.param(this.formToArray(semantic))};$.fn.fieldSerialize=function(successful){var a=[];this.each(function(){var n=this.name;if(!n){return}var v=$.fieldValue(this,successful);if(v&&v.constructor==Array){for(var i=0,max=v.length;i<max;i++){a.push({name:n,value:v[i]})}}else{if(v!==null&&typeof v!="undefined"){a.push({name:this.name,value:v})}}});return $.param(a)};$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;i<max;i++){var el=this[i];var v=$.fieldValue(el,successful);if(v===null||typeof v=="undefined"||(v.constructor==Array&&!v.length)){continue}v.constructor==Array?$.merge(val,v):val.push(v)}return val};$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(typeof successful=="undefined"){successful=true}if(successful&&(!n||el.disabled||t=="reset"||t=="button"||(t=="checkbox"||t=="radio")&&!el.checked||(t=="submit"||t=="image")&&el.form&&el.form.clk!=el||tag=="select"&&el.selectedIndex==-1)){return null}if(tag=="select"){var index=el.selectedIndex;if(index<0){return null}var a=[],ops=el.options;var one=(t=="select-one");var max=(one?index+1:ops.length);for(var i=(one?index:0);i<max;i++){var op=ops[i];if(op.selected){var v=$.browser.msie&&!(op.attributes.value.specified)?op.text:op.value;if(one){return v}a.push(v)}}return a}return el.value};$.fn.clearForm=function(){return this.each(function(){$("input,select,textarea",this).clearFields()})};$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();if(t=="text"||t=="password"||tag=="textarea"){this.value=""}else{if(t=="checkbox"||t=="radio"){this.checked=false}else{if(tag=="select"){this.selectedIndex=-1}}}})};$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};$.fn.enable=function(b){if(b==undefined){b=true}return this.each(function(){this.disabled=!b})};$.fn.select=function(select){if(select==undefined){select=true}return this.each(function(){var t=this.type;if(t=="checkbox"||t=="radio"){this.checked=select}else{if(this.tagName.toLowerCase()=="option"){var $sel=$(this).parent("select");if(select&&$sel[0]&&$sel[0].type=="select-one"){$sel.find("option").select(false)}this.selected=select}}})}})(jQuery); -
trunk/wp-includes/js/jquery/jquery.hotkeys.js
r8778 r10291 1 /****************************************************************************************************************************** 2 3 * @ Original idea by by Binny V A, Original version: 2.00.A 4 * @ http://www.openjs.com/scripts/events/keyboard_shortcuts/ 5 * @ Original License : BSD 6 7 * @ jQuery Plugin by Tzury Bar Yochay 8 mail: tzury.by@gmail.com 9 blog: evalinux.wordpress.com 10 face: facebook.com/profile.php?id=513676303 11 12 (c) Copyrights 2007 13 14 * @ jQuery Plugin version Beta (0.0.2) 15 * @ License: jQuery-License. 16 17 TODO: 18 add queue support (as in gmail) e.g. 'x' then 'y', etc. 19 add mouse + mouse wheel events. 20 21 USAGE: 22 $.hotkeys.add('Ctrl+c', function(){ alert('copy anyone?');}); 23 $.hotkeys.add('Ctrl+c', {target:'div#editor', type:'keyup', propagate: true},function(){ alert('copy anyone?');});> 24 $.hotkeys.remove('Ctrl+c'); 25 $.hotkeys.remove('Ctrl+c', {target:'div#editor', type:'keypress'}); 26 27 ******************************************************************************************************************************/ 28 (function (jQuery){ 29 this.version = '(beta)(0.0.3)'; 30 this.all = {}; 31 this.special_keys = { 32 27: 'esc', 9: 'tab', 32:'space', 13: 'return', 8:'backspace', 145: 'scroll', 20: 'capslock', 33 144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del',35:'end', 33: 'pageup', 34 34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down', 112:'f1',113:'f2', 114:'f3', 35 115:'f4', 116:'f5', 117:'f6', 118:'f7', 119:'f8', 120:'f9', 121:'f10', 122:'f11', 123:'f12'}; 36 37 this.shift_nums = { "`":"~", "1":"!", "2":"@", "3":"#", "4":"$", "5":"%", "6":"^", "7":"&", 38 "8":"*", "9":"(", "0":")", "-":"_", "=":"+", ";":":", "'":"\"", ",":"<", 39 ".":">", "/":"?", "\\":"|" }; 40 41 this.add = function(combi, options, callback) { 42 if (jQuery.isFunction(options)){ 43 callback = options; 44 options = {}; 45 } 46 var opt = {}, 47 defaults = {type: 'keydown', propagate: false, disableInInput: false, target: jQuery('html')[0]}, 48 that = this; 49 opt = jQuery.extend( opt , defaults, options || {} ); 50 combi = combi.toLowerCase(); 51 52 // inspect if keystroke matches 53 var inspector = function(event) { 54 event = jQuery.event.fix(event); // jQuery event normalization. 55 var element = event.target; 56 // @ TextNode -> nodeType == 3 57 element = (element.nodeType==3) ? element.parentNode : element; 58 59 if(opt['disableInInput']) { // Disable shortcut keys in Input, Textarea fields 60 var target = jQuery(element); 61 if( target.is("input") || target.is("textarea")){ 62 return; 63 } 64 } 65 var code = event.which, 66 type = event.type, 67 character = String.fromCharCode(code).toLowerCase(), 68 special = that.special_keys[code], 69 shift = event.shiftKey, 70 ctrl = event.ctrlKey, 71 alt= event.altKey, 72 meta = event.metaKey, 73 propagate = true, // default behaivour 74 mapPoint = null; 75 76 // in opera + safari, the event.target is unpredictable. 77 // for example: 'keydown' might be associated with HtmlBodyElement 78 // or the element where you last clicked with your mouse. 79 if (jQuery.browser.opera || jQuery.browser.safari){ 80 while (!that.all[element] && element.parentNode){ 81 element = element.parentNode; 82 } 83 } 84 var cbMap = that.all[element].events[type].callbackMap; 85 if(!shift && !ctrl && !alt && !meta) { // No Modifiers 86 mapPoint = cbMap[special] || cbMap[character] 87 } 88 // deals with combinaitons (alt|ctrl|shift+anything) 89 else{ 90 var modif = ''; 91 if(alt) modif +='alt+'; 92 if(ctrl) modif+= 'ctrl+'; 93 if(shift) modif += 'shift+'; 94 if(meta) modif += 'meta+'; 95 // modifiers + special keys or modifiers + characters or modifiers + shift characters 96 mapPoint = cbMap[modif+special] || cbMap[modif+character] || cbMap[modif+that.shift_nums[character]] 97 } 98 if (mapPoint){ 99 mapPoint.cb(event); 100 if(!mapPoint.propagate) { 101 event.stopPropagation(); 102 event.preventDefault(); 103 return false; 104 } 105 } 106 }; 107 // first hook for this element 108 if (!this.all[opt.target]){ 109 this.all[opt.target] = {events:{}}; 110 } 111 if (!this.all[opt.target].events[opt.type]){ 112 this.all[opt.target].events[opt.type] = {callbackMap: {}} 113 jQuery.event.add(opt.target, opt.type, inspector); 114 } 115 this.all[opt.target].events[opt.type].callbackMap[combi] = {cb: callback, propagate:opt.propagate}; 116 return jQuery; 117 }; 118 this.remove = function(exp, opt) { 119 opt = opt || {}; 120 target = opt.target || jQuery('html')[0]; 121 type = opt.type || 'keydown'; 122 exp = exp.toLowerCase(); 123 delete this.all[target].events[type].callbackMap[exp] 124 return jQuery; 125 }; 126 jQuery.hotkeys = this; 127 return jQuery; 128 })(jQuery); 1 (function(a){this.version="(beta)(0.0.3)";this.all={};this.special_keys={27:"esc",9:"tab",32:"space",13:"return",8:"backspace",145:"scroll",20:"capslock",144:"numlock",19:"pause",45:"insert",36:"home",46:"del",35:"end",33:"pageup",34:"pagedown",37:"left",38:"up",39:"right",40:"down",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12"};this.shift_nums={"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"};this.add=function(c,b,h){if(a.isFunction(b)){h=b;b={}}var d={},f={type:"keydown",propagate:false,disableInInput:false,target:a("html")[0]},e=this;d=a.extend(d,f,b||{});c=c.toLowerCase();var g=function(j){j=a.event.fix(j);var o=j.target;o=(o.nodeType==3)?o.parentNode:o;if(d.disableInInput){var s=a(o);if(s.is("input")||s.is("textarea")){return}}var l=j.which,u=j.type,r=String.fromCharCode(l).toLowerCase(),t=e.special_keys[l],m=j.shiftKey,i=j.ctrlKey,p=j.altKey,w=j.metaKey,q=true,k=null;if(a.browser.opera||a.browser.safari){while(!e.all[o]&&o.parentNode){o=o.parentNode}}var v=e.all[o].events[u].callbackMap;if(!m&&!i&&!p&&!w){k=v[t]||v[r]}else{var n="";if(p){n+="alt+"}if(i){n+="ctrl+"}if(m){n+="shift+"}if(w){n+="meta+"}k=v[n+t]||v[n+r]||v[n+e.shift_nums[r]]}if(k){k.cb(j);if(!k.propagate){j.stopPropagation();j.preventDefault();return false}}};if(!this.all[d.target]){this.all[d.target]={events:{}}}if(!this.all[d.target].events[d.type]){this.all[d.target].events[d.type]={callbackMap:{}};a.event.add(d.target,d.type,g)}this.all[d.target].events[d.type].callbackMap[c]={cb:h,propagate:d.propagate};return a};this.remove=function(c,b){b=b||{};target=b.target||a("html")[0];type=b.type||"keydown";c=c.toLowerCase();delete this.all[target].events[type].callbackMap[c];return a};a.hotkeys=this;return a})(jQuery); -
trunk/wp-includes/js/jquery/jquery.js
r8046 r10291 6 6 * and GPL (GPL-LICENSE.txt) licenses. 7 7 * 8 * $Date: 2008-05-2 7 12:17:26 -0700 (Tue, 27May 2008) $9 * $Rev: 5 700$8 * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $ 9 * $Rev: 5685 $ 10 10 */ 11 eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(H(){J w=1c.4I,3n$=1c.$;J D=1c.4I=1c.$=H(a,b){I 2r D.18.5i(a,b)};J u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/,61=/^.[^:#\\[\\.]*$/,12;D.18=D.3V={5i:H(d,b){d=d||S;G(d.15){7[0]=d;7.K=1;I 7}G(1j d=="1W"){J c=u.2D(d);G(c&&(c[1]||!b)){G(c[1])d=D.4h([c[1]],b);N{J a=S.60(c[3]);G(a){G(a.2t!=c[3])I D().2u(d);I D(a)}d=[]}}N I D(b).2u(d)}N G(D.1F(d))I D(S)[D.18.25?"25":"3Y"](d);I 7.6V(D.2h(d))},5w:"1.2.6",8H:H(){I 7.K},K:0,3p:H(a){I a==12?D.2h(7):7[a]},2F:H(b){J a=D(b);a.5n=7;I a},6V:H(a){7.K=0;2q.3V.1A.1t(7,a);I 7},P:H(a,b){I D.P(7,a,b)},5h:H(b){J a=-1;I D.2E(b&&b.5w?b[0]:b,7)},1M:H(c,a,b){J d=c;G(c.1q==56)G(a===12)I 7[0]&&D[b||"1M"](7[0],c);N{d={};d[c]=a}I 7.P(H(i){R(c 1k d)D.1M(b?7.V:7,c,D.1e(7,d[c],b,i,c))})},1h:H(b,a){G((b==\'2d\'||b==\'1T\')&&3e(a)<0)a=12;I 7.1M(b,a,"24")},1r:H(b){G(1j b!="3y"&&b!=U)I 7.4F().3s((7[0]&&7[0].2z||S).5J(b));J a="";D.P(b||7,H(){D.P(7.3u,H(){G(7.15!=8)a+=7.15!=1?7.73:D.18.1r([7])})});I a},5W:H(b){G(7[0])D(b,7[0].2z).5y().38(7[0]).2i(H(){J a=7;1G(a.1s)a=a.1s;I a}).3s(7);I 7},8Z:H(a){I 7.P(H(){D(7).6P().5W(a)})},8S:H(a){I 7.P(H(){D(7).5W(a)})},3s:H(){I 7.3S(1a,M,Q,H(a){G(7.15==1)7.49(a)})},6E:H(){I 7.3S(1a,M,M,H(a){G(7.15==1)7.38(a,7.1s)})},6D:H(){I 7.3S(1a,Q,Q,H(a){7.1f.38(a,7)})},5p:H(){I 7.3S(1a,Q,M,H(a){7.1f.38(a,7.2J)})},3m:H(){I 7.5n||D([])},2u:H(b){J c=D.2i(7,H(a){I D.2u(b,a)});I 7.2F(/[^+>] [^+>]/.11(b)||b.1i("..")>-1?D.4u(c):c)},5y:H(e){J f=7.2i(H(){G(D.14.1g&&!D.4o(7)){J a=7.6n(M),5f=S.3t("1w");5f.49(a);I D.4h([5f.4l])[0]}N I 7.6n(M)});J d=f.2u("*").5M().P(H(){G(7[E]!=12)7[E]=U});G(e===M)7.2u("*").5M().P(H(i){G(7.15==3)I;J c=D.L(7,"3x");R(J a 1k c)R(J b 1k c[a])D.W.17(d[i],a,c[a][b],c[a][b].L)});I f},1E:H(b){I 7.2F(D.1F(b)&&D.3G(7,H(a,i){I b.1l(a,i)})||D.3f(b,7))},4W:H(b){G(b.1q==56)G(61.11(b))I 7.2F(D.3f(b,7,M));N b=D.3f(b,7);J a=b.K&&b[b.K-1]!==12&&!b.15;I 7.1E(H(){I a?D.2E(7,b)<0:7!=b})},17:H(a){I 7.2F(D.4u(D.39(7.3p(),1j a==\'1W\'?D(a):D.2h(a))))},3C:H(a){I!!a&&D.3f(a,7).K>0},7V:H(a){I 7.3C("."+a)},6a:H(b){G(b==12){G(7.K){J c=7[0];G(D.Y(c,"2y")){J e=c.63,62=[],16=c.16,2Y=c.O=="2y-2Y";G(e<0)I U;R(J i=2Y?e:0,2e=2Y?e+1:16.K;i<2e;i++){J d=16[i];G(d.3a){b=D.14.1g&&!d.au.2s.aq?d.1r:d.2s;G(2Y)I b;62.1A(b)}}I 62}N I(7[0].2s||"").1o(/\\r/g,"")}I 12}G(b.1q==4N)b+=\'\';I 7.P(H(){G(7.15!=1)I;G(b.1q==2q&&/5R|5A/.11(7.O))7.4M=(D.2E(7.2s,b)>=0||D.2E(7.32,b)>=0);N G(D.Y(7,"2y")){J a=D.2h(b);D("9U",7).P(H(){7.3a=(D.2E(7.2s,a)>=0||D.2E(7.1r,a)>=0)});G(!a.K)7.63=-1}N 7.2s=b})},2I:H(a){I a==12?(7[0]?7[0].4l:U):7.4F().3s(a)},7b:H(a){I 7.5p(a).1Z()},77:H(i){I 7.3w(i,i+1)},3w:H(){I 7.2F(2q.3V.3w.1t(7,1a))},2i:H(b){I 7.2F(D.2i(7,H(a,i){I b.1l(a,i,a)}))},5M:H(){I 7.17(7.5n)},L:H(d,b){J a=d.1Q(".");a[1]=a[1]?"."+a[1]:"";G(b===12){J c=7.5G("9B"+a[1]+"!",[a[0]]);G(c===12&&7.K)c=D.L(7[0],d);I c===12&&a[1]?7.L(a[0]):c}N I 7.1R("9v"+a[1]+"!",[a[0],b]).P(H(){D.L(7,d,b)})},3b:H(a){I 7.P(H(){D.3b(7,a)})},3S:H(g,f,h,d){J e=7.K>1,3z;I 7.P(H(){G(!3z){3z=D.4h(g,7.2z);G(h)3z.9o()}J b=7;G(f&&D.Y(7,"1X")&&D.Y(3z[0],"4H"))b=7.40("22")[0]||7.49(7.2z.3t("22"));J c=D([]);D.P(3z,H(){J a=e?D(7).5y(M)[0]:7;G(D.Y(a,"1m"))c=c.17(a);N{G(a.15==1)c=c.17(D("1m",a).1Z());d.1l(b,a)}});c.P(6R)})}};D.18.5i.3V=D.18;H 6R(i,a){G(a.4e)D.3T({1b:a.4e,31:Q,1L:"1m"});N D.5u(a.1r||a.6N||a.4l||"");G(a.1f)a.1f.30(a)}H 1x(){I+2r 8K}D.1n=D.18.1n=H(){J b=1a[0]||{},i=1,K=1a.K,4B=Q,16;G(b.1q==8I){4B=b;b=1a[1]||{};i=2}G(1j b!="3y"&&1j b!="H")b={};G(K==i){b=7;--i}R(;i<K;i++)G((16=1a[i])!=U)R(J c 1k 16){J a=b[c],2x=16[c];G(b===2x)6L;G(4B&&2x&&1j 2x=="3y"&&!2x.15)b[c]=D.1n(4B,a||(2x.K!=U?[]:{}),2x);N G(2x!==12)b[c]=2x}I b};J E="4I"+1x(),6K=0,5q={},6G=/z-?5h|8B-?8A|1y|6A|8w-?1T/i,3N=S.3N||{};D.1n({8u:H(a){1c.$=3n$;G(a)1c.4I=w;I D},1F:H(a){I!!a&&1j a!="1W"&&!a.Y&&a.1q!=2q&&/^[\\s[]?H/.11(a+"")},4o:H(a){I a.1B&&!a.1d||a.2g&&a.2z&&!a.2z.1d},5u:H(a){a=D.3l(a);G(a){J b=S.40("6v")[0]||S.1B,1m=S.3t("1m");1m.O="1r/4v";G(D.14.1g)1m.1r=a;N 1m.49(S.5J(a));b.38(1m,b.1s);b.30(1m)}},Y:H(b,a){I b.Y&&b.Y.2m()==a.2m()},1Y:{},L:H(c,d,b){c=c==1c?5q:c;J a=c[E];G(!a)a=c[E]=++6K;G(d&&!D.1Y[a])D.1Y[a]={};G(b!==12)D.1Y[a][d]=b;I d?D.1Y[a][d]:a},3b:H(c,b){c=c==1c?5q:c;J a=c[E];G(b){G(D.1Y[a]){3d D.1Y[a][b];b="";R(b 1k D.1Y[a])1V;G(!b)D.3b(c)}}N{23{3d c[E]}21(e){G(c.5k)c.5k(E)}3d D.1Y[a]}},P:H(d,a,c){J e,i=0,K=d.K;G(c){G(K==12){R(e 1k d)G(a.1t(d[e],c)===Q)1V}N R(;i<K;)G(a.1t(d[i++],c)===Q)1V}N{G(K==12){R(e 1k d)G(a.1l(d[e],e,d[e])===Q)1V}N R(J b=d[0];i<K&&a.1l(b,i,b)!==Q;b=d[++i]){}}I d},1e:H(b,a,c,i,d){G(D.1F(a))a=a.1l(b,i);I a&&a.1q==4N&&c=="24"&&!6G.11(d)?a+"2U":a},1D:{17:H(c,b){D.P((b||"").1Q(/\\s+/),H(i,a){G(c.15==1&&!D.1D.3Q(c.1D,a))c.1D+=(c.1D?" ":"")+a})},1Z:H(c,b){G(c.15==1)c.1D=b!=12?D.3G(c.1D.1Q(/\\s+/),H(a){I!D.1D.3Q(b,a)}).6r(" "):""},3Q:H(b,a){I D.2E(a,(b.1D||b).6p().1Q(/\\s+/))>-1}},6o:H(b,c,a){J e={};R(J d 1k c){e[d]=b.V[d];b.V[d]=c[d]}a.1l(b);R(J d 1k c)b.V[d]=e[d]},1h:H(d,e,c){G(e=="2d"||e=="1T"){J b,2L={3c:"5g",5D:"1C",19:"3H"},2S=e=="2d"?["5d","6i"]:["5b","6g"];H 5a(){b=e=="2d"?d.8g:d.8f;J a=0,2A=0;D.P(2S,H(){a+=3e(D.24(d,"55"+7,M))||0;2A+=3e(D.24(d,"2A"+7+"47",M))||0});b-=26.85(a+2A)}G(D(d).3C(":4i"))5a();N D.6o(d,2L,5a);I 26.2e(0,b)}I D.24(d,e,c)},24:H(f,l,k){J e,V=f.V;H 4d(b){G(!D.14.2f)I Q;J a=3N.53(b,U);I!a||a.52("4d")==""}G(l=="1y"&&D.14.1g){e=D.1M(V,"1y");I e==""?"1":e}G(D.14.2H&&l=="19"){J d=V.50;V.50="0 7Z 7Y";V.50=d}G(l.1I(/4g/i))l=y;G(!k&&V&&V[l])e=V[l];N G(3N.53){G(l.1I(/4g/i))l="4g";l=l.1o(/([A-Z])/g,"-$1").3h();J c=3N.53(f,U);G(c&&!4d(f))e=c.52(l);N{J g=[],2G=[],a=f,i=0;R(;a&&4d(a);a=a.1f)2G.6b(a);R(;i<2G.K;i++)G(4d(2G[i])){g[i]=2G[i].V.19;2G[i].V.19="3H"}e=l=="19"&&g[2G.K-1]!=U?"2P":(c&&c.52(l))||"";R(i=0;i<g.K;i++)G(g[i]!=U)2G[i].V.19=g[i]}G(l=="1y"&&e=="")e="1"}N G(f.4f){J h=l.1o(/\\-(\\w)/g,H(a,b){I b.2m()});e=f.4f[l]||f.4f[h];G(!/^\\d+(2U)?$/i.11(e)&&/^\\d/.11(e)){J j=V.1z,65=f.64.1z;f.64.1z=f.4f.1z;V.1z=e||0;e=V.aO+"2U";V.1z=j;f.64.1z=65}}I e},4h:H(l,h){J k=[];h=h||S;G(1j h.3t==\'12\')h=h.2z||h[0]&&h[0].2z||S;D.P(l,H(i,d){G(!d)I;G(d.1q==4N)d+=\'\';G(1j d=="1W"){d=d.1o(/(<(\\w+)[^>]*?)\\/>/g,H(b,a,c){I c.1I(/^(aN|43|7E|aH|4t|7z|aE|3A|aB|aA|az)$/i)?b:a+"></"+c+">"});J f=D.3l(d).3h(),1w=h.3t("1w");J e=!f.1i("<av")&&[1,"<2y 7u=\'7u\'>","</2y>"]||!f.1i("<at")&&[1,"<7t>","</7t>"]||f.1I(/^<(ar|22|ap|al|aj)/)&&[1,"<1X>","</1X>"]||!f.1i("<4H")&&[2,"<1X><22>","</22></1X>"]||(!f.1i("<ah")||!f.1i("<ae"))&&[3,"<1X><22><4H>","</4H></22></1X>"]||!f.1i("<7E")&&[2,"<1X><22></22><7p>","</7p></1X>"]||D.14.1g&&[1,"1w<1w>","</1w>"]||[0,"",""];1w.4l=e[1]+d+e[2];1G(e[0]--)1w=1w.5U;G(D.14.1g){J g=!f.1i("<1X")&&f.1i("<22")<0?1w.1s&&1w.1s.3u:e[1]=="<1X>"&&f.1i("<22")<0?1w.3u:[];R(J j=g.K-1;j>=0;--j)G(D.Y(g[j],"22")&&!g[j].3u.K)g[j].1f.30(g[j]);G(/^\\s/.11(d))1w.38(h.5J(d.1I(/^\\s*/)[0]),1w.1s)}d=D.2h(1w.3u)}G(d.K===0&&(!D.Y(d,"45")&&!D.Y(d,"2y")))I;G(d[0]==12||D.Y(d,"45")||d.16)k.1A(d);N k=D.39(k,d)});I k},1M:H(d,f,c){G(!d||d.15==3||d.15==8)I 12;J e=!D.4o(d),3W=c!==12,1g=D.14.1g;f=e&&D.2L[f]||f;G(d.2g){J g=/5x|4e|V/.11(f);G(f=="3a"&&D.14.2f)d.1f.63;G(f 1k d&&e&&!g){G(3W){G(f=="O"&&D.Y(d,"4t")&&d.1f)7m"O a5 a2\'t 9Z 9W";d[f]=c}G(D.Y(d,"45")&&d.7i(f))I d.7i(f).73;I d[f]}G(1g&&e&&f=="V")I D.1M(d.V,"9V",c);G(3W)d.9T(f,""+c);J h=1g&&e&&g?d.4K(f,2):d.4K(f);I h===U?12:h}G(1g&&f=="1y"){G(3W){d.6A=1;d.1E=(d.1E||"").1o(/7d\\([^)]*\\)/,"")+(3v(c)+\'\'=="9P"?"":"7d(1y="+c*79+")")}I d.1E&&d.1E.1i("1y=")>=0?(3e(d.1E.1I(/1y=([^)]*)/)[1])/79)+\'\':""}f=f.1o(/-([a-z])/9M,H(a,b){I b.2m()});G(3W)d[f]=c;I d[f]},3l:H(a){I(a||"").1o(/^\\s+|\\s+$/g,"")},2h:H(b){J a=[];G(b!=U){J i=b.K;G(i==U||b.1Q||b.4L||b.1l)a[0]=b;N 1G(i)a[--i]=b[i]}I a},2E:H(b,a){R(J i=0,K=a.K;i<K;i++)G(a[i]===b)I i;I-1},39:H(a,b){J i=0,T,36=a.K;G(D.14.1g){1G(T=b[i++])G(T.15!=8)a[36++]=T}N 1G(T=b[i++])a[36++]=T;I a},4u:H(a){J c=[],2w={};23{R(J i=0,K=a.K;i<K;i++){J b=D.L(a[i]);G(!2w[b]){2w[b]=M;c.1A(a[i])}}}21(e){c=a}I c},3G:H(c,a,d){J b=[];R(J i=0,K=c.K;i<K;i++)G(!d!=!a(c[i],i))b.1A(c[i]);I b},2i:H(d,a){J c=[];R(J i=0,K=d.K;i<K;i++){J b=a(d[i],i);G(b!=U)c[c.K]=b}I c.75.1t([],c)}});J v=9E.9C.3h();D.14={5F:(v.1I(/.+(?:9A|9z|9y|9w)[\\/: ]([\\d.]+)/)||[])[1],2f:/72/.11(v),2H:/2H/.11(v),1g:/1g/.11(v)&&!/2H/.11(v),3r:/3r/.11(v)&&!/(9s|72)/.11(v)};J y=D.14.1g?"70":"6Z";D.1n({6Y:!D.14.1g||S.6X=="6W",2L:{"R":"9n","9m":"1D","4g":y,6Z:y,70:y,9j:"9h",9g:"9e",9d:"9b",9a:"99"}});D.P({6S:H(a){I a.1f},96:H(a){I D.4T(a,"1f")},93:H(a){I D.2V(a,2,"2J")},90:H(a){I D.2V(a,2,"4D")},8Y:H(a){I D.4T(a,"2J")},8X:H(a){I D.4T(a,"4D")},8W:H(a){I D.5v(a.1f.1s,a)},8V:H(a){I D.5v(a.1s)},6P:H(a){I D.Y(a,"8U")?a.8T||a.8R.S:D.2h(a.3u)}},H(c,d){D.18[c]=H(b){J a=D.2i(7,d);G(b&&1j b=="1W")a=D.3f(b,a);I 7.2F(D.4u(a))}});D.P({6O:"3s",8Q:"6E",38:"6D",8P:"5p",8O:"7b"},H(c,b){D.18[c]=H(){J a=1a;I 7.P(H(){R(J i=0,K=a.K;i<K;i++)D(a[i])[b](7)})}});D.P({8N:H(a){D.1M(7,a,"");G(7.15==1)7.5k(a)},8M:H(a){D.1D.17(7,a)},8L:H(a){D.1D.1Z(7,a)},8J:H(a){D.1D[D.1D.3Q(7,a)?"1Z":"17"](7,a)},1Z:H(a){G(!a||D.1E(a,[7]).r.K){D("*",7).17(7).P(H(){D.W.1Z(7);D.3b(7)});G(7.1f)7.1f.30(7)}},4F:H(){D(">*",7).1Z();1G(7.1s)7.30(7.1s)}},H(a,b){D.18[a]=H(){I 7.P(b,1a)}});D.P(["6M","47"],H(i,c){J b=c.3h();D.18[b]=H(a){I 7[0]==1c?D.14.2H&&S.1d["5t"+c]||D.14.2f&&1c["5s"+c]||S.6X=="6W"&&S.1B["5t"+c]||S.1d["5t"+c]:7[0]==S?26.2e(26.2e(S.1d["4A"+c],S.1B["4A"+c]),26.2e(S.1d["2k"+c],S.1B["2k"+c])):a==12?(7.K?D.1h(7[0],b):U):7.1h(b,a.1q==56?a:a+"2U")}});H 2a(a,b){I a[0]&&3v(D.24(a[0],b,M),10)||0}J C=D.14.2f&&3v(D.14.5F)<8G?"(?:[\\\\w*3n-]|\\\\\\\\.)":"(?:[\\\\w\\8F-\\8E*3n-]|\\\\\\\\.)",6J=2r 4y("^>\\\\s*("+C+"+)"),6I=2r 4y("^("+C+"+)(#)("+C+"+)"),6H=2r 4y("^([#.]?)("+C+"*)");D.1n({6F:{"":H(a,i,m){I m[2]=="*"||D.Y(a,m[2])},"#":H(a,i,m){I a.4K("2t")==m[2]},":":{8D:H(a,i,m){I i<m[3]-0},8C:H(a,i,m){I i>m[3]-0},2V:H(a,i,m){I m[3]-0==i},77:H(a,i,m){I m[3]-0==i},3o:H(a,i){I i==0},3P:H(a,i,m,r){I i==r.K-1},6C:H(a,i){I i%2==0},6B:H(a,i){I i%2},"3o-4w":H(a){I a.1f.40("*")[0]==a},"3P-4w":H(a){I D.2V(a.1f.5U,1,"4D")==a},"8z-4w":H(a){I!D.2V(a.1f.5U,2,"4D")},6S:H(a){I a.1s},4F:H(a){I!a.1s},8y:H(a,i,m){I(a.6N||a.8x||D(a).1r()||"").1i(m[3])>=0},4i:H(a){I"1C"!=a.O&&D.1h(a,"19")!="2P"&&D.1h(a,"5D")!="1C"},1C:H(a){I"1C"==a.O||D.1h(a,"19")=="2P"||D.1h(a,"5D")=="1C"},8v:H(a){I!a.3O},3O:H(a){I a.3O},4M:H(a){I a.4M},3a:H(a){I a.3a||D.1M(a,"3a")},1r:H(a){I"1r"==a.O},5R:H(a){I"5R"==a.O},5A:H(a){I"5A"==a.O},5o:H(a){I"5o"==a.O},3K:H(a){I"3K"==a.O},5m:H(a){I"5m"==a.O},6z:H(a){I"6z"==a.O},6y:H(a){I"6y"==a.O},2p:H(a){I"2p"==a.O||D.Y(a,"2p")},4t:H(a){I/4t|2y|6x|2p/i.11(a.Y)},3Q:H(a,i,m){I D.2u(m[3],a).K},8t:H(a){I/h\\d/i.11(a.Y)},8s:H(a){I D.3G(D.3M,H(b){I a==b.T}).K}}},6w:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,2r 4y("^([:.#]*)("+C+"+)")],3f:H(a,c,b){J d,1u=[];1G(a&&a!=d){d=a;J f=D.1E(a,c,b);a=f.t.1o(/^\\s*,\\s*/,"");1u=b?c=f.r:D.39(1u,f.r)}I 1u},2u:H(t,o){G(1j t!="1W")I[t];G(o&&o.15!=1&&o.15!=9)I[];o=o||S;J d=[o],2w=[],3P,Y;1G(t&&3P!=t){J r=[];3P=t;t=D.3l(t);J l=Q,3k=6J,m=3k.2D(t);G(m){Y=m[1].2m();R(J i=0;d[i];i++)R(J c=d[i].1s;c;c=c.2J)G(c.15==1&&(Y=="*"||c.Y.2m()==Y))r.1A(c);d=r;t=t.1o(3k,"");G(t.1i(" ")==0)6L;l=M}N{3k=/^([>+~])\\s*(\\w*)/i;G((m=3k.2D(t))!=U){r=[];J k={};Y=m[2].2m();m=m[1];R(J j=0,3j=d.K;j<3j;j++){J n=m=="~"||m=="+"?d[j].2J:d[j].1s;R(;n;n=n.2J)G(n.15==1){J g=D.L(n);G(m=="~"&&k[g])1V;G(!Y||n.Y.2m()==Y){G(m=="~")k[g]=M;r.1A(n)}G(m=="+")1V}}d=r;t=D.3l(t.1o(3k,""));l=M}}G(t&&!l){G(!t.1i(",")){G(o==d[0])d.4s();2w=D.39(2w,d);r=d=[o];t=" "+t.6t(1,t.K)}N{J h=6I;J m=h.2D(t);G(m){m=[0,m[2],m[3],m[1]]}N{h=6H;m=h.2D(t)}m[2]=m[2].1o(/\\\\/g,"");J f=d[d.K-1];G(m[1]=="#"&&f&&f.60&&!D.4o(f)){J p=f.60(m[2]);G((D.14.1g||D.14.2H)&&p&&1j p.2t=="1W"&&p.2t!=m[2])p=D(\'[@2t="\'+m[2]+\'"]\',f)[0];d=r=p&&(!m[3]||D.Y(p,m[3]))?[p]:[]}N{R(J i=0;d[i];i++){J a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];G(a=="*"&&d[i].Y.3h()=="3y")a="3A";r=D.39(r,d[i].40(a))}G(m[1]==".")r=D.5l(r,m[2]);G(m[1]=="#"){J e=[];R(J i=0;r[i];i++)G(r[i].4K("2t")==m[2]){e=[r[i]];1V}r=e}d=r}t=t.1o(h,"")}}G(t){J b=D.1E(t,r);d=r=b.r;t=D.3l(b.t)}}G(t)d=[];G(d&&o==d[0])d.4s();2w=D.39(2w,d);I 2w},5l:H(r,m,a){m=" "+m+" ";J c=[];R(J i=0;r[i];i++){J b=(" "+r[i].1D+" ").1i(m)>=0;G(!a&&b||a&&!b)c.1A(r[i])}I c},1E:H(t,r,h){J d;1G(t&&t!=d){d=t;J p=D.6w,m;R(J i=0;p[i];i++){m=p[i].2D(t);G(m){t=t.8r(m[0].K);m[2]=m[2].1o(/\\\\/g,"");1V}}G(!m)1V;G(m[1]==":"&&m[2]=="4W")r=61.11(m[3])?D.1E(m[3],r,M).r:D(r).4W(m[3]);N G(m[1]==".")r=D.5l(r,m[2],h);N G(m[1]=="["){J g=[],O=m[3];R(J i=0,3j=r.K;i<3j;i++){J a=r[i],z=a[D.2L[m[2]]||m[2]];G(z==U||/5x|4e|3a/.11(m[2]))z=D.1M(a,m[2])||\'\';G((O==""&&!!z||O=="="&&z==m[5]||O=="!="&&z!=m[5]||O=="^="&&z&&!z.1i(m[5])||O=="$="&&z.6t(z.K-m[5].K)==m[5]||(O=="*="||O=="~=")&&z.1i(m[5])>=0)^h)g.1A(a)}r=g}N G(m[1]==":"&&m[2]=="2V-4w"){J e={},g=[],11=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2D(m[3]=="6C"&&"2n"||m[3]=="6B"&&"2n+1"||!/\\D/.11(m[3])&&"8q+"+m[3]||m[3]),3o=(11[1]+(11[2]||1))-0,d=11[3]-0;R(J i=0,3j=r.K;i<3j;i++){J j=r[i],1f=j.1f,2t=D.L(1f);G(!e[2t]){J c=1;R(J n=1f.1s;n;n=n.2J)G(n.15==1)n.4r=c++;e[2t]=M}J b=Q;G(3o==0){G(j.4r==d)b=M}N G((j.4r-d)%3o==0&&(j.4r-d)/3o>=0)b=M;G(b^h)g.1A(j)}r=g}N{J f=D.6F[m[1]];G(1j f=="3y")f=f[m[2]];G(1j f=="1W")f=6s("Q||H(a,i){I "+f+";}");r=D.3G(r,H(a,i){I f(a,i,m,r)},h)}}I{r:r,t:t}},4T:H(b,c){J a=[],1u=b[c];1G(1u&&1u!=S){G(1u.15==1)a.1A(1u);1u=1u[c]}I a},2V:H(a,e,c,b){e=e||1;J d=0;R(;a;a=a[c])G(a.15==1&&++d==e)1V;I a},5v:H(n,a){J r=[];R(;n;n=n.2J){G(n.15==1&&n!=a)r.1A(n)}I r}});D.W={17:H(f,i,g,e){G(f.15==3||f.15==8)I;G(D.14.1g&&f.4L)f=1c;G(!g.29)g.29=7.29++;G(e!=12){J h=g;g=7.3J(h,H(){I h.1t(7,1a)});g.L=e}J j=D.L(f,"3x")||D.L(f,"3x",{}),1H=D.L(f,"1H")||D.L(f,"1H",H(){G(1j D!="12"&&!D.W.5j)I D.W.1H.1t(1a.3I.T,1a)});1H.T=f;D.P(i.1Q(/\\s+/),H(c,b){J a=b.1Q(".");b=a[0];g.O=a[1];J d=j[b];G(!d){d=j[b]={};G(!D.W.2C[b]||D.W.2C[b].4q.1l(f)===Q){G(f.4a)f.4a(b,1H,Q);N G(f.6q)f.6q("4p"+b,1H)}}d[g.29]=g;D.W.28[b]=M});f=U},29:1,28:{},1Z:H(e,h,f){G(e.15==3||e.15==8)I;J i=D.L(e,"3x"),1K,5h;G(i){G(h==12||(1j h=="1W"&&h.8p(0)=="."))R(J g 1k i)7.1Z(e,g+(h||""));N{G(h.O){f=h.2o;h=h.O}D.P(h.1Q(/\\s+/),H(b,a){J c=a.1Q(".");a=c[0];G(i[a]){G(f)3d i[a][f.29];N R(f 1k i[a])G(!c[1]||i[a][f].O==c[1])3d i[a][f];R(1K 1k i[a])1V;G(!1K){G(!D.W.2C[a]||D.W.2C[a].4G.1l(e)===Q){G(e.6m)e.6m(a,D.L(e,"1H"),Q);N G(e.6l)e.6l("4p"+a,D.L(e,"1H"))}1K=U;3d i[a]}}})}R(1K 1k i)1V;G(!1K){J d=D.L(e,"1H");G(d)d.T=U;D.3b(e,"3x");D.3b(e,"1H")}}},1R:H(h,c,f,g,i){c=D.2h(c);G(h.1i("!")>=0){h=h.3w(0,-1);J a=M}G(!f){G(7.28[h])D("*").17([1c,S]).1R(h,c)}N{G(f.15==3||f.15==8)I 12;J b,1K,18=D.1F(f[h]||U),W=!c[0]||!c[0].37;G(W){c.6b({O:h,2N:f,37:H(){},3X:H(){},4J:1x()});c[0][E]=M}c[0].O=h;G(a)c[0].6k=M;J d=D.L(f,"1H");G(d)b=d.1t(f,c);G((!18||(D.Y(f,\'a\')&&h=="4n"))&&f["4p"+h]&&f["4p"+h].1t(f,c)===Q)b=Q;G(W)c.4s();G(i&&D.1F(i)){1K=i.1t(f,b==U?c:c.75(b));G(1K!==12)b=1K}G(18&&g!==Q&&b!==Q&&!(D.Y(f,\'a\')&&h=="4n")){7.5j=M;23{f[h]()}21(e){}}7.5j=Q}I b},1H:H(b){J a,1K,2T,5e,4m;b=1a[0]=D.W.6j(b||1c.W);2T=b.O.1Q(".");b.O=2T[0];2T=2T[1];5e=!2T&&!b.6k;4m=(D.L(7,"3x")||{})[b.O];R(J j 1k 4m){J c=4m[j];G(5e||c.O==2T){b.2o=c;b.L=c.L;1K=c.1t(7,1a);G(a!==Q)a=1K;G(1K===Q){b.37();b.3X()}}}I a},2L:"8o 8n 8m 8l 2p 8k 42 5c 6h 5I 8j L 8i 8h 4k 2o 59 58 8e 8c 57 6f 8b 8a 4j 88 87 86 6d 2N 4J 6c O 84 83 2S".1Q(" "),6j:H(b){G(b[E]==M)I b;J c=b;b={82:c};R(J i=7.2L.K,1e;i;){1e=7.2L[--i];b[1e]=c[1e]}b[E]=M;b.37=H(){G(c.37)c.37();c.81=Q};b.3X=H(){G(c.3X)c.3X();c.80=M};b.4J=b.4J||1x();G(!b.2N)b.2N=b.6d||S;G(b.2N.15==3)b.2N=b.2N.1f;G(!b.4j&&b.4k)b.4j=b.4k==b.2N?b.6c:b.4k;G(b.57==U&&b.5c!=U){J a=S.1B,1d=S.1d;b.57=b.5c+(a&&a.2c||1d&&1d.2c||0)-(a.69||0);b.6f=b.6h+(a&&a.2l||1d&&1d.2l||0)-(a.68||0)}G(!b.2S&&((b.42||b.42===0)?b.42:b.59))b.2S=b.42||b.59;G(!b.58&&b.5I)b.58=b.5I;G(!b.2S&&b.2p)b.2S=(b.2p&1?1:(b.2p&2?3:(b.2p&4?2:0)));I b},3J:H(a,b){b.29=a.29=a.29||b.29||7.29++;I b},2C:{25:{4q:H(){54();I},4G:H(){I}},4c:{4q:H(){G(D.14.1g)I Q;D(7).2O("51",D.W.2C.4c.2o);I M},4G:H(){G(D.14.1g)I Q;D(7).3L("51",D.W.2C.4c.2o);I M},2o:H(a){G(F(a,7))I M;a.O="4c";I D.W.1H.1t(7,1a)}},3F:{4q:H(){G(D.14.1g)I Q;D(7).2O("4Z",D.W.2C.3F.2o);I M},4G:H(){G(D.14.1g)I Q;D(7).3L("4Z",D.W.2C.3F.2o);I M},2o:H(a){G(F(a,7))I M;a.O="3F";I D.W.1H.1t(7,1a)}}}};D.18.1n({2O:H(c,a,b){I c=="4Y"?7.2Y(c,a,b):7.P(H(){D.W.17(7,c,b||a,b&&a)})},2Y:H(d,b,c){J e=D.W.3J(c||b,H(a){D(7).3L(a,e);I(c||b).1t(7,1a)});I 7.P(H(){D.W.17(7,d,e,c&&b)})},3L:H(a,b){I 7.P(H(){D.W.1Z(7,a,b)})},1R:H(c,a,b){I 7.P(H(){D.W.1R(c,a,7,M,b)})},5G:H(c,a,b){I 7[0]&&D.W.1R(c,a,7[0],Q,b)},2B:H(b){J c=1a,i=1;1G(i<c.K)D.W.3J(b,c[i++]);I 7.4n(D.W.3J(b,H(a){7.4X=(7.4X||0)%i;a.37();I c[7.4X++].1t(7,1a)||Q}))},7X:H(a,b){I 7.2O(\'4c\',a).2O(\'3F\',b)},25:H(a){54();G(D.2Q)a.1l(S,D);N D.3D.1A(H(){I a.1l(7,D)});I 7}});D.1n({2Q:Q,3D:[],25:H(){G(!D.2Q){D.2Q=M;G(D.3D){D.P(D.3D,H(){7.1l(S)});D.3D=U}D(S).5G("25")}}});J x=Q;H 54(){G(x)I;x=M;G(S.4a&&!D.14.2H)S.4a("67",D.25,Q);G(D.14.1g&&1c==1P)(H(){G(D.2Q)I;23{S.1B.7W("1z")}21(3g){3E(1a.3I,0);I}D.25()})();G(D.14.2H)S.4a("67",H(){G(D.2Q)I;R(J i=0;i<S.4V.K;i++)G(S.4V[i].3O){3E(1a.3I,0);I}D.25()},Q);G(D.14.2f){J a;(H(){G(D.2Q)I;G(S.3i!="66"&&S.3i!="1O"){3E(1a.3I,0);I}G(a===12)a=D("V, 7z[7U=7T]").K;G(S.4V.K!=a){3E(1a.3I,0);I}D.25()})()}D.W.17(1c,"3Y",D.25)}D.P(("7S,7R,3Y,7Q,4A,4Y,4n,7P,"+"89,7O,7N,51,4Z,7M,2y,"+"5m,8d,7L,7K,3g").1Q(","),H(i,b){D.18[b]=H(a){I a?7.2O(b,a):7.1R(b)}});J F=H(a,c){J b=a.4j;1G(b&&b!=c)23{b=b.1f}21(3g){b=c}I b==c};D(1c).2O("4Y",H(){D("*").17(S).3L()});D.18.1n({6e:D.18.3Y,3Y:H(g,d,c){G(1j g!=\'1W\')I 7.6e(g);J e=g.1i(" ");G(e>=0){J i=g.3w(e,g.K);g=g.3w(0,e)}c=c||H(){};J f="2R";G(d)G(D.1F(d)){c=d;d=U}N G(1j d==\'3y\'){d=D.3A(d);f="7J"}J h=7;D.3T({1b:g,O:f,1L:"2I",L:d,1O:H(a,b){G(b=="1U"||b=="7I")h.2I(i?D("<1w/>").3s(a.4U.1o(/<1m(.|\\s)*?\\/1m>/g,"")).2u(i):a.4U);h.P(c,[a.4U,b,a])}});I 7},aL:H(){I D.3A(7.7H())},7H:H(){I 7.2i(H(){I D.Y(7,"45")?D.2h(7.aK):7}).1E(H(){I 7.32&&!7.3O&&(7.4M||/2y|6x/i.11(7.Y)||/1r|1C|3K/i.11(7.O))}).2i(H(i,c){J b=D(7).6a();I b==U?U:b.1q==2q?D.2i(b,H(a,i){I{32:c.32,2s:a}}):{32:c.32,2s:b}}).3p()}});D.P("7G,7D,7C,7B,6u,7A".1Q(","),H(i,o){D.18[o]=H(f){I 7.2O(o,f)}});J B=1x();D.1n({3p:H(d,b,a,c){G(D.1F(b)){a=b;b=U}I D.3T({O:"2R",1b:d,L:b,1U:a,1L:c})},aG:H(b,a){I D.3p(b,U,a,"1m")},aF:H(c,b,a){I D.3p(c,b,a,"3B")},aD:H(d,b,a,c){G(D.1F(b)){a=b;b={}}I D.3T({O:"7J",1b:d,L:b,1U:a,1L:c})},aC:H(a){D.1n(D.5Z,a)},5Z:{1b:5Y.5x,28:M,O:"2R",2W:0,7y:"4x/x-ay-45-ax",7v:M,31:M,L:U,5r:U,3K:U,4z:{2K:"4x/2K, 1r/2K",2I:"1r/2I",1m:"1r/4v, 4x/4v",3B:"4x/3B, 1r/4v",1r:"1r/as",4S:"*/*"}},4R:{},3T:H(s){s=D.1n(M,s,D.1n(M,{},D.5Z,s));J g,33=/=\\?(&|$)/g,1v,L,O=s.O.2m();G(s.L&&s.7v&&1j s.L!="1W")s.L=D.3A(s.L);G(s.1L=="4Q"){G(O=="2R"){G(!s.1b.1I(33))s.1b+=(s.1b.1I(/\\?/)?"&":"?")+(s.4Q||"7s")+"=?"}N G(!s.L||!s.L.1I(33))s.L=(s.L?s.L+"&":"")+(s.4Q||"7s")+"=?";s.1L="3B"}G(s.1L=="3B"&&(s.L&&s.L.1I(33)||s.1b.1I(33))){g="4Q"+B++;G(s.L)s.L=(s.L+"").1o(33,"="+g+"$1");s.1b=s.1b.1o(33,"="+g+"$1");s.1L="1m";1c[g]=H(a){L=a;1U();1O();1c[g]=12;23{3d 1c[g]}21(e){}G(i)i.30(h)}}G(s.1L=="1m"&&s.1Y==U)s.1Y=Q;G(s.1Y===Q&&O=="2R"){J j=1x();J k=s.1b.1o(/(\\?|&)3n=.*?(&|$)/,"$am="+j+"$2");s.1b=k+((k==s.1b)?(s.1b.1I(/\\?/)?"&":"?")+"3n="+j:"")}G(s.L&&O=="2R"){s.1b+=(s.1b.1I(/\\?/)?"&":"?")+s.L;s.L=U}G(s.28&&!D.4P++)D.W.1R("7G");J n=/^(?:\\w+:)?\\/\\/([^\\/?#]+)/;G(s.1L=="1m"&&O=="2R"&&n.11(s.1b)&&n.2D(s.1b)[1]!=5Y.ak){J i=S.40("6v")[0];J h=S.3t("1m");h.4e=s.1b;G(s.7r)h.ai=s.7r;G(!g){J l=Q;h.ag=h.af=H(){G(!l&&(!7.3i||7.3i=="66"||7.3i=="1O")){l=M;1U();1O();i.30(h)}}}i.49(h);I 12}J m=Q;J c=1c.7q?2r 7q("ad.ac"):2r 6Q();G(s.5r)c.7o(O,s.1b,s.31,s.5r,s.3K);N c.7o(O,s.1b,s.31);23{G(s.L)c.4O("ab-aa",s.7y);G(s.5T)c.4O("a9-5S-a8",D.4R[s.1b]||"a7, a6 a4 a3 5O:5O:5O a1");c.4O("X-a0-9Y","6Q");c.4O("9X",s.1L&&s.4z[s.1L]?s.4z[s.1L]+", */*":s.4z.4S)}21(e){}G(s.7k&&s.7k(c,s)===Q){s.28&&D.4P--;c.7j();I Q}G(s.28)D.W.1R("7A",[c,s]);J d=H(a){G(!m&&c&&(c.3i==4||a=="2W")){m=M;G(f){7h(f);f=U}1v=a=="2W"?"2W":!D.7g(c)?"3g":s.5T&&D.7f(c,s.1b)?"7I":"1U";G(1v=="1U"){23{L=D.6U(c,s.1L,s.9S)}21(e){1v="5L"}}G(1v=="1U"){J b;23{b=c.5K("7e-5S")}21(e){}G(s.5T&&b)D.4R[s.1b]=b;G(!g)1U()}N D.5E(s,c,1v);1O();G(s.31)c=U}};G(s.31){J f=4L(d,13);G(s.2W>0)3E(H(){G(c){c.7j();G(!m)d("2W")}},s.2W)}23{c.9R(s.L)}21(e){D.5E(s,c,U,e)}G(!s.31)d();H 1U(){G(s.1U)s.1U(L,1v);G(s.28)D.W.1R("6u",[c,s])}H 1O(){G(s.1O)s.1O(c,1v);G(s.28)D.W.1R("7C",[c,s]);G(s.28&&!--D.4P)D.W.1R("7D")}I c},5E:H(s,a,b,e){G(s.3g)s.3g(a,b,e);G(s.28)D.W.1R("7B",[a,s,e])},4P:0,7g:H(a){23{I!a.1v&&5Y.9Q=="5o:"||(a.1v>=7c&&a.1v<9O)||a.1v==7a||a.1v==9N||D.14.2f&&a.1v==12}21(e){}I Q},7f:H(a,c){23{J b=a.5K("7e-5S");I a.1v==7a||b==D.4R[c]||D.14.2f&&a.1v==12}21(e){}I Q},6U:H(a,c,b){J d=a.5K("9L-O"),2K=c=="2K"||!c&&d&&d.1i("2K")>=0,L=2K?a.9K:a.4U;G(2K&&L.1B.2g=="5L")7m"5L";G(b)L=b(L,c);G(c=="1m")D.5u(L);G(c=="3B")L=6s("("+L+")");I L},3A:H(a){J s=[];H 17(b,a){s[s.K]=78(b)+\'=\'+78(a)};G(a.1q==2q||a.5w)D.P(a,H(){17(7.32,7.2s)});N R(J j 1k a)G(a[j]&&a[j].1q==2q)D.P(a[j],H(){17(j,7)});N 17(j,D.1F(a[j])?a[j]():a[j]);I s.6r("&").1o(/%20/g,"+")}});D.18.1n({1N:H(c,b){I c?7.2j({1T:"1N",2d:"1N",1y:"1N"},c,b):7.1E(":1C").P(H(){7.V.19=7.5H||"";G(D.1h(7,"19")=="2P"){J a=D("<"+7.2g+" />").6O("1d");7.V.19=a.1h("19");G(7.V.19=="2P")7.V.19="3H";a.1Z()}}).3m()},1J:H(b,a){I b?7.2j({1T:"1J",2d:"1J",1y:"1J"},b,a):7.1E(":4i").P(H(){7.5H=7.5H||D.1h(7,"19");7.V.19="2P"}).3m()},76:D.18.2B,2B:H(a,b){I D.1F(a)&&D.1F(b)?7.76.1t(7,1a):a?7.2j({1T:"2B",2d:"2B",1y:"2B"},a,b):7.P(H(){D(7)[D(7).3C(":1C")?"1N":"1J"]()})},9J:H(b,a){I 7.2j({1T:"1N"},b,a)},9I:H(b,a){I 7.2j({1T:"1J"},b,a)},9H:H(b,a){I 7.2j({1T:"2B"},b,a)},9G:H(b,a){I 7.2j({1y:"1N"},b,a)},9F:H(b,a){I 7.2j({1y:"1J"},b,a)},9D:H(c,a,b){I 7.2j({1y:a},c,b)},2j:H(k,j,i,g){J h=D.74(j,i,g);I 7[h.35===Q?"P":"35"](H(){G(7.15!=1)I Q;J f=D.1n({},h),p,1C=D(7).3C(":1C"),41=7;R(p 1k k){G(k[p]=="1J"&&1C||k[p]=="1N"&&!1C)I f.1O.1l(7);G(p=="1T"||p=="2d"){f.19=D.1h(7,"19");f.34=7.V.34}}G(f.34!=U)7.V.34="1C";f.44=D.1n({},k);D.P(k,H(c,a){J e=2r D.27(41,f,c);G(/2B|1N|1J/.11(a))e[a=="2B"?1C?"1N":"1J":a](k);N{J b=a.6p().1I(/^([+-]=)?([\\d+-.]+)(.*)$/),2b=e.1u(M)||0;G(b){J d=3e(b[2]),2M=b[3]||"2U";G(2M!="2U"){41.V[c]=(d||1)+2M;2b=((d||1)/e.1u(M))*2b;41.V[c]=2b+2M}G(b[1])d=((b[1]=="-="?-1:1)*d)+2b;e.3Z(2b,d,2M)}N e.3Z(2b,a,"")}});I M})},35:H(a,b){G(D.1F(a)||(a&&a.1q==2q)){b=a;a="27"}G(!a||(1j a=="1W"&&!b))I A(7[0],a);I 7.P(H(){G(b.1q==2q)A(7,a,b);N{A(7,a).1A(b);G(A(7,a).K==1)b.1l(7)}})},9x:H(b,c){J a=D.3M;G(b)7.35([]);7.P(H(){R(J i=a.K-1;i>=0;i--)G(a[i].T==7){G(c)a[i](M);a.7l(i,1)}});G(!c)7.5C();I 7}});J A=H(b,c,a){G(b){c=c||"27";J q=D.L(b,c+"35");G(!q||a)q=D.L(b,c+"35",D.2h(a))}I q};D.18.5C=H(a){a=a||"27";I 7.P(H(){J q=A(7,a);q.4s();G(q.K)q[0].1l(7)})};D.1n({74:H(b,a,c){J d=b&&b.1q==9u?b:{1O:c||!c&&a||D.1F(b)&&b,2v:b,3U:c&&a||a&&a.1q!=9t&&a};d.2v=(d.2v&&d.2v.1q==4N?d.2v:D.27.5N[d.2v])||D.27.5N.71;d.5P=d.1O;d.1O=H(){G(d.35!==Q)D(7).5C();G(D.1F(d.5P))d.5P.1l(7)};I d},3U:{7n:H(p,n,b,a){I b+a*p},5Q:H(p,n,b,a){I((-26.9r(p*26.9q)/2)+0.5)*a+b}},3M:[],46:U,27:H(b,c,a){7.16=c;7.T=b;7.1e=a;G(!c.3R)c.3R={}}});D.27.3V={4E:H(){G(7.16.2Z)7.16.2Z.1l(7.T,7.1x,7);(D.27.2Z[7.1e]||D.27.2Z.4S)(7);G(7.1e=="1T"||7.1e=="2d")7.T.V.19="3H"},1u:H(a){G(7.T[7.1e]!=U&&7.T.V[7.1e]==U)I 7.T[7.1e];J r=3e(D.1h(7.T,7.1e,a));I r&&r>-9p?r:3e(D.24(7.T,7.1e))||0},3Z:H(c,b,d){7.5B=1x();7.2b=c;7.3m=b;7.2M=d||7.2M||"2U";7.1x=7.2b;7.36=7.4C=0;7.4E();J e=7;H t(a){I e.2Z(a)}t.T=7.T;D.3M.1A(t);G(D.46==U){D.46=4L(H(){J a=D.3M;R(J i=0;i<a.K;i++)G(!a[i]())a.7l(i--,1);G(!a.K){7h(D.46);D.46=U}},13)}},1N:H(){7.16.3R[7.1e]=D.1M(7.T.V,7.1e);7.16.1N=M;7.3Z(0,7.1u());G(7.1e=="2d"||7.1e=="1T")7.T.V[7.1e]="9l";D(7.T).1N()},1J:H(){7.16.3R[7.1e]=D.1M(7.T.V,7.1e);7.16.1J=M;7.3Z(7.1u(),0)},2Z:H(a){J t=1x();G(a||t>7.16.2v+7.5B){7.1x=7.3m;7.36=7.4C=1;7.4E();7.16.44[7.1e]=M;J b=M;R(J i 1k 7.16.44)G(7.16.44[i]!==M)b=Q;G(b){G(7.16.19!=U){7.T.V.34=7.16.34;7.T.V.19=7.16.19;G(D.1h(7.T,"19")=="2P")7.T.V.19="3H"}G(7.16.1J)7.T.V.19="2P";G(7.16.1J||7.16.1N)R(J p 1k 7.16.44)D.1M(7.T.V,p,7.16.3R[p])}G(b)7.16.1O.1l(7.T);I Q}N{J n=t-7.5B;7.4C=n/7.16.2v;7.36=D.3U[7.16.3U||(D.3U.5Q?"5Q":"7n")](7.4C,n,0,1,7.16.2v);7.1x=7.2b+((7.3m-7.2b)*7.36);7.4E()}I M}};D.1n(D.27,{5N:{9k:9i,an:7c,71:ao},2Z:{2c:H(a){a.T.2c=a.1x},2l:H(a){a.T.2l=a.1x},1y:H(a){D.1M(a.T.V,"1y",a.1x)},4S:H(a){a.T.V[a.1e]=a.1x+a.2M}}});D.18.2k=H(){J b=0,1P=0,T=7[0],3q;G(T)9f(D.14){J d=T.1f,48=T,1p=T.1p,1S=T.2z,5V=2f&&3v(5F)<9c&&!/aw/i.11(v),1h=D.24,2X=1h(T,"3c")=="2X";G(!(3r&&T==S.1d)&&T.6T){J c=T.6T();17(c.1z+26.2e(1S.1B.2c,1S.1d.2c),c.1P+26.2e(1S.1B.2l,1S.1d.2l));17(-1S.1B.69,-1S.1B.68)}N{17(T.5X,T.5z);1G(1p){17(1p.5X,1p.5z);G(3r&&!/^t(98|d|h)$/i.11(1p.2g)||2f&&!5V)2A(1p);G(!2X&&1h(1p,"3c")=="2X")2X=M;48=/^1d$/i.11(1p.2g)?48:1p;1p=1p.1p}1G(d&&d.2g&&!/^1d|2I$/i.11(d.2g)){G(!/^97|1X.*$/i.11(1h(d,"19")))17(-d.2c,-d.2l);G(3r&&1h(d,"34")!="4i")2A(d);d=d.1f}G((5V&&(2X||1h(48,"3c")=="5g"))||(3r&&1h(48,"3c")!="5g"))17(-1S.1d.5X,-1S.1d.5z);G(2X)17(26.2e(1S.1B.2c,1S.1d.2c),26.2e(1S.1B.2l,1S.1d.2l))}3q={1P:1P,1z:b}}H 2A(a){17(D.24(a,"7w",M),D.24(a,"7x",M))}H 17(l,t){b+=3v(l,10)||0;1P+=3v(t,10)||0}I 3q};D.18.1n({3c:H(){J a=0,1P=0,3q;G(7[0]){J b=7.1p(),2k=7.2k(),4b=/^1d|2I$/i.11(b[0].2g)?{1P:0,1z:0}:b.2k();2k.1P-=2a(7,\'95\');2k.1z-=2a(7,\'94\');4b.1P+=2a(b,\'7x\');4b.1z+=2a(b,\'7w\');3q={1P:2k.1P-4b.1P,1z:2k.1z-4b.1z}}I 3q},1p:H(){J a=7[0].1p;1G(a&&(!/^1d|2I$/i.11(a.2g)&&D.1h(a,\'3c\')==\'aI\'))a=a.1p;I D(a)}});D.P([\'5d\',\'5b\'],H(i,b){J c=\'4A\'+b;D.18[c]=H(a){G(!7[0])I;I a!=12?7.P(H(){7==1c||7==S?1c.aJ(!i?a:D(1c).2c(),i?a:D(1c).2l()):7[c]=a}):7[0]==1c||7[0]==S?41[i?\'92\':\'91\']||D.6Y&&S.1B[c]||S.1d[c]:7[0][c]}});D.P(["6M","47"],H(i,b){J c=i?"5d":"5b",43=i?"6i":"6g";D.18["5s"+b]=H(){I 7[b.3h()]()+2a(7,"55"+c)+2a(7,"55"+43)};D.18["aM"+b]=H(a){I 7["5s"+b]()+2a(7,"2A"+c+"47")+2a(7,"2A"+43+"47")+(a?2a(7,"7F"+c)+2a(7,"7F"+43):0)}})})();',62,671,'|||||||this|||||||||||||||||||||||||||||||||||if|function|return|var|length|data|true|else|type|each|false|for|document|elem|null|style|event||nodeName|||test|undefined||browser|nodeType|options|add|fn|display|arguments|url|window|body|prop|parentNode|msie|css|indexOf|typeof|in|call|script|extend|replace|offsetParent|constructor|text|firstChild|apply|cur|status|div|now|opacity|left|push|documentElement|hidden|className|filter|isFunction|while|handle|match|hide|ret|dataType|attr|show|complete|top|split|trigger|doc|height|success|break|string|table|cache|remove||catch|tbody|try|curCSS|ready|Math|fx|global|guid|num|start|scrollLeft|width|max|safari|tagName|makeArray|map|animate|offset|scrollTop|toUpperCase||handler|button|Array|new|value|id|find|duration|done|copy|select|ownerDocument|border|toggle|special|exec|inArray|pushStack|stack|opera|html|nextSibling|xml|props|unit|target|bind|none|isReady|GET|which|namespace|px|nth|timeout|fixed|one|step|removeChild|async|name|jsre|overflow|queue|pos|preventDefault|insertBefore|merge|selected|removeData|position|delete|parseFloat|multiFilter|error|toLowerCase|readyState|rl|re|trim|end|_|first|get|results|mozilla|append|createElement|childNodes|parseInt|slice|events|object|elems|param|json|is|readyList|setTimeout|mouseleave|grep|block|callee|proxy|password|unbind|timers|defaultView|disabled|last|has|orig|domManip|ajax|easing|prototype|set|stopPropagation|load|custom|getElementsByTagName|self|charCode|br|curAnim|form|timerId|Width|offsetChild|appendChild|addEventListener|parentOffset|mouseenter|color|src|currentStyle|float|clean|visible|relatedTarget|fromElement|innerHTML|handlers|click|isXMLDoc|on|setup|nodeIndex|shift|input|unique|javascript|child|application|RegExp|accepts|scroll|deep|state|previousSibling|update|empty|teardown|tr|jQuery|timeStamp|getAttribute|setInterval|checked|Number|setRequestHeader|active|jsonp|lastModified|_default|dir|responseText|styleSheets|not|lastToggle|unload|mouseout|outline|mouseover|getPropertyValue|getComputedStyle|bindReady|padding|String|pageX|metaKey|keyCode|getWH|Top|clientX|Left|all|container|absolute|index|init|triggered|removeAttribute|classFilter|submit|prevObject|file|after|windowData|username|inner|client|globalEval|sibling|jquery|href|clone|offsetTop|checkbox|startTime|dequeue|visibility|handleError|version|triggerHandler|oldblock|ctrlKey|createTextNode|getResponseHeader|parsererror|andSelf|speeds|00|old|swing|radio|Modified|ifModified|lastChild|safari2|wrapAll|offsetLeft|location|ajaxSettings|getElementById|isSimple|values|selectedIndex|runtimeStyle|rsLeft|loaded|DOMContentLoaded|clientTop|clientLeft|val|unshift|toElement|srcElement|_load|pageY|Bottom|clientY|Right|fix|exclusive|detachEvent|removeEventListener|cloneNode|swap|toString|attachEvent|join|eval|substr|ajaxSuccess|head|parse|textarea|reset|image|zoom|odd|even|before|prepend|expr|exclude|quickClass|quickID|quickChild|uuid|continue|Height|textContent|appendTo|contents|XMLHttpRequest|evalScript|parent|getBoundingClientRect|httpData|setArray|CSS1Compat|compatMode|boxModel|cssFloat|styleFloat|def|webkit|nodeValue|speed|concat|_toggle|eq|encodeURIComponent|100|304|replaceWith|200|alpha|Last|httpNotModified|httpSuccess|clearInterval|getAttributeNode|abort|beforeSend|splice|throw|linear|open|colgroup|ActiveXObject|scriptCharset|callback|fieldset|multiple|processData|borderLeftWidth|borderTopWidth|contentType|link|ajaxSend|ajaxError|ajaxComplete|ajaxStop|col|margin|ajaxStart|serializeArray|notmodified|POST|keyup|keypress|change|mousemove|mouseup|dblclick|resize|focus|blur|stylesheet|rel|hasClass|doScroll|hover|black|solid|cancelBubble|returnValue|originalEvent|wheelDelta|view|round|shiftKey|screenY|screenX|mousedown|relatedNode|prevValue|originalTarget|keydown|newValue|offsetHeight|offsetWidth|eventPhase|detail|currentTarget|cancelable|bubbles|attrName|attrChange|altKey|charAt|0n|substring|animated|header|noConflict|enabled|line|innerText|contains|only|weight|font|gt|lt|uFFFF|u0128|417|size|Boolean|toggleClass|Date|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|contentWindow|wrap|contentDocument|iframe|children|siblings|prevAll|nextAll|wrapInner|prev|pageXOffset|pageYOffset|next|marginLeft|marginTop|parents|inline|able|rowSpan|rowspan|cellSpacing|522|cellspacing|maxLength|with|maxlength|readOnly|600|readonly|slow|1px|class|htmlFor|reverse|10000|PI|cos|compatible|Function|Object|setData|ie|stop|ra|it|rv|getData|userAgent|fadeTo|navigator|fadeOut|fadeIn|slideToggle|slideUp|slideDown|responseXML|content|ig|1223|300|NaN|protocol|send|dataFilter|setAttribute|option|cssText|changed|Accept|With|be|Requested|GMT|can|1970|Jan|property|01|Thu|Since|If|Type|Content|XMLHTTP|Microsoft|th|onreadystatechange|onload|td|charset|cap|host|colg|1_|fast|400|tfoot|specified|thead|plain|leg|attributes|opt|adobeair|urlencoded|www|embed|area|hr|ajaxSetup|post|meta|getJSON|getScript|img|static|scrollTo|elements|serialize|outer|abbr|pixelLeft'.split('|'),0,{}));jQuery.noConflict(); 11 (function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else 12 return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else 13 return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else 14 selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else 15 return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else 16 this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else 17 return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else 18 jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&©&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else 19 script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else 20 for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else 21 for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else 22 jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else 23 ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else 24 while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else 25 while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else 26 for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else 27 jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else 28 xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else 29 jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else 30 for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else 31 s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else 32 e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})(); -
trunk/wp-includes/js/jquery/jquery.table-hotkeys.js
r9946 r10291 1 (function($){ 2 $.fn.filter_visible = function(depth) { 3 depth = depth || 3; 4 var is_visible = function() { 5 var p = $(this); 6 for(i=0; i<depth-1; ++i) { 7 if (!p.is(':visible')) return false; 8 p = p.parent(); 9 } 10 return true; 11 } 12 return this.filter(is_visible); 13 }; 14 $.table_hotkeys = function(table, keys, opts) { 15 opts = $.extend($.table_hotkeys.defaults, opts); 16 var selected_class = opts.class_prefix + opts.selected_suffix; 17 var destructive_class = opts.class_prefix + opts.destructive_suffix; 18 var set_current_row = function (tr) { 19 if ($.table_hotkeys.current_row) $.table_hotkeys.current_row.removeClass(selected_class); 20 tr.addClass(selected_class); 21 tr[0].scrollIntoView(false); 22 $.table_hotkeys.current_row = tr; 23 }; 24 var adjacent_row_callback = function(which) { 25 if (!adjacent_row(which) && $.isFunction(opts[which+'_page_link_cb'])) { 26 opts[which+'_page_link_cb'](); 27 } 28 }; 29 var get_adjacent_row = function(which) { 30 if (!$.table_hotkeys.current_row) { 31 var first_row = get_first_row(); 32 $.table_hotkeys.current_row = first_row; 33 return first_row[0]; 34 } 35 var method = 'prev' == which? $.fn.prevAll : $.fn.nextAll; 36 return method.call($.table_hotkeys.current_row, opts.cycle_expr).filter_visible()[0]; 37 }; 38 var adjacent_row = function(which) { 39 var adj = get_adjacent_row(which); 40 if (!adj) return false; 41 set_current_row($(adj)); 42 return true; 43 }; 44 var prev_row = function() { return adjacent_row('prev'); }; 45 var next_row = function() { return adjacent_row('next'); }; 46 var check = function() { 47 $(opts.checkbox_expr, $.table_hotkeys.current_row).each(function() { 48 this.checked = !this.checked; 49 }); 50 }; 51 var get_first_row = function() { 52 return $(opts.cycle_expr, table).filter_visible().eq(opts.start_row_index); 53 }; 54 var get_last_row = function() { 55 var rows = $(opts.cycle_expr, table).filter_visible(); 56 return rows.eq(rows.length-1); 57 }; 58 var make_key_callback = function(expr) { 59 return function() { 60 if ( null == $.table_hotkeys.current_row ) return false; 61 var clickable = $(expr, $.table_hotkeys.current_row); 62 if (!clickable.length) return false; 63 if (clickable.is('.'+destructive_class)) next_row() || prev_row(); 64 clickable.click(); 65 } 66 }; 67 var first_row = get_first_row(); 68 if (!first_row.length) return; 69 if (opts.highlight_first) 70 set_current_row(first_row); 71 else if (opts.highlight_last) 72 set_current_row(get_last_row()); 73 jQuery.hotkeys.add(opts.prev_key, opts.hotkeys_opts, function() {return adjacent_row_callback('prev')}); 74 jQuery.hotkeys.add(opts.next_key, opts.hotkeys_opts, function() {return adjacent_row_callback('next')}); 75 jQuery.hotkeys.add(opts.mark_key, opts.hotkeys_opts, check); 76 jQuery.each(keys, function() { 77 if ($.isFunction(this[1])) { 78 var callback = this[1]; 79 var key = this[0]; 80 jQuery.hotkeys.add(key, opts.hotkeys_opts, function(event) { return callback(event, $.table_hotkeys.current_row); }); 81 } else { 82 var key = this; 83 jQuery.hotkeys.add(key, opts.hotkeys_opts, make_key_callback('.'+opts.class_prefix+key)); 84 } 85 }); 86 87 }; 88 $.table_hotkeys.current_row = null; 89 $.table_hotkeys.defaults = {cycle_expr: 'tr', class_prefix: 'vim-', selected_suffix: 'current', 90 destructive_suffix: 'destructive', hotkeys_opts: {disableInInput: true, type: 'keypress'}, 91 checkbox_expr: ':checkbox', next_key: 'j', prev_key: 'k', mark_key: 'x', 92 start_row_index: 2, highlight_first: false, highlight_last: false, next_page_link_cb: false, prev_page_link_cb: false}; 93 })(jQuery); 1 (function(a){a.fn.filter_visible=function(c){c=c||3;var b=function(){var e=a(this),d;for(d=0;d<c-1;++d){if(!e.is(":visible")){return false}e=e.parent()}return true};return this.filter(b)};a.table_hotkeys=function(p,q,b){b=a.extend(a.table_hotkeys.defaults,b);var i,l,e,f,m,d,k,o,c,h,g,n,j;i=b.class_prefix+b.selected_suffix;l=b.class_prefix+b.destructive_suffix;e=function(r){if(a.table_hotkeys.current_row){a.table_hotkeys.current_row.removeClass(i)}r.addClass(i);r[0].scrollIntoView(false);a.table_hotkeys.current_row=r};f=function(r){if(!d(r)&&a.isFunction(b[r+"_page_link_cb"])){b[r+"_page_link_cb"]()}};m=function(s){var r,t;if(!a.table_hotkeys.current_row){r=h();a.table_hotkeys.current_row=r;return r[0]}t="prev"==s?a.fn.prevAll:a.fn.nextAll;return t.call(a.table_hotkeys.current_row,b.cycle_expr).filter_visible()[0]};d=function(s){var r=m(s);if(!r){return false}e(a(r));return true};k=function(){return d("prev")};o=function(){return d("next")};c=function(){a(b.checkbox_expr,a.table_hotkeys.current_row).each(function(){this.checked=!this.checked})};h=function(){return a(b.cycle_expr,p).filter_visible().eq(b.start_row_index)};g=function(){var r=a(b.cycle_expr,p).filter_visible();return r.eq(r.length-1)};n=function(r){return function(){if(null==a.table_hotkeys.current_row){return false}var s=a(r,a.table_hotkeys.current_row);if(!s.length){return false}if(s.is("."+l)){o()||k()}s.click()}};j=h();if(!j.length){return}if(b.highlight_first){e(j)}else{if(b.highlight_last){e(g())}}a.hotkeys.add(b.prev_key,b.hotkeys_opts,function(){return f("prev")});a.hotkeys.add(b.next_key,b.hotkeys_opts,function(){return f("next")});a.hotkeys.add(b.mark_key,b.hotkeys_opts,c);a.each(q,function(){var s,r;if(a.isFunction(this[1])){s=this[1];r=this[0];a.hotkeys.add(r,b.hotkeys_opts,function(t){return s(t,a.table_hotkeys.current_row)})}else{r=this;a.hotkeys.add(r,b.hotkeys_opts,n("."+b.class_prefix+r))}})};a.table_hotkeys.current_row=null;a.table_hotkeys.defaults={cycle_expr:"tr",class_prefix:"vim-",selected_suffix:"current",destructive_suffix:"destructive",hotkeys_opts:{disableInInput:true,type:"keypress"},checkbox_expr:":checkbox",next_key:"j",prev_key:"k",mark_key:"x",start_row_index:2,highlight_first:false,highlight_last:false,next_page_link_cb:false,prev_page_link_cb:false}})(jQuery); -
trunk/wp-includes/js/jquery/suggest.js
r8214 r10291 1 /* 2 * jquery.suggest 1.1b - 2007-08-06 3 * Patched by Mark Jaquith with Alexander Dick's "multiple items" patch to allow for auto-suggesting of more than one tag before submitting 4 * See: http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/#comment-7228 5 * 6 * Uses code and techniques from following libraries: 7 * 1. http://www.dyve.net/jquery/?autocomplete 8 * 2. http://dev.jquery.com/browser/trunk/plugins/interface/iautocompleter.js 9 * 10 * All the new stuff written by Peter Vulgaris (www.vulgarisoip.com) 11 * Feel free to do whatever you want with this file 12 * 13 */ 14 15 (function($) { 16 17 $.suggest = function(input, options) { 18 19 var $input = $(input).attr("autocomplete", "off"); 20 var $results = $(document.createElement("ul")); 21 22 var timeout = false; // hold timeout ID for suggestion results to appear 23 var prevLength = 0; // last recorded length of $input.val() 24 var cache = []; // cache MRU list 25 var cacheSize = 0; // size of cache in chars (bytes?) 26 27 $results.addClass(options.resultsClass).appendTo('body'); 28 29 30 resetPosition(); 31 $(window) 32 .load(resetPosition) // just in case user is changing size of page while loading 33 .resize(resetPosition); 34 35 $input.blur(function() { 36 setTimeout(function() { $results.hide() }, 200); 37 }); 38 39 40 // help IE users if possible 41 try { 42 $results.bgiframe(); 43 } catch(e) { } 44 45 46 // I really hate browser detection, but I don't see any other way 47 if ($.browser.mozilla) 48 $input.keypress(processKey); // onkeypress repeats arrow keys in Mozilla/Opera 49 else 50 $input.keydown(processKey); // onkeydown repeats arrow keys in IE/Safari 51 52 53 54 55 function resetPosition() { 56 // requires jquery.dimension plugin 57 var offset = $input.offset(); 58 $results.css({ 59 top: (offset.top + input.offsetHeight) + 'px', 60 left: offset.left + 'px' 61 }); 62 } 63 64 65 function processKey(e) { 66 67 // handling up/down/escape requires results to be visible 68 // handling enter/tab requires that AND a result to be selected 69 if ((/27$|38$|40$/.test(e.keyCode) && $results.is(':visible')) || 70 (/^13$|^9$/.test(e.keyCode) && getCurrentResult())) { 71 72 if (e.preventDefault) 73 e.preventDefault(); 74 if (e.stopPropagation) 75 e.stopPropagation(); 76 77 e.cancelBubble = true; 78 e.returnValue = false; 79 80 switch(e.keyCode) { 81 82 case 38: // up 83 prevResult(); 84 break; 85 86 case 40: // down 87 nextResult(); 88 break; 89 90 case 9: // tab 91 case 13: // return 92 selectCurrentResult(); 93 break; 94 95 case 27: // escape 96 $results.hide(); 97 break; 98 99 } 100 101 } else if ($input.val().length != prevLength) { 102 103 if (timeout) 104 clearTimeout(timeout); 105 timeout = setTimeout(suggest, options.delay); 106 prevLength = $input.val().length; 107 108 } 109 110 111 } 112 113 114 function suggest() { 115 116 var q = $.trim($input.val()); 117 118 if ( options.multiple ) { 119 var multipleSepPos = q.lastIndexOf(options.multipleSep); 120 if ( multipleSepPos != -1 ) { 121 q = q.substr(multipleSepPos + options.multipleSep.length); 122 } 123 } 124 if (q.length >= options.minchars) { 125 126 cached = checkCache(q); 127 128 if (cached) { 129 130 displayItems(cached['items']); 131 132 } else { 133 134 $.get(options.source, {q: q}, function(txt) { 135 136 $results.hide(); 137 138 var items = parseTxt(txt, q); 139 140 displayItems(items); 141 addToCache(q, items, txt.length); 142 143 }); 144 145 } 146 147 } else { 148 149 $results.hide(); 150 151 } 152 153 } 154 155 156 function checkCache(q) { 157 158 for (var i = 0; i < cache.length; i++) 159 if (cache[i]['q'] == q) { 160 cache.unshift(cache.splice(i, 1)[0]); 161 return cache[0]; 162 } 163 164 return false; 165 166 } 167 168 function addToCache(q, items, size) { 169 170 while (cache.length && (cacheSize + size > options.maxCacheSize)) { 171 var cached = cache.pop(); 172 cacheSize -= cached['size']; 173 } 174 175 cache.push({ 176 q: q, 177 size: size, 178 items: items 179 }); 180 181 cacheSize += size; 182 183 } 184 185 function displayItems(items) { 186 187 if (!items) 188 return; 189 190 if (!items.length) { 191 $results.hide(); 192 return; 193 } 194 195 resetPosition(); // when the form moves after the page has loaded 196 197 var html = ''; 198 for (var i = 0; i < items.length; i++) 199 html += '<li>' + items[i] + '</li>'; 200 201 $results.html(html).show(); 202 203 $results 204 .children('li') 205 .mouseover(function() { 206 $results.children('li').removeClass(options.selectClass); 207 $(this).addClass(options.selectClass); 208 }) 209 .click(function(e) { 210 e.preventDefault(); 211 e.stopPropagation(); 212 selectCurrentResult(); 213 }); 214 215 } 216 217 function parseTxt(txt, q) { 218 219 var items = []; 220 var tokens = txt.split(options.delimiter); 221 222 // parse returned data for non-empty items 223 for (var i = 0; i < tokens.length; i++) { 224 var token = $.trim(tokens[i]); 225 if (token) { 226 token = token.replace( 227 new RegExp(q, 'ig'), 228 function(q) { return '<span class="' + options.matchClass + '">' + q + '</span>' } 229 ); 230 items[items.length] = token; 231 } 232 } 233 234 return items; 235 } 236 237 function getCurrentResult() { 238 239 if (!$results.is(':visible')) 240 return false; 241 242 var $currentResult = $results.children('li.' + options.selectClass); 243 244 if (!$currentResult.length) 245 $currentResult = false; 246 247 return $currentResult; 248 249 } 250 251 function selectCurrentResult() { 252 253 $currentResult = getCurrentResult(); 254 255 if ($currentResult) { 256 if ( options.multiple ) { 257 if ( $input.val().indexOf(options.multipleSep) != -1 ) { 258 $currentVal = $input.val().substr( 0, ( $input.val().lastIndexOf(options.multipleSep) + options.multipleSep.length ) ); 259 } else { 260 $currentVal = ""; 261 } 262 $input.val( $currentVal + $currentResult.text() + options.multipleSep); 263 $input.focus(); 264 } else { 265 $input.val($currentResult.text()); 266 } 267 $results.hide(); 268 269 if (options.onSelect) 270 options.onSelect.apply($input[0]); 271 272 } 273 274 } 275 276 function nextResult() { 277 278 $currentResult = getCurrentResult(); 279 280 if ($currentResult) 281 $currentResult 282 .removeClass(options.selectClass) 283 .next() 284 .addClass(options.selectClass); 285 else 286 $results.children('li:first-child').addClass(options.selectClass); 287 288 } 289 290 function prevResult() { 291 292 $currentResult = getCurrentResult(); 293 294 if ($currentResult) 295 $currentResult 296 .removeClass(options.selectClass) 297 .prev() 298 .addClass(options.selectClass); 299 else 300 $results.children('li:last-child').addClass(options.selectClass); 301 302 } 303 304 } 305 306 $.fn.suggest = function(source, options) { 307 308 if (!source) 309 return; 310 311 options = options || {}; 312 options.multiple = options.multiple || false; 313 options.multipleSep = options.multipleSep || ", "; 314 options.source = source; 315 options.delay = options.delay || 100; 316 options.resultsClass = options.resultsClass || 'ac_results'; 317 options.selectClass = options.selectClass || 'ac_over'; 318 options.matchClass = options.matchClass || 'ac_match'; 319 options.minchars = options.minchars || 2; 320 options.delimiter = options.delimiter || '\n'; 321 options.onSelect = options.onSelect || false; 322 options.maxCacheSize = options.maxCacheSize || 65536; 323 324 this.each(function() { 325 new $.suggest(this, options); 326 }); 327 328 return this; 329 330 }; 331 332 })(jQuery); 1 (function(a){a.suggest=function(o,g){var c=a(o).attr("autocomplete","off");var f=a(document.createElement("ul"));var n=false;var d=0;var q=[];var p=0;f.addClass(g.resultsClass).appendTo("body");j();a(window).load(j).resize(j);c.blur(function(){setTimeout(function(){f.hide()},200)});try{f.bgiframe()}catch(s){}if(a.browser.mozilla){c.keypress(m)}else{c.keydown(m)}function j(){var e=c.offset();f.css({top:(e.top+o.offsetHeight)+"px",left:e.left+"px"})}function m(w){if((/27$|38$|40$/.test(w.keyCode)&&f.is(":visible"))||(/^13$|^9$/.test(w.keyCode)&&u())){if(w.preventDefault){w.preventDefault()}if(w.stopPropagation){w.stopPropagation()}w.cancelBubble=true;w.returnValue=false;switch(w.keyCode){case 38:k();break;case 40:t();break;case 9:case 13:r();break;case 27:f.hide();break}}else{if(c.val().length!=d){if(n){clearTimeout(n)}n=setTimeout(l,g.delay);d=c.val().length}}}function l(){var w=a.trim(c.val());if(g.multiple){var e=w.lastIndexOf(g.multipleSep);if(e!=-1){w=w.substr(e+g.multipleSep.length)}}if(w.length>=g.minchars){cached=v(w);if(cached){i(cached.items)}else{a.get(g.source,{q:w},function(x){f.hide();var y=b(x,w);i(y);h(w,y,x.length)})}}else{f.hide()}}function v(w){for(var e=0;e<q.length;e++){if(q[e]["q"]==w){q.unshift(q.splice(e,1)[0]);return q[0]}}return false}function h(y,e,w){while(q.length&&(p+w>g.maxCacheSize)){var x=q.pop();p-=x.size}q.push({q:y,size:w,items:e});p+=w}function i(e){if(!e){return}if(!e.length){f.hide();return}j();var x="";for(var w=0;w<e.length;w++){x+="<li>"+e[w]+"</li>"}f.html(x).show();f.children("li").mouseover(function(){f.children("li").removeClass(g.selectClass);a(this).addClass(g.selectClass)}).click(function(y){y.preventDefault();y.stopPropagation();r()})}function b(e,z){var w=[];var A=e.split(g.delimiter);for(var y=0;y<A.length;y++){var x=a.trim(A[y]);if(x){x=x.replace(new RegExp(z,"ig"),function(B){return'<span class="'+g.matchClass+'">'+B+"</span>"});w[w.length]=x}}return w}function u(){if(!f.is(":visible")){return false}var e=f.children("li."+g.selectClass);if(!e.length){e=false}return e}function r(){$currentResult=u();if($currentResult){if(g.multiple){if(c.val().indexOf(g.multipleSep)!=-1){$currentVal=c.val().substr(0,(c.val().lastIndexOf(g.multipleSep)+g.multipleSep.length))}else{$currentVal=""}c.val($currentVal+$currentResult.text()+g.multipleSep);c.focus()}else{c.val($currentResult.text())}f.hide();if(g.onSelect){g.onSelect.apply(c[0])}}}function t(){$currentResult=u();if($currentResult){$currentResult.removeClass(g.selectClass).next().addClass(g.selectClass)}else{f.children("li:first-child").addClass(g.selectClass)}}function k(){$currentResult=u();if($currentResult){$currentResult.removeClass(g.selectClass).prev().addClass(g.selectClass)}else{f.children("li:last-child").addClass(g.selectClass)}}};a.fn.suggest=function(c,b){if(!c){return}b=b||{};b.multiple=b.multiple||false;b.multipleSep=b.multipleSep||", ";b.source=c;b.delay=b.delay||100;b.resultsClass=b.resultsClass||"ac_results";b.selectClass=b.selectClass||"ac_over";b.matchClass=b.matchClass||"ac_match";b.minchars=b.minchars||2;b.delimiter=b.delimiter||"\n";b.onSelect=b.onSelect||false;b.maxCacheSize=b.maxCacheSize||65536;this.each(function(){new a.suggest(this,b)});return this}})(jQuery); -
trunk/wp-includes/js/jquery/ui.core.js
r8601 r10291 1 eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(3(C){C.8={2r:{V:3(E,F,H){6 G=C.8[E].o;1v(6 D 2q H){G.w[D]=G.w[D]||[];G.w[D].2p([F,H[D]])}},1p:3(D,F,E){6 H=D.w[F];5(!H){4}1v(6 G=0;G<H.1e;G++){5(D.a[H[G][0]]){H[G][1].v(D.c,E)}}}},p:{},d:3(D){5(C.8.p[D]){4 C.8.p[D]}6 E=C(\'<2o 2n="8-2m">\').1k(D).d({2l:"2k",12:"-1u",2j:"-1u",2i:"2h"}).2g("1t");C.8.p[D]=!!((!(/2f|2e/).h(E.d("2d"))||(/^[1-9]/).h(E.d("2c"))||(/^[1-9]/).h(E.d("2b"))||!(/1r/).h(E.d("2a"))||!(/29|28\\(0, 0, 0, 0\\)/).h(E.d("27"))));26{C("1t").1s(0).25(E.1s(0))}24(F){}4 C.8.p[D]},23:3(D){C(D).k("j","1i").d("1q","1r")},22:3(D){C(D).k("j","21").d("1q","")},20:3(G,E){6 D=/12/.h(E||"12")?"1Z":"1Y",F=7;5(G[D]>0){4 f}G[D]=1;F=G[D]>0?f:7;G[D]=0;4 F}};6 B=C.10.u;C.10.u=3(){C("*",2).V(2).1X("u");4 B.v(2,1o)};3 A(E,F,G){6 D=C[E][F].1W||[];D=(X D=="W"?D.11(/,?\\s+/):D);4(C.1V(G,D)!=-1)}C.m=3(E,D){6 F=E.11(".")[0];E=E.11(".")[1];C.10[E]=3(J){6 H=(X J=="W"),I=1U.o.1T.1p(1o,1);5(H&&A(F,E,J)){6 G=C.Z(2[0],E);4(G?G[J].v(G,I):1S)}4 2.1R(3(){6 K=C.Z(2,E);5(H&&K&&C.1Q(K[J])){K[J].v(K,I)}1P{5(!H){C.Z(2,E,1O C[F][E](2,J))}}})};C[F][E]=3(I,H){6 G=2;2.e=E;2.1j=F+"-"+E;2.a=C.1n({},C.m.q,C[F][E].q,H);2.c=C(I).g("n."+E,3(L,J,K){4 G.n(J,K)}).g("Y."+E,3(K,J){4 G.Y(J)}).g("u",3(){4 G.1l()});2.1m()};C[F][E].o=C.1n({},C.m.o,D)};C.m.o={1m:3(){},1l:3(){2.c.1N(2.e)},Y:3(D){4 2.a[D]},n:3(D,E){2.a[D]=E;5(D=="l"){2.c[E?"1k":"1M"](2.1j+"-l")}},1L:3(){2.n("l",7)},1K:3(){2.n("l",f)}};C.m.q={l:7};C.8.14={1J:3(){6 D=2;2.c.g("1I."+2.e,3(E){4 D.1g(E)});5(C.U.T){2.1h=2.c.k("j");2.c.k("j","1i")}2.1H=7},1G:3(){2.c.R("."+2.e);(C.U.T&&2.c.k("j",2.1h))},1g:3(F){(2.b&&2.i(F));2.t=F;6 E=2,G=(F.1F==1),D=(X 2.a.y=="W"?C(F.1f).1E().V(F.1f).1D(2.a.y).1e:7);5(!G||D||!2.15(F)){4 f}2.r=!2.a.x;5(!2.r){2.1C=1B(3(){E.r=f},2.a.x)}5(2.P(F)&&2.N(F)){2.b=(2.M(F)!==7);5(!2.b){F.1A();4 f}}2.S=3(H){4 E.1d(H)};2.Q=3(H){4 E.i(H)};C(1c).g("1b."+2.e,2.S).g("1a."+2.e,2.Q);4 7},1d:3(D){5(C.U.T&&!D.1z){4 2.i(D)}5(2.b){2.z(D);4 7}5(2.P(D)&&2.N(D)){2.b=(2.M(2.t,D)!==7);(2.b?2.z(D):2.i(D))}4!2.b},i:3(D){C(1c).R("1b."+2.e,2.S).R("1a."+2.e,2.Q);5(2.b){2.b=7;2.16(D)}4 7},P:3(D){4(O.1y(O.18(2.t.19-D.19),O.18(2.t.17-D.17))>=2.a.13)},N:3(D){4 2.r},M:3(D){},z:3(D){},16:3(D){},15:3(D){4 f}};C.8.14.q={y:1x,13:1,x:0}})(1w)',62,152,'||this|function|return|if|var|false|ui||options|_mouseStarted|element|css|widgetName|true|bind|test|mouseUp|unselectable|attr|disabled|widget|setData|prototype|cssCache|defaults|_mouseDelayMet||_mouseDownEvent|remove|apply|plugins|delay|cancel|mouseDrag|||||||||||||mouseStart|mouseDelayMet|Math|mouseDistanceMet|_mouseUpDelegate|unbind|_mouseMoveDelegate|msie|browser|add|string|typeof|getData|data|fn|split|top|distance|mouse|mouseCapture|mouseStop|pageY|abs|pageX|mouseup|mousemove|document|mouseMove|length|target|mouseDown|_mouseUnselectable|on|widgetBaseClass|addClass|destroy|init|extend|arguments|call|MozUserSelect|none|get|body|5000px|for|jQuery|null|max|button|preventDefault|setTimeout|_mouseDelayTimer|filter|parents|which|mouseDestroy|started|mousedown|mouseInit|disable|enable|removeClass|removeData|new|else|isFunction|each|undefined|slice|Array|inArray|getter|triggerHandler|scrollLeft|scrollTop|hasScroll|off|enableSelection|disableSelection|catch|removeChild|try|backgroundColor|rgba|transparent|backgroundImage|width|height|cursor|default|auto|appendTo|block|display|left|absolute|position|gen|class|div|push|in|plugin'.split('|'),0,{})) 2 1 (function(C){C.ui={plugin:{add:function(E,F,H){var G=C.ui[E].prototype;for(var D in H){G.plugins[D]=G.plugins[D]||[];G.plugins[D].push([F,H[D]])}},call:function(D,F,E){var H=D.plugins[F];if(!H){return }for(var G=0;G<H.length;G++){if(D.options[H[G][0]]){H[G][1].apply(D.element,E)}}}},cssCache:{},css:function(D){if(C.ui.cssCache[D]){return C.ui.cssCache[D]}var E=C('<div class="ui-gen">').addClass(D).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");C.ui.cssCache[D]=!!((!(/auto|default/).test(E.css("cursor"))||(/^[1-9]/).test(E.css("height"))||(/^[1-9]/).test(E.css("width"))||!(/none/).test(E.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(E.css("backgroundColor"))));try{C("body").get(0).removeChild(E.get(0))}catch(F){}return C.ui.cssCache[D]},disableSelection:function(D){C(D).attr("unselectable","on").css("MozUserSelect","none")},enableSelection:function(D){C(D).attr("unselectable","off").css("MozUserSelect","")},hasScroll:function(G,E){var D=/top/.test(E||"top")?"scrollTop":"scrollLeft",F=false;if(G[D]>0){return true}G[D]=1;F=G[D]>0?true:false;G[D]=0;return F}};var B=C.fn.remove;C.fn.remove=function(){C("*",this).add(this).triggerHandler("remove");return B.apply(this,arguments)};function A(E,F,G){var D=C[E][F].getter||[];D=(typeof D=="string"?D.split(/,?\s+/):D);return(C.inArray(G,D)!=-1)}C.widget=function(E,D){var F=E.split(".")[0];E=E.split(".")[1];C.fn[E]=function(J){var H=(typeof J=="string"),I=Array.prototype.slice.call(arguments,1);if(H&&A(F,E,J)){var G=C.data(this[0],E);return(G?G[J].apply(G,I):undefined)}return this.each(function(){var K=C.data(this,E);if(H&&K&&C.isFunction(K[J])){K[J].apply(K,I)}else{if(!H){C.data(this,E,new C[F][E](this,J))}}})};C[F][E]=function(I,H){var G=this;this.widgetName=E;this.widgetBaseClass=F+"-"+E;this.options=C.extend({},C.widget.defaults,C[F][E].defaults,H);this.element=C(I).bind("setData."+E,function(L,J,K){return G.setData(J,K)}).bind("getData."+E,function(K,J){return G.getData(J)}).bind("remove",function(){return G.destroy()});this.init()};C[F][E].prototype=C.extend({},C.widget.prototype,D)};C.widget.prototype={init:function(){},destroy:function(){this.element.removeData(this.widgetName)},getData:function(D){return this.options[D]},setData:function(D,E){this.options[D]=E;if(D=="disabled"){this.element[E?"addClass":"removeClass"](this.widgetBaseClass+"-disabled")}},enable:function(){this.setData("disabled",false)},disable:function(){this.setData("disabled",true)}};C.widget.defaults={disabled:false};C.ui.mouse={mouseInit:function(){var D=this;this.element.bind("mousedown."+this.widgetName,function(E){return D.mouseDown(E)});if(C.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},mouseDestroy:function(){this.element.unbind("."+this.widgetName);(C.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},mouseDown:function(F){(this._mouseStarted&&this.mouseUp(F));this._mouseDownEvent=F;var E=this,G=(F.which==1),D=(typeof this.options.cancel=="string"?C(F.target).parents().add(F.target).filter(this.options.cancel).length:false);if(!G||D||!this.mouseCapture(F)){return true}this._mouseDelayMet=!this.options.delay;if(!this._mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){E._mouseDelayMet=true},this.options.delay)}if(this.mouseDistanceMet(F)&&this.mouseDelayMet(F)){this._mouseStarted=(this.mouseStart(F)!==false);if(!this._mouseStarted){F.preventDefault();return true}}this._mouseMoveDelegate=function(H){return E.mouseMove(H)};this._mouseUpDelegate=function(H){return E.mouseUp(H)};C(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);return false},mouseMove:function(D){if(C.browser.msie&&!D.button){return this.mouseUp(D)}if(this._mouseStarted){this.mouseDrag(D);return false}if(this.mouseDistanceMet(D)&&this.mouseDelayMet(D)){this._mouseStarted=(this.mouseStart(this._mouseDownEvent,D)!==false);(this._mouseStarted?this.mouseDrag(D):this.mouseUp(D))}return !this._mouseStarted},mouseUp:function(D){C(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this.mouseStop(D)}return false},mouseDistanceMet:function(D){return(Math.max(Math.abs(this._mouseDownEvent.pageX-D.pageX),Math.abs(this._mouseDownEvent.pageY-D.pageY))>=this.options.distance)},mouseDelayMet:function(D){return this._mouseDelayMet},mouseStart:function(D){},mouseDrag:function(D){},mouseStop:function(D){},mouseCapture:function(D){return true}};C.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery) -
trunk/wp-includes/js/jquery/ui.tabs.js
r8601 r10291 1 eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(4(A){A.3g("8.3",{3f:4(){2.c.t+=".3";2.1f(1d)},3e:4(B,C){5((/^7/).26(B)){2.17(C)}m{2.c[B]=C;2.1f()}},j:4(){d 2.$3.j},1G:4(B){d B.2b&&B.2b.14(/\\s/g,"2a").14(/[^A-3d-3c-9\\-2a:\\.]/g,"")||2.c.1S+A.f(B)},8:4(C,B){d{c:2.c,3b:C,1O:B,V:2.$3.V(C)}},1f:4(O){2.$i=A("1j:3a(a[n])",2.h);2.$3=2.$i.1t(4(){d A("a",2)[0]});2.$b=A([]);6 P=2,D=2.c;2.$3.X(4(R,Q){5(Q.v&&Q.v.14("#","")){P.$b=P.$b.1c(Q.v)}m{5(A(Q).13("n")!="#"){A.f(Q,"n.3",Q.n);A.f(Q,"p.3",Q.n);6 T=P.1G(Q);Q.n="#"+T;6 S=A("#"+T);5(!S.j){S=A(D.1z).13("1g",T).l(D.19).39(P.$b[R-1]||P.h);S.f("1b.3",1d)}P.$b=P.$b.1c(S)}m{D.e.1Y(R+1)}}});5(O){2.h.l(D.1y);2.$b.X(4(){6 Q=A(2);Q.l(D.19)});5(D.7===1q){5(1L.v){2.$3.X(4(S,Q){5(Q.v==1L.v){D.7=S;5(A.Y.1h||A.Y.38){6 R=A(1L.v),T=R.13("1g");R.13("1g","");1B(4(){R.13("1g",T)},37)}36(0,0);d o}})}m{5(D.11){6 J=35(A.11("8-3"+A.f(P.h)),10);5(J&&P.$3[J]){D.7=J}}m{5(P.$i.U("."+D.k).j){D.7=P.$i.V(P.$i.U("."+D.k)[0])}}}}D.7=D.7===w||D.7!==1q?D.7:0;D.e=A.34(D.e.33(A.1t(2.$i.U("."+D.W),4(R,Q){d P.$i.V(R)}))).1X();5(A.1s(D.7,D.e)!=-1){D.e.32(A.1s(D.7,D.e),1)}2.$b.l(D.x);2.$i.q(D.k);5(D.7!==w){2.$b.r(D.7).1I().q(D.x);2.$i.r(D.7).l(D.k);6 K=4(){A(P.h).z("1v",[P.u("1v"),P.8(P.$3[D.7],P.$b[D.7])],D.1I)};5(A.f(2.$3[D.7],"p.3")){2.p(D.7,K)}m{K()}}A(31).16("30",4(){P.$3.15(".3");P.$i=P.$3=P.$b=w})}2Z(6 G=0,N;N=2.$i[G];G++){A(N)[A.1s(G,D.e)!=-1&&!A(N).12(D.k)?"l":"q"](D.W)}5(D.y===o){2.$3.1n("y.3")}6 C,I,B={"2Y-2X":0,1K:1},E="2W";5(D.Z&&D.Z.2V==2U){C=D.Z[0]||B,I=D.Z[1]||B}m{C=I=D.Z||B}6 H={1r:"",2T:"",2S:""};5(!A.Y.1h){H.1J=""}4 M(R,Q,S){Q.29(C,C.1K||E,4(){Q.l(D.x).1e(H);5(A.Y.1h&&C.1J){Q[0].28.U=""}5(S){L(R,S,Q)}})}4 L(R,S,Q){5(I===B){S.1e("1r","1F")}S.29(I,I.1K||E,4(){S.q(D.x).1e(H);5(A.Y.1h&&I.1J){S[0].28.U=""}A(P.h).z("1v",[P.u("1v"),P.8(R,S[0])],D.1I)})}4 F(R,T,Q,S){T.l(D.k).2R().q(D.k);M(R,Q,S)}2.$3.15(".3").16(D.t,4(){6 T=A(2).2Q("1j:r(0)"),Q=P.$b.U(":2P"),S=A(2.v);5((T.12(D.k)&&!D.1i)||T.12(D.W)||A(2).12(D.18)||A(P.h).z("27",[P.u("27"),P.8(2,S[0])],D.17)===o){2.1u();d o}P.c.7=P.$3.V(2);5(D.1i){5(T.12(D.k)){P.c.7=w;T.q(D.k);P.$b.1H();M(2,Q);2.1u();d o}m{5(!Q.j){P.$b.1H();6 R=2;P.p(P.$3.V(2),4(){T.l(D.k).l(D.1x);L(R,S)});2.1u();d o}}}5(D.11){A.11("8-3"+A.f(P.h),P.c.7,D.11)}P.$b.1H();5(S.j){6 R=2;P.p(P.$3.V(2),Q.j?4(){F(R,T,Q,S)}:4(){T.l(D.k);L(R,S)})}m{2O"1M 2N 2M: 2L 2K 2J."}5(A.Y.1h){2.1u()}d o});5(!(/^1A/).26(D.t)){2.$3.16("1A.3",4(){d o})}},1c:4(E,D,C){5(C==1q){C=2.$3.j}6 G=2.c;6 I=A(G.1R.14(/#\\{n\\}/g,E).14(/#\\{1k\\}/g,D));I.f("1b.3",1d);6 H=E.2I("#")==0?E.14("#",""):2.1G(A("a:2H-2G",I)[0]);6 F=A("#"+H);5(!F.j){F=A(G.1z).13("1g",H).l(G.x).f("1b.3",1d)}F.l(G.19);5(C>=2.$i.j){I.25(2.h);F.25(2.h[0].2F)}m{I.24(2.$i[C]);F.24(2.$b[C])}G.e=A.1t(G.e,4(K,J){d K>=C?++K:K});2.1f();5(2.$3.j==1){I.l(G.k);F.q(G.x);6 B=A.f(2.$3[0],"p.3");5(B){2.p(C,B)}}2.h.z("23",[2.u("23"),2.8(2.$3[C],2.$b[C])],G.1c)},1a:4(B){6 D=2.c,E=2.$i.r(B).1a(),C=2.$b.r(B).1a();5(E.12(D.k)&&2.$3.j>1){2.17(B+(B+1<2.$3.j?1:-1))}D.e=A.1t(A.21(D.e,4(G,F){d G!=B}),4(G,F){d G>=B?--G:G});2.1f();2.h.z("22",[2.u("22"),2.8(E.1E("a")[0],C[0])],D.1a)},1Z:4(B){6 C=2.c;5(A.1s(B,C.e)==-1){d}6 D=2.$i.r(B).q(C.W);5(A.Y.2E){D.1e("1r","2D-1F");1B(4(){D.1e("1r","1F")},0)}C.e=A.21(C.e,4(F,E){d F!=B});2.h.z("20",[2.u("20"),2.8(2.$3[B],2.$b[B])],C.1Z)},1V:4(C){6 B=2,D=2.c;5(C!=D.7){2.$i.r(C).l(D.W);D.e.1Y(C);D.e.1X();2.h.z("1W",[2.u("1W"),2.8(2.$3[C],2.$b[C])],D.1V)}},17:4(B){5(2C B=="2B"){B=2.$3.V(2.$3.U("[n$="+B+"]")[0])}2.$3.r(B).2A(2.c.t)},p:4(G,K){6 L=2,D=2.c,E=2.$3.r(G),J=E[0],H=K==1q||K===o,B=E.f("p.3");K=K||4(){};5(!B||!H&&A.f(J,"y.3")){K();d}6 M=4(N){6 O=A(N),P=O.1E("*:2z");d P.j&&P.2y(":2x(2w)")&&P||O};6 C=4(){L.$3.U("."+D.18).q(D.18).X(4(){5(D.1m){M(2).2v().1p(M(2).f("1k.3"))}});L.1o=w};5(D.1m){6 I=M(J).1p();M(J).2u("<1D></1D>").1E("1D").f("1k.3",I).1p(D.1m)}6 F=A.1N({},D.1l,{1T:B,1C:4(O,N){A(J.v).1p(O);C();5(D.y){A.f(J,"y.3",1d)}A(L.h).z("1U",[L.u("1U"),L.8(L.$3[G],L.$b[G])],D.p);D.1l.1C&&D.1l.1C(O,N);K()}});5(2.1o){2.1o.2t();C()}E.l(D.18);1B(4(){L.1o=A.2s(F)},0)},1T:4(C,B){2.$3.r(C).1n("y.3").f("p.3",B)},1b:4(){6 B=2.c;2.h.15(".3").q(B.1y).1n("3");2.$3.X(4(){6 C=A.f(2,"n.3");5(C){2.n=C}6 D=A(2).15(".3");A.X(["n","p","y"],4(E,F){D.1n(F+".3")})});2.$i.1c(2.$b).X(4(){5(A.f(2,"1b.3")){A(2).1a()}m{A(2).q([B.k,B.1x,B.W,B.19,B.x].2r(" "))}})},u:4(B){d A.t.2q({2p:B,2o:2.h[0]})}});A.8.3.2n={1i:o,t:"1A",e:[],11:w,1m:"2ml;",y:o,1S:"8-3-",1l:{},Z:w,1R:\'<1j><a n="#{n}"><1Q>#{1k}</1Q></a></1j>\',1z:"<1P></1P>",1y:"8-3-2k",k:"8-3-7",1x:"8-3-1i",W:"8-3-e",19:"8-3-1O",x:"8-3-2j",18:"8-3-2i"};A.8.3.2h="j";A.1N(A.8.3.2g,{1w:w,2f:4(C,F){F=F||o;6 B=2,E=2.c.7;4 G(){B.1w=2e(4(){E=++E<B.$3.j?E:0;B.17(E)},C)}4 D(H){5(!H||H.2d){2c(B.1w)}}5(C){G();5(!F){2.$3.16(2.c.t,D)}m{2.$3.16(2.c.t,4(){D();E=B.c.7;G()})}}m{D();2.$3.15(2.c.t,D)}}})})(1M)',62,203,'||this|tabs|function|if|var|selected|ui|||panels|options|return|disabled|data||element|lis|length|selectedClass|addClass|else|href|false|load|removeClass|eq||event|fakeEvent|hash|null|hideClass|cache|triggerHandler|||||||||||||||||||||filter|index|disabledClass|each|browser|fx||cookie|hasClass|attr|replace|unbind|bind|select|loadingClass|panelClass|remove|destroy|add|true|css|tabify|id|msie|unselect|li|label|ajaxOptions|spinner|removeData|xhr|html|undefined|display|inArray|map|blur|tabsshow|rotation|unselectClass|navClass|panelTemplate|click|setTimeout|success|em|find|block|tabId|stop|show|opacity|duration|location|jQuery|extend|panel|div|span|tabTemplate|idPrefix|url|tabsload|disable|tabsdisable|sort|push|enable|tabsenable|grep|tabsremove|tabsadd|insertBefore|appendTo|test|tabsselect|style|animate|_|title|clearInterval|clientX|setInterval|rotate|prototype|getter|loading|hide|nav|8230|Loading|defaults|target|type|fix|join|ajax|abort|wrapInner|parent|img|not|is|last|trigger|string|typeof|inline|safari|parentNode|child|first|indexOf|identifier|fragment|Mismatching|Tabs|UI|throw|visible|parents|siblings|height|overflow|Array|constructor|normal|width|min|for|unload|window|splice|concat|unique|parseInt|scrollTo|500|opera|insertAfter|has|tab|z0|Za|setData|init|widget'.split('|'),0,{})) 2 1 (function(A){A.widget("ui.tabs",{init:function(){this.options.event+=".tabs";this.tabify(true)},setData:function(B,C){if((/^selected/).test(B)){this.select(C)}else{this.options[B]=C;this.tabify()}},length:function(){return this.$tabs.length},tabId:function(B){return B.title&&B.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+A.data(B)},ui:function(C,B){return{options:this.options,tab:C,panel:B,index:this.$tabs.index(C)}},tabify:function(O){this.$lis=A("li:has(a[href])",this.element);this.$tabs=this.$lis.map(function(){return A("a",this)[0]});this.$panels=A([]);var P=this,D=this.options;this.$tabs.each(function(R,Q){if(Q.hash&&Q.hash.replace("#","")){P.$panels=P.$panels.add(Q.hash)}else{if(A(Q).attr("href")!="#"){A.data(Q,"href.tabs",Q.href);A.data(Q,"load.tabs",Q.href);var T=P.tabId(Q);Q.href="#"+T;var S=A("#"+T);if(!S.length){S=A(D.panelTemplate).attr("id",T).addClass(D.panelClass).insertAfter(P.$panels[R-1]||P.element);S.data("destroy.tabs",true)}P.$panels=P.$panels.add(S)}else{D.disabled.push(R+1)}}});if(O){this.element.addClass(D.navClass);this.$panels.each(function(){var Q=A(this);Q.addClass(D.panelClass)});if(D.selected===undefined){if(location.hash){this.$tabs.each(function(S,Q){if(Q.hash==location.hash){D.selected=S;if(A.browser.msie||A.browser.opera){var R=A(location.hash),T=R.attr("id");R.attr("id","");setTimeout(function(){R.attr("id",T)},500)}scrollTo(0,0);return false}})}else{if(D.cookie){var J=parseInt(A.cookie("ui-tabs"+A.data(P.element)),10);if(J&&P.$tabs[J]){D.selected=J}}else{if(P.$lis.filter("."+D.selectedClass).length){D.selected=P.$lis.index(P.$lis.filter("."+D.selectedClass)[0])}}}}D.selected=D.selected===null||D.selected!==undefined?D.selected:0;D.disabled=A.unique(D.disabled.concat(A.map(this.$lis.filter("."+D.disabledClass),function(R,Q){return P.$lis.index(R)}))).sort();if(A.inArray(D.selected,D.disabled)!=-1){D.disabled.splice(A.inArray(D.selected,D.disabled),1)}this.$panels.addClass(D.hideClass);this.$lis.removeClass(D.selectedClass);if(D.selected!==null){this.$panels.eq(D.selected).show().removeClass(D.hideClass);this.$lis.eq(D.selected).addClass(D.selectedClass);var K=function(){A(P.element).triggerHandler("tabsshow",[P.fakeEvent("tabsshow"),P.ui(P.$tabs[D.selected],P.$panels[D.selected])],D.show)};if(A.data(this.$tabs[D.selected],"load.tabs")){this.load(D.selected,K)}else{K()}}A(window).bind("unload",function(){P.$tabs.unbind(".tabs");P.$lis=P.$tabs=P.$panels=null})}for(var G=0,N;N=this.$lis[G];G++){A(N)[A.inArray(G,D.disabled)!=-1&&!A(N).hasClass(D.selectedClass)?"addClass":"removeClass"](D.disabledClass)}if(D.cache===false){this.$tabs.removeData("cache.tabs")}var C,I,B={"min-width":0,duration:1},E="normal";if(D.fx&&D.fx.constructor==Array){C=D.fx[0]||B,I=D.fx[1]||B}else{C=I=D.fx||B}var H={display:"",overflow:"",height:""};if(!A.browser.msie){H.opacity=""}function M(R,Q,S){Q.animate(C,C.duration||E,function(){Q.addClass(D.hideClass).css(H);if(A.browser.msie&&C.opacity){Q[0].style.filter=""}if(S){L(R,S,Q)}})}function L(R,S,Q){if(I===B){S.css("display","block")}S.animate(I,I.duration||E,function(){S.removeClass(D.hideClass).css(H);if(A.browser.msie&&I.opacity){S[0].style.filter=""}A(P.element).triggerHandler("tabsshow",[P.fakeEvent("tabsshow"),P.ui(R,S[0])],D.show)})}function F(R,T,Q,S){T.addClass(D.selectedClass).siblings().removeClass(D.selectedClass);M(R,Q,S)}this.$tabs.unbind(".tabs").bind(D.event,function(){var T=A(this).parents("li:eq(0)"),Q=P.$panels.filter(":visible"),S=A(this.hash);if((T.hasClass(D.selectedClass)&&!D.unselect)||T.hasClass(D.disabledClass)||A(this).hasClass(D.loadingClass)||A(P.element).triggerHandler("tabsselect",[P.fakeEvent("tabsselect"),P.ui(this,S[0])],D.select)===false){this.blur();return false}P.options.selected=P.$tabs.index(this);if(D.unselect){if(T.hasClass(D.selectedClass)){P.options.selected=null;T.removeClass(D.selectedClass);P.$panels.stop();M(this,Q);this.blur();return false}else{if(!Q.length){P.$panels.stop();var R=this;P.load(P.$tabs.index(this),function(){T.addClass(D.selectedClass).addClass(D.unselectClass);L(R,S)});this.blur();return false}}}if(D.cookie){A.cookie("ui-tabs"+A.data(P.element),P.options.selected,D.cookie)}P.$panels.stop();if(S.length){var R=this;P.load(P.$tabs.index(this),Q.length?function(){F(R,T,Q,S)}:function(){T.addClass(D.selectedClass);L(R,S)})}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(A.browser.msie){this.blur()}return false});if(!(/^click/).test(D.event)){this.$tabs.bind("click.tabs",function(){return false})}},add:function(E,D,C){if(C==undefined){C=this.$tabs.length}var G=this.options;var I=A(G.tabTemplate.replace(/#\{href\}/g,E).replace(/#\{label\}/g,D));I.data("destroy.tabs",true);var H=E.indexOf("#")==0?E.replace("#",""):this.tabId(A("a:first-child",I)[0]);var F=A("#"+H);if(!F.length){F=A(G.panelTemplate).attr("id",H).addClass(G.hideClass).data("destroy.tabs",true)}F.addClass(G.panelClass);if(C>=this.$lis.length){I.appendTo(this.element);F.appendTo(this.element[0].parentNode)}else{I.insertBefore(this.$lis[C]);F.insertBefore(this.$panels[C])}G.disabled=A.map(G.disabled,function(K,J){return K>=C?++K:K});this.tabify();if(this.$tabs.length==1){I.addClass(G.selectedClass);F.removeClass(G.hideClass);var B=A.data(this.$tabs[0],"load.tabs");if(B){this.load(C,B)}}this.element.triggerHandler("tabsadd",[this.fakeEvent("tabsadd"),this.ui(this.$tabs[C],this.$panels[C])],G.add)},remove:function(B){var D=this.options,E=this.$lis.eq(B).remove(),C=this.$panels.eq(B).remove();if(E.hasClass(D.selectedClass)&&this.$tabs.length>1){this.select(B+(B+1<this.$tabs.length?1:-1))}D.disabled=A.map(A.grep(D.disabled,function(G,F){return G!=B}),function(G,F){return G>=B?--G:G});this.tabify();this.element.triggerHandler("tabsremove",[this.fakeEvent("tabsremove"),this.ui(E.find("a")[0],C[0])],D.remove)},enable:function(B){var C=this.options;if(A.inArray(B,C.disabled)==-1){return }var D=this.$lis.eq(B).removeClass(C.disabledClass);if(A.browser.safari){D.css("display","inline-block");setTimeout(function(){D.css("display","block")},0)}C.disabled=A.grep(C.disabled,function(F,E){return F!=B});this.element.triggerHandler("tabsenable",[this.fakeEvent("tabsenable"),this.ui(this.$tabs[B],this.$panels[B])],C.enable)},disable:function(C){var B=this,D=this.options;if(C!=D.selected){this.$lis.eq(C).addClass(D.disabledClass);D.disabled.push(C);D.disabled.sort();this.element.triggerHandler("tabsdisable",[this.fakeEvent("tabsdisable"),this.ui(this.$tabs[C],this.$panels[C])],D.disable)}},select:function(B){if(typeof B=="string"){B=this.$tabs.index(this.$tabs.filter("[href$="+B+"]")[0])}this.$tabs.eq(B).trigger(this.options.event)},load:function(G,K){var L=this,D=this.options,E=this.$tabs.eq(G),J=E[0],H=K==undefined||K===false,B=E.data("load.tabs");K=K||function(){};if(!B||!H&&A.data(J,"cache.tabs")){K();return }var M=function(N){var O=A(N),P=O.find("*:last");return P.length&&P.is(":not(img)")&&P||O};var C=function(){L.$tabs.filter("."+D.loadingClass).removeClass(D.loadingClass).each(function(){if(D.spinner){M(this).parent().html(M(this).data("label.tabs"))}});L.xhr=null};if(D.spinner){var I=M(J).html();M(J).wrapInner("<em></em>").find("em").data("label.tabs",I).html(D.spinner)}var F=A.extend({},D.ajaxOptions,{url:B,success:function(O,N){A(J.hash).html(O);C();if(D.cache){A.data(J,"cache.tabs",true)}A(L.element).triggerHandler("tabsload",[L.fakeEvent("tabsload"),L.ui(L.$tabs[G],L.$panels[G])],D.load);D.ajaxOptions.success&&D.ajaxOptions.success(O,N);K()}});if(this.xhr){this.xhr.abort();C()}E.addClass(D.loadingClass);setTimeout(function(){L.xhr=A.ajax(F)},0)},url:function(C,B){this.$tabs.eq(C).removeData("cache.tabs").data("load.tabs",B)},destroy:function(){var B=this.options;this.element.unbind(".tabs").removeClass(B.navClass).removeData("tabs");this.$tabs.each(function(){var C=A.data(this,"href.tabs");if(C){this.href=C}var D=A(this).unbind(".tabs");A.each(["href","load","cache"],function(E,F){D.removeData(F+".tabs")})});this.$lis.add(this.$panels).each(function(){if(A.data(this,"destroy.tabs")){A(this).remove()}else{A(this).removeClass([B.selectedClass,B.unselectClass,B.disabledClass,B.panelClass,B.hideClass].join(" "))}})},fakeEvent:function(B){return A.event.fix({type:B,target:this.element[0]})}});A.ui.tabs.defaults={unselect:false,event:"click",disabled:[],cookie:null,spinner:"Loading…",cache:false,idPrefix:"ui-tabs-",ajaxOptions:{},fx:null,tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>',panelTemplate:"<div></div>",navClass:"ui-tabs-nav",selectedClass:"ui-tabs-selected",unselectClass:"ui-tabs-unselect",disabledClass:"ui-tabs-disabled",panelClass:"ui-tabs-panel",hideClass:"ui-tabs-hide",loadingClass:"ui-tabs-loading"};A.ui.tabs.getter="length";A.extend(A.ui.tabs.prototype,{rotation:null,rotate:function(C,F){F=F||false;var B=this,E=this.options.selected;function G(){B.rotation=setInterval(function(){E=++E<B.$tabs.length?E:0;B.select(E)},C)}function D(H){if(!H||H.clientX){clearInterval(B.rotation)}}if(C){G();if(!F){this.$tabs.bind(this.options.event,D)}else{this.$tabs.bind(this.options.event,function(){D();E=B.options.selected;G()})}}else{D();this.$tabs.unbind(this.options.event,D)}}})})(jQuery) -
trunk/wp-includes/js/quicktags.js
r10150 r10291 1 // new edit toolbar used with permission 2 // by Alex King 3 // http://www.alexking.org/ 4 5 var edButtons = new Array(); 6 var edLinks = new Array(); 7 var edOpenTags = new Array(); 8 9 function edButton(id, display, tagStart, tagEnd, access, open) { 10 this.id = id; // used to name the toolbar button 11 this.display = display; // label on button 12 this.tagStart = tagStart; // open tag 13 this.tagEnd = tagEnd; // close tag 14 this.access = access; // access key 15 this.open = open; // set to -1 if tag does not need to be closed 16 } 17 18 function zeroise(number, threshold) { 19 // FIXME: or we could use an implementation of printf in js here 20 var str = number.toString(); 21 if (number < 0) { str = str.substr(1, str.length) } 22 while (str.length < threshold) { str = "0" + str } 23 if (number < 0) { str = '-' + str } 24 return str; 25 } 26 27 var now = new Date(); 28 var datetime = now.getUTCFullYear() + '-' + 29 zeroise(now.getUTCMonth() + 1, 2) + '-' + 30 zeroise(now.getUTCDate(), 2) + 'T' + 31 zeroise(now.getUTCHours(), 2) + ':' + 32 zeroise(now.getUTCMinutes(), 2) + ':' + 33 zeroise(now.getUTCSeconds() ,2) + 34 '+00:00'; 35 36 edButtons[edButtons.length] = 37 new edButton('ed_strong' 38 ,'b' 39 ,'<strong>' 40 ,'</strong>' 41 ,'b' 42 ); 43 44 edButtons[edButtons.length] = 45 new edButton('ed_em' 46 ,'i' 47 ,'<em>' 48 ,'</em>' 49 ,'i' 50 ); 51 52 edButtons[edButtons.length] = 53 new edButton('ed_link' 54 ,'link' 55 ,'' 56 ,'</a>' 57 ,'a' 58 ); // special case 59 60 edButtons[edButtons.length] = 61 new edButton('ed_block' 62 ,'b-quote' 63 ,'\n\n<blockquote>' 64 ,'</blockquote>\n\n' 65 ,'q' 66 ); 67 68 69 edButtons[edButtons.length] = 70 new edButton('ed_del' 71 ,'del' 72 ,'<del datetime="' + datetime + '">' 73 ,'</del>' 74 ,'d' 75 ); 76 77 edButtons[edButtons.length] = 78 new edButton('ed_ins' 79 ,'ins' 80 ,'<ins datetime="' + datetime + '">' 81 ,'</ins>' 82 ,'s' 83 ); 84 85 edButtons[edButtons.length] = 86 new edButton('ed_img' 87 ,'img' 88 ,'' 89 ,'' 90 ,'m' 91 ,-1 92 ); // special case 93 94 edButtons[edButtons.length] = 95 new edButton('ed_ul' 96 ,'ul' 97 ,'<ul>\n' 98 ,'</ul>\n\n' 99 ,'u' 100 ); 101 102 edButtons[edButtons.length] = 103 new edButton('ed_ol' 104 ,'ol' 105 ,'<ol>\n' 106 ,'</ol>\n\n' 107 ,'o' 108 ); 109 110 edButtons[edButtons.length] = 111 new edButton('ed_li' 112 ,'li' 113 ,'\t<li>' 114 ,'</li>\n' 115 ,'l' 116 ); 117 118 edButtons[edButtons.length] = 119 new edButton('ed_code' 120 ,'code' 121 ,'<code>' 122 ,'</code>' 123 ,'c' 124 ); 125 126 edButtons[edButtons.length] = 127 new edButton('ed_more' 128 ,'more' 129 ,'<!--more-->' 130 ,'' 131 ,'t' 132 ,-1 133 ); 134 /* 135 edButtons[edButtons.length] = 136 new edButton('ed_next' 137 ,'page' 138 ,'<!--nextpage-->' 139 ,'' 140 ,'p' 141 ,-1 142 ); 143 */ 144 function edLink() { 145 this.display = ''; 146 this.URL = ''; 147 this.newWin = 0; 148 } 149 150 edLinks[edLinks.length] = new edLink('WordPress' 151 ,'http://wordpress.org/' 152 ); 153 154 edLinks[edLinks.length] = new edLink('alexking.org' 155 ,'http://www.alexking.org/' 156 ); 157 158 function edShowButton(button, i) { 159 if (button.id == 'ed_img') { 160 document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertImage(edCanvas);" value="' + button.display + '" />'); 161 } 162 else if (button.id == 'ed_link') { 163 document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertLink(edCanvas, ' + i + ');" value="' + button.display + '" />'); 164 } 165 else { 166 document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertTag(edCanvas, ' + i + ');" value="' + button.display + '" />'); 167 } 168 } 169 170 function edShowLinks() { 171 var tempStr = '<select onchange="edQuickLink(this.options[this.selectedIndex].value, this);"><option value="-1" selected>' + quicktagsL10n.quickLinks + '</option>'; 172 for (i = 0; i < edLinks.length; i++) { 173 tempStr += '<option value="' + i + '">' + edLinks[i].display + '</option>'; 174 } 175 tempStr += '</select>'; 176 document.write(tempStr); 177 } 178 179 function edAddTag(button) { 180 if (edButtons[button].tagEnd != '') { 181 edOpenTags[edOpenTags.length] = button; 182 document.getElementById(edButtons[button].id).value = '/' + document.getElementById(edButtons[button].id).value; 183 } 184 } 185 186 function edRemoveTag(button) { 187 for (i = 0; i < edOpenTags.length; i++) { 188 if (edOpenTags[i] == button) { 189 edOpenTags.splice(i, 1); 190 document.getElementById(edButtons[button].id).value = document.getElementById(edButtons[button].id).value.replace('/', ''); 191 } 192 } 193 } 194 195 function edCheckOpenTags(button) { 196 var tag = 0; 197 for (i = 0; i < edOpenTags.length; i++) { 198 if (edOpenTags[i] == button) { 199 tag++; 200 } 201 } 202 if (tag > 0) { 203 return true; // tag found 204 } 205 else { 206 return false; // tag not found 207 } 208 } 209 210 function edCloseAllTags() { 211 var count = edOpenTags.length; 212 for (o = 0; o < count; o++) { 213 edInsertTag(edCanvas, edOpenTags[edOpenTags.length - 1]); 214 } 215 } 216 217 function edQuickLink(i, thisSelect) { 218 if (i > -1) { 219 var newWin = ''; 220 if (edLinks[i].newWin == 1) { 221 newWin = ' target="_blank"'; 222 } 223 var tempStr = '<a href="' + edLinks[i].URL + '"' + newWin + '>' 224 + edLinks[i].display 225 + '</a>'; 226 thisSelect.selectedIndex = 0; 227 edInsertContent(edCanvas, tempStr); 228 } 229 else { 230 thisSelect.selectedIndex = 0; 231 } 232 } 233 234 function edSpell(myField) { 235 var word = ''; 236 if (document.selection) { 237 myField.focus(); 238 var sel = document.selection.createRange(); 239 if (sel.text.length > 0) { 240 word = sel.text; 241 } 242 } 243 else if (myField.selectionStart || myField.selectionStart == '0') { 244 var startPos = myField.selectionStart; 245 var endPos = myField.selectionEnd; 246 if (startPos != endPos) { 247 word = myField.value.substring(startPos, endPos); 248 } 249 } 250 if (word == '') { 251 word = prompt(quicktagsL10n.wordLookup, ''); 252 } 253 if (word !== null && /^\w[\w ]*$/.test(word)) { 254 window.open('http://www.answers.com/' + escape(word)); 255 } 256 } 257 258 function edToolbar() { 259 document.write('<div id="ed_toolbar">'); 260 for (i = 0; i < edButtons.length; i++) { 261 edShowButton(edButtons[i], i); 262 } 263 document.write('<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="' + quicktagsL10n.dictionaryLookup + '" value="' + quicktagsL10n.lookup + '" />'); 264 document.write('<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="' + quicktagsL10n.closeAllOpenTags + '" value="' + quicktagsL10n.closeTags + '" />'); 265 // edShowLinks(); // disabled by default 266 document.write('</div>'); 267 } 268 269 // insertion code 270 271 function edInsertTag(myField, i) { 272 //IE support 273 if (document.selection) { 274 myField.focus(); 275 sel = document.selection.createRange(); 276 if (sel.text.length > 0) { 277 sel.text = edButtons[i].tagStart + sel.text + edButtons[i].tagEnd; 278 } 279 else { 280 if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') { 281 sel.text = edButtons[i].tagStart; 282 edAddTag(i); 283 } 284 else { 285 sel.text = edButtons[i].tagEnd; 286 edRemoveTag(i); 287 } 288 } 289 myField.focus(); 290 } 291 //MOZILLA/NETSCAPE support 292 else if (myField.selectionStart || myField.selectionStart == '0') { 293 var startPos = myField.selectionStart; 294 var endPos = myField.selectionEnd; 295 var cursorPos = endPos; 296 var scrollTop = myField.scrollTop; 297 298 if (startPos != endPos) { 299 myField.value = myField.value.substring(0, startPos) 300 + edButtons[i].tagStart 301 + myField.value.substring(startPos, endPos) 302 + edButtons[i].tagEnd 303 + myField.value.substring(endPos, myField.value.length); 304 cursorPos += edButtons[i].tagStart.length + edButtons[i].tagEnd.length; 305 } 306 else { 307 if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') { 308 myField.value = myField.value.substring(0, startPos) 309 + edButtons[i].tagStart 310 + myField.value.substring(endPos, myField.value.length); 311 edAddTag(i); 312 cursorPos = startPos + edButtons[i].tagStart.length; 313 } 314 else { 315 myField.value = myField.value.substring(0, startPos) 316 + edButtons[i].tagEnd 317 + myField.value.substring(endPos, myField.value.length); 318 edRemoveTag(i); 319 cursorPos = startPos + edButtons[i].tagEnd.length; 320 } 321 } 322 myField.focus(); 323 myField.selectionStart = cursorPos; 324 myField.selectionEnd = cursorPos; 325 myField.scrollTop = scrollTop; 326 } 327 else { 328 if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') { 329 myField.value += edButtons[i].tagStart; 330 edAddTag(i); 331 } 332 else { 333 myField.value += edButtons[i].tagEnd; 334 edRemoveTag(i); 335 } 336 myField.focus(); 337 } 338 } 339 340 function edInsertContent(myField, myValue) { 341 //IE support 342 if (document.selection) { 343 myField.focus(); 344 sel = document.selection.createRange(); 345 sel.text = myValue; 346 myField.focus(); 347 } 348 //MOZILLA/NETSCAPE support 349 else if (myField.selectionStart || myField.selectionStart == '0') { 350 var startPos = myField.selectionStart; 351 var endPos = myField.selectionEnd; 352 myField.value = myField.value.substring(0, startPos) 353 + myValue 354 + myField.value.substring(endPos, myField.value.length); 355 myField.focus(); 356 myField.selectionStart = startPos + myValue.length; 357 myField.selectionEnd = startPos + myValue.length; 358 } else { 359 myField.value += myValue; 360 myField.focus(); 361 } 362 } 363 364 function edInsertLink(myField, i, defaultValue) { 365 if (!defaultValue) { 366 defaultValue = 'http://'; 367 } 368 if (!edCheckOpenTags(i)) { 369 var URL = prompt(quicktagsL10n.enterURL, defaultValue); 370 if (URL) { 371 edButtons[i].tagStart = '<a href="' + URL + '">'; 372 edInsertTag(myField, i); 373 } 374 } 375 else { 376 edInsertTag(myField, i); 377 } 378 } 379 380 function edInsertImage(myField) { 381 var myValue = prompt(quicktagsL10n.enterImageURL, 'http://'); 382 if (myValue) { 383 myValue = '<img src="' 384 + myValue 385 + '" alt="' + prompt(quicktagsL10n.enterImageDescription, '') 386 + '" />'; 387 edInsertContent(myField, myValue); 388 } 389 } 390 391 392 // Allow multiple instances. 393 // Name = unique value, id = textarea id, container = container div. 394 // Can disable some buttons by passing comma delimited string as 4th param. 395 var QTags = function(name, id, container, disabled) { 396 var t = this, cont = document.getElementById(container); 397 398 t.Buttons = []; 399 t.Links = []; 400 t.OpenTags = []; 401 t.Canvas = document.getElementById(id); 402 403 if ( ! t.Canvas || ! cont ) 404 return; 405 406 disabled = ( typeof disabled != 'undefined' ) ? ','+disabled+',' : ''; 407 408 t.edShowButton = function(button, i) { 409 if ( disabled && (disabled.indexOf(','+button.display+',') != -1) ) 410 return ''; 411 else if ( button.id == name+'_img' ) 412 return '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertImage('+name+'.Canvas);" value="' + button.display + '" />'; 413 else if (button.id == name+'_link') 414 return '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="'+name+'.edInsertLink('+i+');" value="'+button.display+'" />'; 415 else 416 return '<input type="button" id="' + button.id + '" accesskey="'+button.access+'" class="ed_button" onclick="'+name+'.edInsertTag('+i+');" value="'+button.display+'" />'; 417 }; 418 419 t.edAddTag = function(button) { 420 if ( t.Buttons[button].tagEnd != '' ) { 421 t.OpenTags[t.OpenTags.length] = button; 422 document.getElementById(t.Buttons[button].id).value = '/' + document.getElementById(t.Buttons[button].id).value; 423 } 424 }; 425 426 t.edRemoveTag = function(button) { 427 for ( var i = 0; i < t.OpenTags.length; i++ ) { 428 if ( t.OpenTags[i] == button ) { 429 t.OpenTags.splice(i, 1); 430 document.getElementById(t.Buttons[button].id).value = document.getElementById(t.Buttons[button].id).value.replace('/', ''); 431 } 432 } 433 }; 434 435 t.edCheckOpenTags = function(button) { 436 var tag = 0; 437 for ( var i = 0; i < t.OpenTags.length; i++ ) { 438 if ( t.OpenTags[i] == button ) 439 tag++; 440 } 441 if ( tag > 0 ) return true; // tag found 442 else return false; // tag not found 443 }; 444 445 this.edCloseAllTags = function() { 446 var count = t.OpenTags.length; 447 for ( var o = 0; o < count; o++ ) 448 t.edInsertTag(t.OpenTags[t.OpenTags.length - 1]); 449 }; 450 451 this.edQuickLink = function(i, thisSelect) { 452 if ( i > -1 ) { 453 var newWin = ''; 454 if ( Links[i].newWin == 1 ) { 455 newWin = ' target="_blank"'; 456 } 457 var tempStr = '<a href="' + Links[i].URL + '"' + newWin + '>' 458 + Links[i].display 459 + '</a>'; 460 thisSelect.selectedIndex = 0; 461 edInsertContent(t.Canvas, tempStr); 462 } else { 463 thisSelect.selectedIndex = 0; 464 } 465 }; 466 467 // insertion code 468 t.edInsertTag = function(i) { 469 //IE support 470 if ( document.selection ) { 471 t.Canvas.focus(); 472 sel = document.selection.createRange(); 473 if ( sel.text.length > 0 ) { 474 sel.text = t.Buttons[i].tagStart + sel.text + t.Buttons[i].tagEnd; 475 } else { 476 if ( ! t.edCheckOpenTags(i) || t.Buttons[i].tagEnd == '' ) { 477 sel.text = t.Buttons[i].tagStart; 478 t.edAddTag(i); 479 } else { 480 sel.text = t.Buttons[i].tagEnd; 481 t.edRemoveTag(i); 482 } 483 } 484 t.Canvas.focus(); 485 } else if ( t.Canvas.selectionStart || t.Canvas.selectionStart == '0' ) { //MOZILLA/NETSCAPE support 486 var startPos = t.Canvas.selectionStart; 487 var endPos = t.Canvas.selectionEnd; 488 var cursorPos = endPos; 489 var scrollTop = t.Canvas.scrollTop; 490 491 if ( startPos != endPos ) { 492 t.Canvas.value = t.Canvas.value.substring(0, startPos) 493 + t.Buttons[i].tagStart 494 + t.Canvas.value.substring(startPos, endPos) 495 + t.Buttons[i].tagEnd 496 + t.Canvas.value.substring(endPos, t.Canvas.value.length); 497 cursorPos += t.Buttons[i].tagStart.length + t.Buttons[i].tagEnd.length; 498 } else { 499 if ( !t.edCheckOpenTags(i) || t.Buttons[i].tagEnd == '' ) { 500 t.Canvas.value = t.Canvas.value.substring(0, startPos) 501 + t.Buttons[i].tagStart 502 + t.Canvas.value.substring(endPos, t.Canvas.value.length); 503 t.edAddTag(i); 504 cursorPos = startPos + t.Buttons[i].tagStart.length; 505 } else { 506 t.Canvas.value = t.Canvas.value.substring(0, startPos) 507 + t.Buttons[i].tagEnd 508 + t.Canvas.value.substring(endPos, t.Canvas.value.length); 509 t.edRemoveTag(i); 510 cursorPos = startPos + t.Buttons[i].tagEnd.length; 511 } 512 } 513 t.Canvas.focus(); 514 t.Canvas.selectionStart = cursorPos; 515 t.Canvas.selectionEnd = cursorPos; 516 t.Canvas.scrollTop = scrollTop; 517 } else { 518 if ( ! t.edCheckOpenTags(i) || t.Buttons[i].tagEnd == '' ) { 519 t.Canvas.value += Buttons[i].tagStart; 520 t.edAddTag(i); 521 } else { 522 t.Canvas.value += Buttons[i].tagEnd; 523 t.edRemoveTag(i); 524 } 525 t.Canvas.focus(); 526 } 527 }; 528 529 this.edInsertLink = function(i, defaultValue) { 530 if ( ! defaultValue ) 531 defaultValue = 'http://'; 532 533 if ( ! t.edCheckOpenTags(i) ) { 534 var URL = prompt(quicktagsL10n.enterURL, defaultValue); 535 if ( URL ) { 536 t.Buttons[i].tagStart = '<a href="' + URL + '">'; 537 t.edInsertTag(i); 538 } 539 } else { 540 t.edInsertTag(i); 541 } 542 }; 543 544 this.edInsertImage = function() { 545 var myValue = prompt(quicktagsL10n.enterImageURL, 'http://'); 546 if ( myValue ) { 547 myValue = '<img src="' 548 + myValue 549 + '" alt="' + prompt(quicktagsL10n.enterImageDescription, '') 550 + '" />'; 551 edInsertContent(t.Canvas, myValue); 552 } 553 }; 554 555 t.Buttons[t.Buttons.length] = new edButton(name+'_strong','b','<strong>','</strong>','b'); 556 t.Buttons[t.Buttons.length] = new edButton(name+'_em','i','<em>','</em>','i'); 557 t.Buttons[t.Buttons.length] = new edButton(name+'_link','link','','</a>','a'); // special case 558 t.Buttons[t.Buttons.length] = new edButton(name+'_block','b-quote','\n\n<blockquote>','</blockquote>\n\n','q'); 559 t.Buttons[t.Buttons.length] = new edButton(name+'_del','del','<del datetime="' + datetime + '">','</del>','d'); 560 t.Buttons[t.Buttons.length] = new edButton(name+'_ins','ins','<ins datetime="' + datetime + '">','</ins>','s'); 561 t.Buttons[t.Buttons.length] = new edButton(name+'_img','img','','','m',-1); // special case 562 t.Buttons[t.Buttons.length] = new edButton(name+'_ul','ul','<ul>\n','</ul>\n\n','u'); 563 t.Buttons[t.Buttons.length] = new edButton(name+'_ol','ol','<ol>\n','</ol>\n\n','o'); 564 t.Buttons[t.Buttons.length] = new edButton(name+'_li','li','\t<li>','</li>\n','l'); 565 t.Buttons[t.Buttons.length] = new edButton(name+'_code','code','<code>','</code>','c'); 566 t.Buttons[t.Buttons.length] = new edButton(name+'_more','more','<!--more-->','','t',-1); 567 // t.Buttons[t.Buttons.length] = new edButton(name+'_next','page','<!--nextpage-->','','p',-1); 568 569 var tb = document.createElement('div'); 570 tb.id = name+'_qtags'; 571 572 var html = '<div id="'+name+'_toolbar">'; 573 for (var i = 0; i < t.Buttons.length; i++) 574 html += t.edShowButton(t.Buttons[i], i); 575 576 html += '<input type="button" id="'+name+'_ed_spell" class="ed_button" onclick="edSpell('+name+'.Canvas);" title="' + quicktagsL10n.dictionaryLookup + '" value="' + quicktagsL10n.lookup + '" />'; 577 html += '<input type="button" id="'+name+'_ed_close" class="ed_button" onclick="'+name+'.edCloseAllTags();" title="' + quicktagsL10n.closeAllOpenTags + '" value="' + quicktagsL10n.closeTags + '" /></div>'; 578 579 tb.innerHTML = html; 580 cont.parentNode.insertBefore(tb, cont); 581 582 }; 1 var edButtons=new Array(),edLinks=new Array(),edOpenTags=new Array(),now=new Date(),datetime;function edButton(f,e,c,b,a,d){this.id=f;this.display=e;this.tagStart=c;this.tagEnd=b;this.access=a;this.open=d}function zeroise(b,a){var c=b.toString();if(b<0){c=c.substr(1,c.length)}while(c.length<a){c="0"+c}if(b<0){c="-"+c}return c}datetime=now.getUTCFullYear()+"-"+zeroise(now.getUTCMonth()+1,2)+"-"+zeroise(now.getUTCDate(),2)+"T"+zeroise(now.getUTCHours(),2)+":"+zeroise(now.getUTCMinutes(),2)+":"+zeroise(now.getUTCSeconds(),2)+"+00:00";edButtons[edButtons.length]=new edButton("ed_strong","b","<strong>","</strong>","b");edButtons[edButtons.length]=new edButton("ed_em","i","<em>","</em>","i");edButtons[edButtons.length]=new edButton("ed_link","link","","</a>","a");edButtons[edButtons.length]=new edButton("ed_block","b-quote","\n\n<blockquote>","</blockquote>\n\n","q");edButtons[edButtons.length]=new edButton("ed_del","del",'<del datetime="'+datetime+'">',"</del>","d");edButtons[edButtons.length]=new edButton("ed_ins","ins",'<ins datetime="'+datetime+'">',"</ins>","s");edButtons[edButtons.length]=new edButton("ed_img","img","","","m",-1);edButtons[edButtons.length]=new edButton("ed_ul","ul","<ul>\n","</ul>\n\n","u");edButtons[edButtons.length]=new edButton("ed_ol","ol","<ol>\n","</ol>\n\n","o");edButtons[edButtons.length]=new edButton("ed_li","li","\t<li>","</li>\n","l");edButtons[edButtons.length]=new edButton("ed_code","code","<code>","</code>","c");edButtons[edButtons.length]=new edButton("ed_more","more","<!--more-->","","t",-1);function edLink(){this.display="";this.URL="";this.newWin=0}edLinks[edLinks.length]=new edLink("WordPress","http://wordpress.org/");edLinks[edLinks.length]=new edLink("alexking.org","http://www.alexking.org/");function edShowButton(b,a){if(b.id=="ed_img"){document.write('<input type="button" id="'+b.id+'" accesskey="'+b.access+'" class="ed_button" onclick="edInsertImage(edCanvas);" value="'+b.display+'" />')}else{if(b.id=="ed_link"){document.write('<input type="button" id="'+b.id+'" accesskey="'+b.access+'" class="ed_button" onclick="edInsertLink(edCanvas, '+a+');" value="'+b.display+'" />')}else{document.write('<input type="button" id="'+b.id+'" accesskey="'+b.access+'" class="ed_button" onclick="edInsertTag(edCanvas, '+a+');" value="'+b.display+'" />')}}}function edShowLinks(){var a='<select onchange="edQuickLink(this.options[this.selectedIndex].value, this);"><option value="-1" selected>'+quicktagsL10n.quickLinks+"</option>",b;for(b=0;b<edLinks.length;b++){a+='<option value="'+b+'">'+edLinks[b].display+"</option>"}a+="</select>";document.write(a)}function edAddTag(a){if(edButtons[a].tagEnd!=""){edOpenTags[edOpenTags.length]=a;document.getElementById(edButtons[a].id).value="/"+document.getElementById(edButtons[a].id).value}}function edRemoveTag(b){for(var a=0;a<edOpenTags.length;a++){if(edOpenTags[a]==b){edOpenTags.splice(a,1);document.getElementById(edButtons[b].id).value=document.getElementById(edButtons[b].id).value.replace("/","")}}}function edCheckOpenTags(c){var a=0,b;for(b=0;b<edOpenTags.length;b++){if(edOpenTags[b]==c){a++}}if(a>0){return true}else{return false}}function edCloseAllTags(){var a=edOpenTags.length,b;for(b=0;b<a;b++){edInsertTag(edCanvas,edOpenTags[edOpenTags.length-1])}}function edQuickLink(c,d){if(c>-1){var b="",a;if(edLinks[c].newWin==1){b=' target="_blank"'}a='<a href="'+edLinks[c].URL+'"'+b+">"+edLinks[c].display+"</a>";d.selectedIndex=0;edInsertContent(edCanvas,a)}else{d.selectedIndex=0}}function edSpell(c){var e="",d,b,a;if(document.selection){c.focus();d=document.selection.createRange();if(d.text.length>0){e=d.text}}else{if(c.selectionStart||c.selectionStart=="0"){b=c.selectionStart;a=c.selectionEnd;if(b!=a){e=c.value.substring(b,a)}}}if(e==""){e=prompt(quicktagsL10n.wordLookup,"")}if(e!==null&&/^\w[\w ]*$/.test(e)){window.open("http://www.answers.com/"+escape(e))}}function edToolbar(){document.write('<div id="ed_toolbar">');for(var a=0;a<edButtons.length;a++){edShowButton(edButtons[a],a)}document.write('<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="'+quicktagsL10n.dictionaryLookup+'" value="'+quicktagsL10n.lookup+'" />');document.write('<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="'+quicktagsL10n.closeAllOpenTags+'" value="'+quicktagsL10n.closeTags+'" />');document.write("</div>")}function edInsertTag(d,c){if(document.selection){d.focus();var e=document.selection.createRange();if(e.text.length>0){e.text=edButtons[c].tagStart+e.text+edButtons[c].tagEnd}else{if(!edCheckOpenTags(c)||edButtons[c].tagEnd==""){e.text=edButtons[c].tagStart;edAddTag(c)}else{e.text=edButtons[c].tagEnd;edRemoveTag(c)}}d.focus()}else{if(d.selectionStart||d.selectionStart=="0"){var b=d.selectionStart,a=d.selectionEnd,g=a,f=d.scrollTop;if(b!=a){d.value=d.value.substring(0,b)+edButtons[c].tagStart+d.value.substring(b,a)+edButtons[c].tagEnd+d.value.substring(a,d.value.length);g+=edButtons[c].tagStart.length+edButtons[c].tagEnd.length}else{if(!edCheckOpenTags(c)||edButtons[c].tagEnd==""){d.value=d.value.substring(0,b)+edButtons[c].tagStart+d.value.substring(a,d.value.length);edAddTag(c);g=b+edButtons[c].tagStart.length}else{d.value=d.value.substring(0,b)+edButtons[c].tagEnd+d.value.substring(a,d.value.length);edRemoveTag(c);g=b+edButtons[c].tagEnd.length}}d.focus();d.selectionStart=g;d.selectionEnd=g;d.scrollTop=f}else{if(!edCheckOpenTags(c)||edButtons[c].tagEnd==""){d.value+=edButtons[c].tagStart;edAddTag(c)}else{d.value+=edButtons[c].tagEnd;edRemoveTag(c)}d.focus()}}}function edInsertContent(d,c){var e,b,a;if(document.selection){d.focus();e=document.selection.createRange();e.text=c;d.focus()}else{if(d.selectionStart||d.selectionStart=="0"){b=d.selectionStart;a=d.selectionEnd;d.value=d.value.substring(0,b)+c+d.value.substring(a,d.value.length);d.focus();d.selectionStart=b+c.length;d.selectionEnd=b+c.length}else{d.value+=c;d.focus()}}}function edInsertLink(d,c,b){if(!b){b="http://"}if(!edCheckOpenTags(c)){var a=prompt(quicktagsL10n.enterURL,b);if(a){edButtons[c].tagStart='<a href="'+a+'">';edInsertTag(d,c)}}else{edInsertTag(d,c)}}function edInsertImage(b){var a=prompt(quicktagsL10n.enterImageURL,"http://");if(a){a='<img src="'+a+'" alt="'+prompt(quicktagsL10n.enterImageDescription,"")+'" />';edInsertContent(b,a)}}var QTags=function(a,c,b,f){var j=this,k=document.getElementById(b),g,l,e,h,d;j.Buttons=[];j.Links=[];j.OpenTags=[];j.Canvas=document.getElementById(c);if(!j.Canvas||!k){return}f=(typeof f!="undefined")?","+f+",":"";j.edShowButton=function(n,m){if(f&&(f.indexOf(","+n.display+",")!=-1)){return""}else{if(n.id==a+"_img"){return'<input type="button" id="'+n.id+'" accesskey="'+n.access+'" class="ed_button" onclick="edInsertImage('+a+'.Canvas);" value="'+n.display+'" />'}else{if(n.id==a+"_link"){return'<input type="button" id="'+n.id+'" accesskey="'+n.access+'" class="ed_button" onclick="'+a+".edInsertLink("+m+');" value="'+n.display+'" />'}else{return'<input type="button" id="'+n.id+'" accesskey="'+n.access+'" class="ed_button" onclick="'+a+".edInsertTag("+m+');" value="'+n.display+'" />'}}}};j.edAddTag=function(i){if(j.Buttons[i].tagEnd!=""){j.OpenTags[j.OpenTags.length]=i;document.getElementById(j.Buttons[i].id).value="/"+document.getElementById(j.Buttons[i].id).value}};j.edRemoveTag=function(i){for(g=0;g<j.OpenTags.length;g++){if(j.OpenTags[g]==i){j.OpenTags.splice(g,1);document.getElementById(j.Buttons[i].id).value=document.getElementById(j.Buttons[i].id).value.replace("/","")}}};j.edCheckOpenTags=function(n){l=0;for(var m=0;m<j.OpenTags.length;m++){if(j.OpenTags[m]==n){l++}}if(l>0){return true}else{return false}};this.edCloseAllTags=function(){var i=j.OpenTags.length;for(var m=0;m<i;m++){j.edInsertTag(j.OpenTags[j.OpenTags.length-1])}};this.edQuickLink=function(o,p){if(o>-1){var n="",m;if(Links[o].newWin==1){n=' target="_blank"'}m='<a href="'+Links[o].URL+'"'+n+">"+Links[o].display+"</a>";p.selectedIndex=0;edInsertContent(j.Canvas,m)}else{p.selectedIndex=0}};j.edInsertTag=function(o){if(document.selection){j.Canvas.focus();d=document.selection.createRange();if(d.text.length>0){d.text=j.Buttons[o].tagStart+d.text+j.Buttons[o].tagEnd}else{if(!j.edCheckOpenTags(o)||j.Buttons[o].tagEnd==""){d.text=j.Buttons[o].tagStart;j.edAddTag(o)}else{d.text=j.Buttons[o].tagEnd;j.edRemoveTag(o)}}j.Canvas.focus()}else{if(j.Canvas.selectionStart||j.Canvas.selectionStart=="0"){var n=j.Canvas.selectionStart,m=j.Canvas.selectionEnd,q=m,p=j.Canvas.scrollTop;if(n!=m){j.Canvas.value=j.Canvas.value.substring(0,n)+j.Buttons[o].tagStart+j.Canvas.value.substring(n,m)+j.Buttons[o].tagEnd+j.Canvas.value.substring(m,j.Canvas.value.length);q+=j.Buttons[o].tagStart.length+j.Buttons[o].tagEnd.length}else{if(!j.edCheckOpenTags(o)||j.Buttons[o].tagEnd==""){j.Canvas.value=j.Canvas.value.substring(0,n)+j.Buttons[o].tagStart+j.Canvas.value.substring(m,j.Canvas.value.length);j.edAddTag(o);q=n+j.Buttons[o].tagStart.length}else{j.Canvas.value=j.Canvas.value.substring(0,n)+j.Buttons[o].tagEnd+j.Canvas.value.substring(m,j.Canvas.value.length);j.edRemoveTag(o);q=n+j.Buttons[o].tagEnd.length}}j.Canvas.focus();j.Canvas.selectionStart=q;j.Canvas.selectionEnd=q;j.Canvas.scrollTop=p}else{if(!j.edCheckOpenTags(o)||j.Buttons[o].tagEnd==""){j.Canvas.value+=Buttons[o].tagStart;j.edAddTag(o)}else{j.Canvas.value+=Buttons[o].tagEnd;j.edRemoveTag(o)}j.Canvas.focus()}}};this.edInsertLink=function(o,n){if(!n){n="http://"}if(!j.edCheckOpenTags(o)){var m=prompt(quicktagsL10n.enterURL,n);if(m){j.Buttons[o].tagStart='<a href="'+m+'">';j.edInsertTag(o)}}else{j.edInsertTag(o)}};this.edInsertImage=function(){var i=prompt(quicktagsL10n.enterImageURL,"http://");if(i){i='<img src="'+i+'" alt="'+prompt(quicktagsL10n.enterImageDescription,"")+'" />';edInsertContent(j.Canvas,i)}};j.Buttons[j.Buttons.length]=new edButton(a+"_strong","b","<strong>","</strong>","b");j.Buttons[j.Buttons.length]=new edButton(a+"_em","i","<em>","</em>","i");j.Buttons[j.Buttons.length]=new edButton(a+"_link","link","","</a>","a");j.Buttons[j.Buttons.length]=new edButton(a+"_block","b-quote","\n\n<blockquote>","</blockquote>\n\n","q");j.Buttons[j.Buttons.length]=new edButton(a+"_del","del",'<del datetime="'+datetime+'">',"</del>","d");j.Buttons[j.Buttons.length]=new edButton(a+"_ins","ins",'<ins datetime="'+datetime+'">',"</ins>","s");j.Buttons[j.Buttons.length]=new edButton(a+"_img","img","","","m",-1);j.Buttons[j.Buttons.length]=new edButton(a+"_ul","ul","<ul>\n","</ul>\n\n","u");j.Buttons[j.Buttons.length]=new edButton(a+"_ol","ol","<ol>\n","</ol>\n\n","o");j.Buttons[j.Buttons.length]=new edButton(a+"_li","li","\t<li>","</li>\n","l");j.Buttons[j.Buttons.length]=new edButton(a+"_code","code","<code>","</code>","c");j.Buttons[j.Buttons.length]=new edButton(a+"_more","more","<!--more-->","","t",-1);e=document.createElement("div");e.id=a+"_qtags";h='<div id="'+a+'_toolbar">';for(g=0;g<j.Buttons.length;g++){h+=j.edShowButton(j.Buttons[g],g)}h+='<input type="button" id="'+a+'_ed_spell" class="ed_button" onclick="edSpell('+a+'.Canvas);" title="'+quicktagsL10n.dictionaryLookup+'" value="'+quicktagsL10n.lookup+'" />';h+='<input type="button" id="'+a+'_ed_close" class="ed_button" onclick="'+a+'.edCloseAllTags();" title="'+quicktagsL10n.closeAllOpenTags+'" value="'+quicktagsL10n.closeTags+'" /></div>';e.innerHTML=h;k.parentNode.insertBefore(e,k)}; -
trunk/wp-includes/js/thickbox/thickbox.js
r7325 r10291 1 /* 2 * Thickbox 3.1 - One Box To Rule Them All. 3 * By Cody Lindley (http://www.codylindley.com) 4 * Copyright (c) 2007 cody lindley 5 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php 6 */ 7 8 var tb_pathToImage = "../wp-includes/js/thickbox/loadingAnimation.gif"; 9 var tb_closeImage = "../wp-includes/js/thickbox/tb-close.png"; 10 11 /*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/ 12 13 //on page load call tb_init 14 jQuery(document).ready(function(){ 15 tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox 16 imgLoader = new Image();// preload image 17 imgLoader.src = tb_pathToImage; 18 }); 19 20 //add thickbox to href & area elements that have a class of .thickbox 21 function tb_init(domChunk){ 22 jQuery(domChunk).click(function(){ 23 var t = this.title || this.name || null; 24 var a = this.href || this.alt; 25 var g = this.rel || false; 26 tb_show(t,a,g); 27 this.blur(); 28 return false; 29 }); 30 } 31 32 function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link 33 34 try { 35 if (typeof document.body.style.maxHeight === "undefined") {//if IE 6 36 jQuery("body","html").css({height: "100%", width: "100%"}); 37 jQuery("html").css("overflow","hidden"); 38 if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6 39 jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>"); 40 jQuery("#TB_overlay").click(tb_remove); 41 } 42 }else{//all others 43 if(document.getElementById("TB_overlay") === null){ 44 jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>"); 45 jQuery("#TB_overlay").click(tb_remove); 46 } 47 } 48 49 if(tb_detectMacXFF()){ 50 jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash 51 }else{ 52 jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity 53 } 54 55 if(caption===null){caption="";} 56 jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page 57 jQuery('#TB_load').show();//show loader 58 59 var baseURL; 60 if(url.indexOf("?")!==-1){ //ff there is a query string involved 61 baseURL = url.substr(0, url.indexOf("?")); 62 }else{ 63 baseURL = url; 64 } 65 66 var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/; 67 var urlType = baseURL.toLowerCase().match(urlString); 68 69 if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images 70 71 TB_PrevCaption = ""; 72 TB_PrevURL = ""; 73 TB_PrevHTML = ""; 74 TB_NextCaption = ""; 75 TB_NextURL = ""; 76 TB_NextHTML = ""; 77 TB_imageCount = ""; 78 TB_FoundURL = false; 79 if(imageGroup){ 80 TB_TempArray = jQuery("a[@rel="+imageGroup+"]").get(); 81 for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) { 82 var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString); 83 if (!(TB_TempArray[TB_Counter].href == url)) { 84 if (TB_FoundURL) { 85 TB_NextCaption = TB_TempArray[TB_Counter].title; 86 TB_NextURL = TB_TempArray[TB_Counter].href; 87 TB_NextHTML = "<span id='TB_next'> <a href='#'>Next ></a></span>"; 88 } else { 89 TB_PrevCaption = TB_TempArray[TB_Counter].title; 90 TB_PrevURL = TB_TempArray[TB_Counter].href; 91 TB_PrevHTML = "<span id='TB_prev'> <a href='#'>< Prev</a></span>"; 92 } 93 } else { 94 TB_FoundURL = true; 95 TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length); 96 } 97 } 98 } 99 100 imgPreloader = new Image(); 101 imgPreloader.onload = function(){ 102 imgPreloader.onload = null; 103 104 // Resizing large images - orginal by Christian Montoya edited by me. 105 var pagesize = tb_getPageSize(); 106 var x = pagesize[0] - 150; 107 var y = pagesize[1] - 150; 108 var imageWidth = imgPreloader.width; 109 var imageHeight = imgPreloader.height; 110 if (imageWidth > x) { 111 imageHeight = imageHeight * (x / imageWidth); 112 imageWidth = x; 113 if (imageHeight > y) { 114 imageWidth = imageWidth * (y / imageHeight); 115 imageHeight = y; 116 } 117 } else if (imageHeight > y) { 118 imageWidth = imageWidth * (y / imageHeight); 119 imageHeight = y; 120 if (imageWidth > x) { 121 imageHeight = imageHeight * (x / imageWidth); 122 imageWidth = x; 123 } 124 } 125 // End Resizing 126 127 TB_WIDTH = imageWidth + 30; 128 TB_HEIGHT = imageHeight + 60; 129 jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src='" + tb_closeImage + "' /></a></div>"); 130 131 jQuery("#TB_closeWindowButton").click(tb_remove); 132 133 if (!(TB_PrevHTML === "")) { 134 function goPrev(){ 135 if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);} 136 jQuery("#TB_window").remove(); 137 jQuery("body").append("<div id='TB_window'></div>"); 138 tb_show(TB_PrevCaption, TB_PrevURL, imageGroup); 139 return false; 140 } 141 jQuery("#TB_prev").click(goPrev); 142 } 143 144 if (!(TB_NextHTML === "")) { 145 function goNext(){ 146 jQuery("#TB_window").remove(); 147 jQuery("body").append("<div id='TB_window'></div>"); 148 tb_show(TB_NextCaption, TB_NextURL, imageGroup); 149 return false; 150 } 151 jQuery("#TB_next").click(goNext); 152 153 } 154 155 document.onkeydown = function(e){ 156 if (e == null) { // ie 157 keycode = event.keyCode; 158 } else { // mozilla 159 keycode = e.which; 160 } 161 if(keycode == 27){ // close 162 tb_remove(); 163 } else if(keycode == 190){ // display previous image 164 if(!(TB_NextHTML == "")){ 165 document.onkeydown = ""; 166 goNext(); 167 } 168 } else if(keycode == 188){ // display next image 169 if(!(TB_PrevHTML == "")){ 170 document.onkeydown = ""; 171 goPrev(); 172 } 173 } 174 }; 175 176 tb_position(); 177 jQuery("#TB_load").remove(); 178 jQuery("#TB_ImageOff").click(tb_remove); 179 jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show 180 }; 181 182 imgPreloader.src = url; 183 }else{//code to show html 184 185 var queryString = url.replace(/^[^\?]+\??/,''); 186 var params = tb_parseQuery( queryString ); 187 188 TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL 189 TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL 190 ajaxContentW = TB_WIDTH - 30; 191 ajaxContentH = TB_HEIGHT - 45; 192 193 if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window 194 urlNoQuery = url.split('TB_'); 195 jQuery("#TB_iframeContent").remove(); 196 if(params['modal'] != "true"){//iframe no modal 197 jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src='" + tb_closeImage + "' /></a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>"); 198 }else{//iframe modal 199 jQuery("#TB_overlay").unbind(); 200 jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>"); 201 } 202 }else{// not an iframe, ajax 203 if(jQuery("#TB_window").css("display") != "block"){ 204 if(params['modal'] != "true"){//ajax no modal 205 jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'><img src='" + tb_closeImage + "' /></a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>"); 206 }else{//ajax modal 207 jQuery("#TB_overlay").unbind(); 208 jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>"); 209 } 210 }else{//this means the window is already up, we are just loading new content via ajax 211 jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px"; 212 jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px"; 213 jQuery("#TB_ajaxContent")[0].scrollTop = 0; 214 jQuery("#TB_ajaxWindowTitle").html(caption); 215 } 216 } 217 218 jQuery("#TB_closeWindowButton").click(tb_remove); 219 220 if(url.indexOf('TB_inline') != -1){ 221 jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children()); 222 jQuery("#TB_window").unload(function () { 223 jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished 224 }); 225 tb_position(); 226 jQuery("#TB_load").remove(); 227 jQuery("#TB_window").css({display:"block"}); 228 }else if(url.indexOf('TB_iframe') != -1){ 229 tb_position(); 230 if($.browser.safari){//safari needs help because it will not fire iframe onload 231 jQuery("#TB_load").remove(); 232 jQuery("#TB_window").css({display:"block"}); 233 } 234 }else{ 235 jQuery("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method 236 tb_position(); 237 jQuery("#TB_load").remove(); 238 tb_init("#TB_ajaxContent a.thickbox"); 239 jQuery("#TB_window").css({display:"block"}); 240 }); 241 } 242 243 } 244 245 if(!params['modal']){ 246 document.onkeyup = function(e){ 247 if (e == null) { // ie 248 keycode = event.keyCode; 249 } else { // mozilla 250 keycode = e.which; 251 } 252 if(keycode == 27){ // close 253 tb_remove(); 254 } 255 }; 256 } 257 258 } catch(e) { 259 //nothing here 260 } 261 } 262 263 //helper functions below 264 function tb_showIframe(){ 265 jQuery("#TB_load").remove(); 266 jQuery("#TB_window").css({display:"block"}); 267 } 268 269 function tb_remove() { 270 jQuery("#TB_imageOff").unbind("click"); 271 jQuery("#TB_closeWindowButton").unbind("click"); 272 jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();}); 273 jQuery("#TB_load").remove(); 274 if (typeof document.body.style.maxHeight == "undefined") {//if IE 6 275 jQuery("body","html").css({height: "auto", width: "auto"}); 276 jQuery("html").css("overflow",""); 277 } 278 document.onkeydown = ""; 279 document.onkeyup = ""; 280 return false; 281 } 282 283 function tb_position() { 284 jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'}); 285 if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6 286 jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'}); 287 } 288 } 289 290 function tb_parseQuery ( query ) { 291 var Params = {}; 292 if ( ! query ) {return Params;}// return empty object 293 var Pairs = query.split(/[;&]/); 294 for ( var i = 0; i < Pairs.length; i++ ) { 295 var KeyVal = Pairs[i].split('='); 296 if ( ! KeyVal || KeyVal.length != 2 ) {continue;} 297 var key = unescape( KeyVal[0] ); 298 var val = unescape( KeyVal[1] ); 299 val = val.replace(/\+/g, ' '); 300 Params[key] = val; 301 } 302 return Params; 303 } 304 305 function tb_getPageSize(){ 306 var de = document.documentElement; 307 var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; 308 var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; 309 arrayPageSize = [w,h]; 310 return arrayPageSize; 311 } 312 313 function tb_detectMacXFF() { 314 var userAgent = navigator.userAgent.toLowerCase(); 315 if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) { 316 return true; 317 } 318 } 319 320 1 var tb_pathToImage="../wp-includes/js/thickbox/loadingAnimation.gif",tb_closeImage="../wp-includes/js/thickbox/tb-close.png";jQuery(document).ready(function(){tb_init("a.thickbox, area.thickbox, input.thickbox");imgLoader=new Image();imgLoader.src=tb_pathToImage});function tb_init(a){jQuery(a).click(function(){var c=this.title||this.name||null,b=this.href||this.alt,d=this.rel||false;tb_show(c,b,d);this.blur();return false})}function tb_show(o,b,i){try{var c,f=/\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/,p=c.toLowerCase().match(f),g,h,n,m,l,j,a,d;if(typeof document.body.style.maxHeight==="undefined"){jQuery("body","html").css({height:"100%",width:"100%"});jQuery("html").css("overflow","hidden");if(document.getElementById("TB_HideSelect")===null){jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");jQuery("#TB_overlay").click(tb_remove)}}else{if(document.getElementById("TB_overlay")===null){jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");jQuery("#TB_overlay").click(tb_remove)}}if(tb_detectMacXFF()){jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack")}else{jQuery("#TB_overlay").addClass("TB_overlayBG")}if(o===null){o=""}jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");jQuery("#TB_load").show();if(b.indexOf("?")!==-1){c=b.substr(0,b.indexOf("?"))}else{c=b}if(p==".jpg"||p==".jpeg"||p==".png"||p==".gif"||p==".bmp"){TB_PrevCaption="";TB_PrevURL="";TB_PrevHTML="";TB_NextCaption="";TB_NextURL="";TB_NextHTML="";TB_imageCount="";TB_FoundURL=false;if(i){TB_TempArray=jQuery("a[@rel="+i+"]").get();for(TB_Counter=0;((TB_Counter<TB_TempArray.length)&&(TB_NextHTML===""));TB_Counter++){g=TB_TempArray[TB_Counter].href.toLowerCase().match(f);if(!(TB_TempArray[TB_Counter].href==b)){if(TB_FoundURL){TB_NextCaption=TB_TempArray[TB_Counter].title;TB_NextURL=TB_TempArray[TB_Counter].href;TB_NextHTML="<span id='TB_next'> <a href='#'>Next ></a></span>"}else{TB_PrevCaption=TB_TempArray[TB_Counter].title;TB_PrevURL=TB_TempArray[TB_Counter].href;TB_PrevHTML="<span id='TB_prev'> <a href='#'>< Prev</a></span>"}}else{TB_FoundURL=true;TB_imageCount="Image "+(TB_Counter+1)+" of "+(TB_TempArray.length)}}}imgPreloader=new Image();imgPreloader.onload=function(){imgPreloader.onload=null;h=tb_getPageSize();n=h[0]-150;m=h[1]-150;l=imgPreloader.width;j=imgPreloader.height;if(l>n){j=j*(n/l);l=n;if(j>m){l=l*(m/j);j=m}}else{if(j>m){l=l*(m/j);j=m;if(l>n){j=j*(n/l);l=n}}}TB_WIDTH=l+30;TB_HEIGHT=j+60;jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+b+"' width='"+l+"' height='"+j+"' alt='"+o+"'/></a><div id='TB_caption'>"+o+"<div id='TB_secondLine'>"+TB_imageCount+TB_PrevHTML+TB_NextHTML+"</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src='"+tb_closeImage+"' /></a></div>");jQuery("#TB_closeWindowButton").click(tb_remove);if(!(TB_PrevHTML==="")){function q(){if(jQuery(document).unbind("click",q)){jQuery(document).unbind("click",q)}jQuery("#TB_window").remove();jQuery("body").append("<div id='TB_window'></div>");tb_show(TB_PrevCaption,TB_PrevURL,i);return false}jQuery("#TB_prev").click(q)}if(!(TB_NextHTML==="")){function e(){jQuery("#TB_window").remove();jQuery("body").append("<div id='TB_window'></div>");tb_show(TB_NextCaption,TB_NextURL,i);return false}jQuery("#TB_next").click(e)}document.onkeydown=function(r){if(r==null){keycode=event.keyCode}else{keycode=r.which}if(keycode==27){tb_remove()}else{if(keycode==190){if(!(TB_NextHTML=="")){document.onkeydown="";e()}}else{if(keycode==188){if(!(TB_PrevHTML=="")){document.onkeydown="";q()}}}}};tb_position();jQuery("#TB_load").remove();jQuery("#TB_ImageOff").click(tb_remove);jQuery("#TB_window").css({display:"block"})};imgPreloader.src=b}else{a=b.replace(/^[^\?]+\??/,"");d=tb_parseQuery(a);TB_WIDTH=(d.width*1)+30||630;TB_HEIGHT=(d.height*1)+40||440;ajaxContentW=TB_WIDTH-30;ajaxContentH=TB_HEIGHT-45;if(b.indexOf("TB_iframe")!=-1){urlNoQuery=b.split("TB_");jQuery("#TB_iframeContent").remove();if(d.modal!="true"){jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+o+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src='"+tb_closeImage+"' /></a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW+29)+"px;height:"+(ajaxContentH+17)+"px;' > </iframe>")}else{jQuery("#TB_overlay").unbind();jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW+29)+"px;height:"+(ajaxContentH+17)+"px;'> </iframe>")}}else{if(jQuery("#TB_window").css("display")!="block"){if(d.modal!="true"){jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+o+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'><img src='"+tb_closeImage+"' /></a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>")}else{jQuery("#TB_overlay").unbind();jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>")}}else{jQuery("#TB_ajaxContent")[0].style.width=ajaxContentW+"px";jQuery("#TB_ajaxContent")[0].style.height=ajaxContentH+"px";jQuery("#TB_ajaxContent")[0].scrollTop=0;jQuery("#TB_ajaxWindowTitle").html(o)}}jQuery("#TB_closeWindowButton").click(tb_remove);if(b.indexOf("TB_inline")!=-1){jQuery("#TB_ajaxContent").append(jQuery("#"+d.inlineId).children());jQuery("#TB_window").unload(function(){jQuery("#"+d.inlineId).append(jQuery("#TB_ajaxContent").children())});tb_position();jQuery("#TB_load").remove();jQuery("#TB_window").css({display:"block"})}else{if(b.indexOf("TB_iframe")!=-1){tb_position();if(jQuery.browser.safari){jQuery("#TB_load").remove();jQuery("#TB_window").css({display:"block"})}}else{jQuery("#TB_ajaxContent").load(b+="&random="+(new Date().getTime()),function(){tb_position();jQuery("#TB_load").remove();tb_init("#TB_ajaxContent a.thickbox");jQuery("#TB_window").css({display:"block"})})}}}if(!d.modal){document.onkeyup=function(q){if(q==null){keycode=event.keyCode}else{keycode=q.which}if(keycode==27){tb_remove()}}}}catch(k){}}function tb_showIframe(){jQuery("#TB_load").remove();jQuery("#TB_window").css({display:"block"})}function tb_remove(){jQuery("#TB_imageOff").unbind("click");jQuery("#TB_closeWindowButton").unbind("click");jQuery("#TB_window").fadeOut("fast",function(){jQuery("#TB_window,#TB_overlay,#TB_HideSelect").trigger("unload").unbind().remove()});jQuery("#TB_load").remove();if(typeof document.body.style.maxHeight=="undefined"){jQuery("body","html").css({height:"auto",width:"auto"});jQuery("html").css("overflow","")}document.onkeydown="";document.onkeyup="";return false}function tb_position(){jQuery("#TB_window").css({marginLeft:"-"+parseInt((TB_WIDTH/2),10)+"px",width:TB_WIDTH+"px"});if(!(jQuery.browser.msie&&jQuery.browser.version<7)){jQuery("#TB_window").css({marginTop:"-"+parseInt((TB_HEIGHT/2),10)+"px"})}}function tb_parseQuery(d){var e={},a,c,g,b,f;if(!d){return e}a=d.split(/[;&]/);for(c=0;c<a.length;c++){g=a[c].split("=");if(!g||g.length!=2){continue}b=unescape(g[0]);f=unescape(g[1]);f=f.replace(/\+/g," ");e[b]=f}return e}function tb_getPageSize(){var c=document.documentElement,a,b;a=window.innerWidth||self.innerWidth||(c&&c.clientWidth)||document.body.clientWidth;b=window.innerHeight||self.innerHeight||(c&&c.clientHeight)||document.body.clientHeight;arrayPageSize=[a,b];return arrayPageSize}function tb_detectMacXFF(){var a=navigator.userAgent.toLowerCase();if(a.indexOf("mac")!=-1&&a.indexOf("firefox")!=-1){return true}}; -
trunk/wp-includes/js/tw-sack.js
r3695 r10291 1 /* Simple AJAX Code-Kit (SACK) v1.6.1 */ 2 /* ©2005 Gregory Wild-Smith */ 3 /* www.twilightuniverse.com */ 4 /* Software licenced under a modified X11 licence, 5 see documentation or authors website for more details */ 6 7 function sack(file) { 8 this.xmlhttp = null; 9 10 this.resetData = function() { 11 this.method = "POST"; 12 this.queryStringSeparator = "?"; 13 this.argumentSeparator = "&"; 14 this.URLString = ""; 15 this.encodeURIString = true; 16 this.execute = false; 17 this.element = null; 18 this.elementObj = null; 19 this.requestFile = file; 20 this.vars = new Object(); 21 this.responseStatus = new Array(2); 22 }; 23 24 this.resetFunctions = function() { 25 this.onLoading = function() { }; 26 this.onLoaded = function() { }; 27 this.onInteractive = function() { }; 28 this.onCompletion = function() { }; 29 this.onError = function() { }; 30 this.onFail = function() { }; 31 }; 32 33 this.reset = function() { 34 this.resetFunctions(); 35 this.resetData(); 36 }; 37 38 this.createAJAX = function() { 39 try { 40 this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 41 } catch (e1) { 42 try { 43 this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 44 } catch (e2) { 45 this.xmlhttp = null; 46 } 47 } 48 49 if (! this.xmlhttp) { 50 if (typeof XMLHttpRequest != "undefined") { 51 this.xmlhttp = new XMLHttpRequest(); 52 } else { 53 this.failed = true; 54 } 55 } 56 }; 57 58 this.setVar = function(name, value){ 59 this.vars[name] = Array(value, false); 60 }; 61 62 this.encVar = function(name, value, returnvars) { 63 if (true == returnvars) { 64 return Array(encodeURIComponent(name), encodeURIComponent(value)); 65 } else { 66 this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true); 67 } 68 } 69 70 this.processURLString = function(string, encode) { 71 encoded = encodeURIComponent(this.argumentSeparator); 72 regexp = new RegExp(this.argumentSeparator + "|" + encoded); 73 varArray = string.split(regexp); 74 for (i = 0; i < varArray.length; i++){ 75 urlVars = varArray[i].split("="); 76 if (true == encode){ 77 this.encVar(urlVars[0], urlVars[1]); 78 } else { 79 this.setVar(urlVars[0], urlVars[1]); 80 } 81 } 82 } 83 84 this.createURLString = function(urlstring) { 85 if (this.encodeURIString && this.URLString.length) { 86 this.processURLString(this.URLString, true); 87 } 88 89 if (urlstring) { 90 if (this.URLString.length) { 91 this.URLString += this.argumentSeparator + urlstring; 92 } else { 93 this.URLString = urlstring; 94 } 95 } 96 97 // prevents caching of URLString 98 this.setVar("rndval", new Date().getTime()); 99 100 urlstringtemp = new Array(); 101 for (key in this.vars) { 102 if (false == this.vars[key][1] && true == this.encodeURIString) { 103 encoded = this.encVar(key, this.vars[key][0], true); 104 delete this.vars[key]; 105 this.vars[encoded[0]] = Array(encoded[1], true); 106 key = encoded[0]; 107 } 108 109 urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0]; 110 } 111 if (urlstring){ 112 this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator); 113 } else { 114 this.URLString += urlstringtemp.join(this.argumentSeparator); 115 } 116 } 117 118 this.runResponse = function() { 119 eval(this.response); 120 } 121 122 this.runAJAX = function(urlstring) { 123 if (this.failed) { 124 this.onFail(); 125 } else { 126 this.createURLString(urlstring); 127 if (this.element) { 128 this.elementObj = document.getElementById(this.element); 129 } 130 if (this.xmlhttp) { 131 var self = this; 132 if (this.method == "GET") { 133 totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString; 134 this.xmlhttp.open(this.method, totalurlstring, true); 135 } else { 136 this.xmlhttp.open(this.method, this.requestFile, true); 137 try { 138 this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") 139 } catch (e) { } 140 } 141 142 this.xmlhttp.onreadystatechange = function() { 143 switch (self.xmlhttp.readyState) { 144 case 1: 145 self.onLoading(); 146 break; 147 case 2: 148 self.onLoaded(); 149 break; 150 case 3: 151 self.onInteractive(); 152 break; 153 case 4: 154 self.response = self.xmlhttp.responseText; 155 self.responseXML = self.xmlhttp.responseXML; 156 self.responseStatus[0] = self.xmlhttp.status; 157 self.responseStatus[1] = self.xmlhttp.statusText; 158 159 if (self.execute) { 160 self.runResponse(); 161 } 162 163 if (self.elementObj) { 164 elemNodeName = self.elementObj.nodeName; 165 elemNodeName.toLowerCase(); 166 if (elemNodeName == "input" 167 || elemNodeName == "select" 168 || elemNodeName == "option" 169 || elemNodeName == "textarea") { 170 self.elementObj.value = self.response; 171 } else { 172 self.elementObj.innerHTML = self.response; 173 } 174 } 175 if (self.responseStatus[0] == "200") { 176 self.onCompletion(); 177 } else { 178 self.onError(); 179 } 180 181 self.URLString = ""; 182 break; 183 } 184 }; 185 186 this.xmlhttp.send(this.URLString); 187 } 188 } 189 }; 190 191 this.reset(); 192 this.createAJAX(); 193 } 1 function sack(file){this.xmlhttp=null;this.resetData=function(){this.method="POST";this.queryStringSeparator="?";this.argumentSeparator="&";this.URLString="";this.encodeURIString=true;this.execute=false;this.element=null;this.elementObj=null;this.requestFile=file;this.vars=new Object();this.responseStatus=new Array(2)};this.resetFunctions=function(){this.onLoading=function(){};this.onLoaded=function(){};this.onInteractive=function(){};this.onCompletion=function(){};this.onError=function(){};this.onFail=function(){}};this.reset=function(){this.resetFunctions();this.resetData()};this.createAJAX=function(){try{this.xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e1){try{this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(e2){this.xmlhttp=null}}if(!this.xmlhttp){if(typeof XMLHttpRequest!="undefined"){this.xmlhttp=new XMLHttpRequest()}else{this.failed=true}}};this.setVar=function(name,value){this.vars[name]=Array(value,false)};this.encVar=function(name,value,returnvars){if(true==returnvars){return Array(encodeURIComponent(name),encodeURIComponent(value))}else{this.vars[encodeURIComponent(name)]=Array(encodeURIComponent(value),true)}};this.processURLString=function(string,encode){encoded=encodeURIComponent(this.argumentSeparator);regexp=new RegExp(this.argumentSeparator+"|"+encoded);varArray=string.split(regexp);for(i=0;i<varArray.length;i++){urlVars=varArray[i].split("=");if(true==encode){this.encVar(urlVars[0],urlVars[1])}else{this.setVar(urlVars[0],urlVars[1])}}};this.createURLString=function(urlstring){if(this.encodeURIString&&this.URLString.length){this.processURLString(this.URLString,true)}if(urlstring){if(this.URLString.length){this.URLString+=this.argumentSeparator+urlstring}else{this.URLString=urlstring}}this.setVar("rndval",new Date().getTime());urlstringtemp=new Array();for(key in this.vars){if(false==this.vars[key][1]&&true==this.encodeURIString){encoded=this.encVar(key,this.vars[key][0],true);delete this.vars[key];this.vars[encoded[0]]=Array(encoded[1],true);key=encoded[0]}urlstringtemp[urlstringtemp.length]=key+"="+this.vars[key][0]}if(urlstring){this.URLString+=this.argumentSeparator+urlstringtemp.join(this.argumentSeparator)}else{this.URLString+=urlstringtemp.join(this.argumentSeparator)}};this.runResponse=function(){eval(this.response)};this.runAJAX=function(urlstring){if(this.failed){this.onFail()}else{this.createURLString(urlstring);if(this.element){this.elementObj=document.getElementById(this.element)}if(this.xmlhttp){var self=this;if(this.method=="GET"){totalurlstring=this.requestFile+this.queryStringSeparator+this.URLString;this.xmlhttp.open(this.method,totalurlstring,true)}else{this.xmlhttp.open(this.method,this.requestFile,true);try{this.xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}catch(e){}}this.xmlhttp.onreadystatechange=function(){switch(self.xmlhttp.readyState){case 1:self.onLoading();break;case 2:self.onLoaded();break;case 3:self.onInteractive();break;case 4:self.response=self.xmlhttp.responseText;self.responseXML=self.xmlhttp.responseXML;self.responseStatus[0]=self.xmlhttp.status;self.responseStatus[1]=self.xmlhttp.statusText;if(self.execute){self.runResponse()}if(self.elementObj){elemNodeName=self.elementObj.nodeName;elemNodeName.toLowerCase();if(elemNodeName=="input"||elemNodeName=="select"||elemNodeName=="option"||elemNodeName=="textarea"){self.elementObj.value=self.response}else{self.elementObj.innerHTML=self.response}}if(self.responseStatus[0]=="200"){self.onCompletion()}else{self.onError()}self.URLString="";break}};this.xmlhttp.send(this.URLString)}}};this.reset();this.createAJAX()}; -
trunk/wp-includes/js/wp-ajax-response.js
r10232 r10291 1 var wpAjax = jQuery.extend( { 2 unserialize: function( s ) { 3 var r = {}; if ( !s ) { return r; } 4 var q = s.split('?'); if ( q[1] ) { s = q[1]; } 5 var pp = s.split('&'); 6 for ( var i in pp ) { 7 if ( jQuery.isFunction(pp.hasOwnProperty) && !pp.hasOwnProperty(i) ) { continue; } 8 var p = pp[i].split('='); 9 r[p[0]] = p[1]; 10 } 11 return r; 12 }, 13 parseAjaxResponse: function( x, r, e ) { // 1 = good, 0 = strange (bad data?), -1 = you lack permission 14 var parsed = {}; 15 var re = jQuery('#' + r).html(''); 16 if ( x && typeof x == 'object' && x.getElementsByTagName('wp_ajax') ) { 17 parsed.responses = []; 18 parsed.errors = false; 19 var err = ''; 20 jQuery('response', x).each( function() { 21 var th = jQuery(this); 22 var child = jQuery(this.firstChild); 23 var response = { action: th.attr('action'), what: child.get(0).nodeName, id: child.attr('id'), oldId: child.attr('old_id'), position: child.attr('position') }; 24 response.data = jQuery( 'response_data', child ).text(); 25 response.supplemental = {}; 26 if ( !jQuery( 'supplemental', child ).children().each( function() { 27 response.supplemental[this.nodeName] = jQuery(this).text(); 28 } ).size() ) { response.supplemental = false } 29 response.errors = []; 30 if ( !jQuery('wp_error', child).each( function() { 31 var code = jQuery(this).attr('code'); 32 var anError = { code: code, message: this.firstChild.nodeValue, data: false }; 33 var errorData = jQuery('wp_error_data[code="' + code + '"]', x); 34 if ( errorData ) { anError.data = errorData.get(); } 35 var formField = jQuery( 'form-field', errorData ).text(); 36 if ( formField ) { code = formField; } 37 if ( e ) { wpAjax.invalidateForm( jQuery('#' + e + ' :input[name="' + code + '"]' ).parents('.form-field:first') ); } 38 err += '<p>' + anError.message + '</p>'; 39 response.errors.push( anError ); 40 parsed.errors = true; 41 } ).size() ) { response.errors = false; } 42 parsed.responses.push( response ); 43 } ); 44 if ( err.length ) { re.html( '<div class="error">' + err + '</div>' ); } 45 return parsed; 46 } 47 if ( isNaN(x) ) { return !re.html('<div class="error"><p>' + x + '</p></div>'); } 48 x = parseInt(x,10); 49 if ( -1 == x ) { return !re.html('<div class="error"><p>' + wpAjax.noPerm + '</p></div>'); } 50 else if ( 0 === x ) { return !re.html('<div class="error"><p>' + wpAjax.broken + '</p></div>'); } 51 return true; 52 }, 53 invalidateForm: function ( selector ) { 54 return jQuery( selector ).addClass( 'form-invalid' ).change( function() { jQuery(this).removeClass( 'form-invalid' ); } ); 55 }, 56 validateForm: function( selector ) { 57 selector = jQuery( selector ); 58 return !wpAjax.invalidateForm( selector.find('.form-required').andSelf().filter('.form-required:has(:input[value=""]), .form-required:input[value=""]') ).size(); 59 } 60 }, wpAjax || { noPerm: 'You do not have permission to do that.', broken: 'An unidentified error has occurred.' } ); 1 var wpAjax=jQuery.extend({unserialize:function(c){var d={},e,a,b,f;if(!c){return d}e=c.split("?");if(e[1]){c=e[1]}a=c.split("&");for(b in a){if(jQuery.isFunction(a.hasOwnProperty)&&!a.hasOwnProperty(b)){continue}f=a[b].split("=");d[f[0]]=f[1]}return d},parseAjaxResponse:function(a,f,g){var b={},c=jQuery("#"+f).html(""),d="";if(a&&typeof a=="object"&&a.getElementsByTagName("wp_ajax")){b.responses=[];b.errors=false;jQuery("response",a).each(function(){var h=jQuery(this),i=jQuery(this.firstChild),e;e={action:h.attr("action"),what:i.get(0).nodeName,id:i.attr("id"),oldId:i.attr("old_id"),position:i.attr("position")};e.data=jQuery("response_data",i).text();e.supplemental={};if(!jQuery("supplemental",i).children().each(function(){e.supplemental[this.nodeName]=jQuery(this).text()}).size()){e.supplemental=false}e.errors=[];if(!jQuery("wp_error",i).each(function(){var j=jQuery(this).attr("code"),m,l,k;m={code:j,message:this.firstChild.nodeValue,data:false};l=jQuery('wp_error_data[code="'+j+'"]',a);if(l){m.data=l.get()}k=jQuery("form-field",l).text();if(k){j=k}if(g){wpAjax.invalidateForm(jQuery("#"+g+' :input[name="'+j+'"]').parents(".form-field:first"))}d+="<p>"+m.message+"</p>";e.errors.push(m);b.errors=true}).size()){e.errors=false}b.responses.push(e)});if(d.length){c.html('<div class="error">'+d+"</div>")}return b}if(isNaN(a)){return !c.html('<div class="error"><p>'+a+"</p></div>")}a=parseInt(a,10);if(-1==a){return !c.html('<div class="error"><p>'+wpAjax.noPerm+"</p></div>")}else{if(0===a){return !c.html('<div class="error"><p>'+wpAjax.broken+"</p></div>")}}return true},invalidateForm:function(a){return jQuery(a).addClass("form-invalid").change(function(){jQuery(this).removeClass("form-invalid")})},validateForm:function(a){a=jQuery(a);return !wpAjax.invalidateForm(a.find(".form-required").andSelf().filter('.form-required:has(:input[value=""]), .form-required:input[value=""]')).size()}},wpAjax||{noPerm:"You do not have permission to do that.",broken:"An unidentified error has occurred."}); -
trunk/wp-includes/js/wp-lists.js
r10065 r10291 1 (function($) { 2 var currentFormEl = false; 3 var fs = {add:'ajaxAdd',del:'ajaxDel',dim:'ajaxDim',process:'process',recolor:'recolor'}; 4 5 var wpList = { 6 settings: { 7 url: wpListL10n.url, type: 'POST', 8 response: 'ajax-response', 9 10 what: '', 11 alt: 'alternate', altOffset: 0, 12 addColor: null, delColor: null, dimAddColor: null, dimDelColor: null, 13 14 confirm: null, 15 addBefore: null, addAfter: null, 16 delBefore: null, delAfter: null, 17 dimBefore: null, dimAfter: null 18 }, 19 20 nonce: function(e,s) { 21 var url = wpAjax.unserialize(e.attr('href')); 22 return s.nonce || url._ajax_nonce || $('#' + s.element + ' input[name=_ajax_nonce]').val() || url._wpnonce || $('#' + s.element + ' input[name=_wpnonce]').val() || 0; 23 }, 24 25 parseClass: function(e,t) { 26 var c = [], cl; 27 try { 28 cl = $(e).attr('class') || ''; 29 cl = cl.match(new RegExp(t+':[\\S]+')); 30 if ( cl ) { c = cl[0].split(':'); } 31 } catch(r) {} 32 return c; 33 }, 34 35 pre: function(e,s,a) { 36 var bg; var r; 37 s = $.extend( {}, this.wpList.settings, { 38 element: null, 39 nonce: 0, 40 target: e.get(0) 41 }, s || {} ); 42 if ( $.isFunction( s.confirm ) ) { 43 if ( 'add' != a ) { 44 bg = $('#' + s.element).css('backgroundColor'); 45 $('#' + s.element).css('backgroundColor', '#FF9966'); 46 } 47 r = s.confirm.call(this,e,s,a,bg); 48 if ( 'add' != a ) { $('#' + s.element).css('backgroundColor', bg ); } 49 if ( !r ) { return false; } 50 } 51 return s; 52 }, 53 54 ajaxAdd: function( e, s ) { 55 var list = this; e = $(e); s = s || {}; 56 var cls = wpList.parseClass(e,'add'); 57 s = wpList.pre.call( list, e, s, 'add' ); 58 59 s.element = cls[2] || e.attr( 'id' ) || s.element || null; 60 if ( cls[3] ) { s.addColor = '#' + cls[3]; } 61 else { s.addColor = s.addColor || '#FFFF33'; } 62 63 if ( !s ) { return false; } 64 65 if ( !e.is("[class^=add:" + list.id + ":]") ) { return !wpList.add.call( list, e, s ); } 66 67 if ( !s.element ) { return true; } 68 69 s.action = 'add-' + s.what; 70 71 s.nonce = wpList.nonce(e,s); 72 73 var es = $('#' + s.element + ' :input').not('[name=_ajax_nonce], [name=_wpnonce], [name=action]'); 74 var valid = wpAjax.validateForm( '#' + s.element ); 75 if ( !valid ) { return false; } 76 77 s.data = $.param( $.extend( { _ajax_nonce: s.nonce, action: s.action }, wpAjax.unserialize( cls[4] || '' ) ) ); 78 var formData = $.isFunction(es.fieldSerialize) ? es.fieldSerialize() : es.serialize(); 79 if ( formData ) { s.data += '&' + formData; } 80 81 if ( $.isFunction(s.addBefore) ) { 82 s = s.addBefore( s ); 83 if ( !s ) { return true; } 84 } 85 if ( !s.data.match(/_ajax_nonce=[a-f0-9]+/) ) { return true; } 86 87 s.success = function(r) { 88 var res = wpAjax.parseAjaxResponse(r, s.response, s.element); 89 if ( !res || res.errors ) { return false; } 90 91 if ( true === res ) { return true; } 92 93 jQuery.each( res.responses, function() { 94 wpList.add.call( list, this.data, $.extend( {}, s, { // this.firstChild.nodevalue 95 pos: this.position || 0, 96 id: this.id || 0, 97 oldId: this.oldId || null 98 } ) ); 99 } ); 100 101 if ( $.isFunction(s.addAfter) ) { 102 var o = this.complete; 103 this.complete = function(x,st) { 104 var _s = $.extend( { xml: x, status: st, parsed: res }, s ); 105 s.addAfter( r, _s ); 106 if ( $.isFunction(o) ) { o(x,st); } 107 }; 108 } 109 list.wpList.recolor(); 110 wpList.clear.call(list,'#' + s.element); 111 }; 112 113 $.ajax( s ); 114 return false; 115 }, 116 117 ajaxDel: function( e, s ) { 118 var list = this; e = $(e); s = s || {}; 119 var cls = wpList.parseClass(e,'delete'); 120 s = wpList.pre.call( list, e, s, 'delete' ); 121 122 s.element = cls[2] || s.element || null; 123 if ( cls[3] ) { s.delColor = '#' + cls[3]; } 124 else { s.delColor = s.delColor || '#FF3333'; } 125 126 if ( !s || !s.element ) { return false; } 127 128 s.action = 'delete-' + s.what; 129 130 s.nonce = wpList.nonce(e,s); 131 132 s.data = $.extend( 133 { action: s.action, id: s.element.split('-').pop(), _ajax_nonce: s.nonce }, 134 wpAjax.unserialize( cls[4] || '' ) 135 ); 136 137 if ( $.isFunction(s.delBefore) ) { 138 s = s.delBefore( s ); 139 if ( !s ) { return true; } 140 } 141 if ( !s.data._ajax_nonce ) { return true; } 142 143 var element = $('#' + s.element); 144 145 if ( 'none' != s.delColor ) { 146 var anim = 'slideUp'; 147 if ( element.css( 'display' ).match(/table/) ) 148 anim = 'fadeOut'; // Can't slideup table rows and other table elements. Known jQuery bug 149 element 150 .animate( { backgroundColor: s.delColor }, 'fast' )[anim]( 'fast' ) 151 .queue( function() { list.wpList.recolor(); $(this).dequeue(); } ); 152 } else { 153 list.wpList.recolor(); 154 } 155 156 s.success = function(r) { 157 var res = wpAjax.parseAjaxResponse(r, s.response, s.element); 158 if ( !res || res.errors ) { 159 element.stop().stop().css( 'backgroundColor', '#FF3333' ).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } ); 160 return false; 161 } 162 if ( $.isFunction(s.delAfter) ) { 163 var o = this.complete; 164 this.complete = function(x,st) { 165 element.queue( function() { 166 var _s = $.extend( { xml: x, status: st, parsed: res }, s ); 167 s.delAfter( r, _s ); 168 if ( $.isFunction(o) ) { o(x,st); } 169 } ).dequeue(); 170 }; 171 } 172 }; 173 $.ajax( s ); 174 return false; 175 }, 176 177 ajaxDim: function( e, s ) { 178 if ( $(e).parent().css('display') == 'none' ) // Prevent hidden links from being clicked by hotkeys 179 return false; 180 var list = this; e = $(e); s = s || {}; 181 var cls = wpList.parseClass(e,'dim'); 182 s = wpList.pre.call( list, e, s, 'dim' ); 183 184 s.element = cls[2] || s.element || null; 185 s.dimClass = cls[3] || s.dimClass || null; 186 if ( cls[4] ) { s.dimAddColor = '#' + cls[4]; } 187 else { s.dimAddColor = s.dimAddColor || '#FFFF33'; } 188 if ( cls[5] ) { s.dimDelColor = '#' + cls[5]; } 189 else { s.dimDelColor = s.dimDelColor || '#FF3333'; } 190 191 if ( !s || !s.element || !s.dimClass ) { return true; } 192 193 s.action = 'dim-' + s.what; 194 195 s.nonce = wpList.nonce(e,s); 196 197 s.data = $.extend( 198 { action: s.action, id: s.element.split('-').pop(), dimClass: s.dimClass, _ajax_nonce : s.nonce }, 199 wpAjax.unserialize( cls[6] || '' ) 200 ); 201 202 if ( $.isFunction(s.dimBefore) ) { 203 s = s.dimBefore( s ); 204 if ( !s ) { return true; } 205 } 206 207 var element = $('#' + s.element); 208 var isClass = element.toggleClass(s.dimClass).is('.' + s.dimClass); 209 var color = wpList.getColor( element ); 210 element.toggleClass( s.dimClass ) 211 var dimColor = isClass ? s.dimAddColor : s.dimDelColor; 212 if ( 'none' != dimColor ) { 213 element 214 .animate( { backgroundColor: dimColor }, 'fast' ) 215 .queue( function() { element.toggleClass(s.dimClass); $(this).dequeue(); } ) 216 .animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } ); 217 } 218 219 if ( !s.data._ajax_nonce ) { return true; } 220 221 s.success = function(r) { 222 var res = wpAjax.parseAjaxResponse(r, s.response, s.element); 223 if ( !res || res.errors ) { 224 element.stop().stop().css( 'backgroundColor', '#FF3333' )[isClass?'removeClass':'addClass'](s.dimClass).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } ); 225 return false; 226 } 227 if ( $.isFunction(s.dimAfter) ) { 228 var o = this.complete; 229 this.complete = function(x,st) { 230 element.queue( function() { 231 var _s = $.extend( { xml: x, status: st, parsed: res }, s ); 232 s.dimAfter( r, _s ); 233 if ( $.isFunction(o) ) { o(x,st); } 234 } ).dequeue(); 235 }; 236 } 237 }; 238 239 $.ajax( s ); 240 return false; 241 }, 242 243 // From jquery.color.js: jQuery Color Animation by John Resig 244 getColor: function( el ) { 245 if ( el.constructor == Object ) 246 el = el.get(0); 247 var elem = el, color, rgbaTrans = new RegExp( "rgba\\(\\s*0,\\s*0,\\s*0,\\s*0\\s*\\)", "i" ); 248 do { 249 color = jQuery.curCSS(elem, 'backgroundColor'); 250 if ( color != '' && color != 'transparent' && !color.match(rgbaTrans) || jQuery.nodeName(elem, "body") ) 251 break; 252 } while ( elem = elem.parentNode ); 253 return color || '#ffffff'; 254 }, 255 256 add: function( e, s ) { 257 var list = $(this); 258 e = $(e); 259 260 var old = false; 261 var _s = { pos: 0, id: 0, oldId: null }; 262 if ( 'string' == typeof s ) { s = { what: s }; } 263 s = $.extend(_s, this.wpList.settings, s); 264 if ( !e.size() || !s.what ) { return false; } 265 if ( s.oldId ) { old = $('#' + s.what + '-' + s.oldId); } 266 if ( s.id && ( s.id != s.oldId || !old || !old.size() ) ) { $('#' + s.what + '-' + s.id).remove(); } 267 268 if ( old && old.size() ) { 269 old.replaceWith(e); 270 } else if ( isNaN(s.pos) ) { 271 var ba = 'after'; 272 if ( '-' == s.pos.substr(0,1) ) { 273 s.pos = s.pos.substr(1); 274 ba = 'before'; 275 } 276 var ref = list.find( '#' + s.pos ); 277 if ( 1 === ref.size() ) { ref[ba](e); } 278 else { list.append(e); } 279 } else if ( s.pos < 0 ) { 280 list.prepend(e); 281 } else { 282 list.append(e); 283 } 284 285 if ( s.alt ) { 286 if ( ( list.children(':visible').index( e[0] ) + s.altOffset ) % 2 ) { e.removeClass( s.alt ); } 287 else { e.addClass( s.alt ); } 288 } 289 290 if ( 'none' != s.addColor ) { 291 var color = wpList.getColor( e ); 292 e.css( 'backgroundColor', s.addColor ).animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } ); 293 } 294 list.each( function() { this.wpList.process( e ); } ); 295 return e; 296 }, 297 298 clear: function(e) { 299 var list = this; 300 e = $(e); 301 if ( list.wpList && e.parents( '#' + list.id ).size() ) { return; } 302 e.find(':input').each( function() { 303 if ( $(this).parents('.form-no-clear').size() ) 304 return; 305 var t = this.type.toLowerCase(); var tag = this.tagName.toLowerCase(); 306 if ( 'text' == t || 'password' == t || 'textarea' == tag ) { this.value = ''; } 307 else if ( 'checkbox' == t || 'radio' == t ) { this.checked = false; } 308 else if ( 'select' == tag ) { this.selectedIndex = null; } 309 }); 310 }, 311 312 process: function(el) { 313 var list = this; 314 $("[class^=add:" + list.id + ":]", el || null) 315 .filter('form').submit( function() { return list.wpList.add(this); } ).end() 316 .not('form').click( function() { return list.wpList.add(this); } ).each( function() { 317 var addEl = this; 318 var c = wpList.parseClass(this,'add')[2] || addEl.id; 319 if ( !c ) { return; } 320 var forms = []; var ins = []; // this is all really inefficient 321 $('#' + c + ' :input').focus( function() { currentFormEl = this; } ).blur( function() { currentFormEl = false; } ).each( function() { 322 ins.push(this); 323 var f = $(this).parents('form:first').get(0); 324 if ( $.inArray(f,forms) < 0 ) { forms.push(f); } 325 } ); 326 $(forms).submit( function() { 327 if ( 0 <= $.inArray(currentFormEl,ins) ) { 328 $(addEl).trigger( 'click' ); 329 $(currentFormEl).focus(); 330 return false; 331 } 332 } ); 333 } ); 334 $("[class^=delete:" + list.id + ":]", el || null).click( function() { return list.wpList.del(this); } ); 335 $("[class^=dim:" + list.id + ":]", el || null).click( function() { return list.wpList.dim(this); } ); 336 }, 337 338 recolor: function() { 339 var list = this; 340 if ( !list.wpList.settings.alt ) { return; } 341 var items = $('.list-item:visible', list); 342 if ( !items.size() ) { items = $(list).children(':visible'); } 343 var eo = [':even',':odd']; 344 if ( list.wpList.settings.altOffset % 2 ) { eo.reverse(); } 345 items.filter(eo[0]).addClass(list.wpList.settings.alt).end().filter(eo[1]).removeClass(list.wpList.settings.alt); 346 }, 347 348 init: function() { 349 var lists = this; 350 lists.wpList.process = function(a) { 351 lists.each( function() { 352 this.wpList.process(a); 353 } ); 354 }; 355 lists.wpList.recolor = function() { 356 lists.each( function() { 357 this.wpList.recolor(); 358 } ); 359 }; 360 } 361 }; 362 363 $.fn.wpList = function( settings ) { 364 this.each( function() { 365 var _this = this; 366 this.wpList = { settings: $.extend( {}, wpList.settings, { what: wpList.parseClass(this,'list')[1] || '' }, settings ) }; 367 $.each( fs, function(i,f) { _this.wpList[i] = function( e, s ) { return wpList[f].call( _this, e, s ); }; } ); 368 } ); 369 wpList.init.call(this); 370 this.wpList.process(); 371 return this; 372 }; 373 374 })(jQuery); 1 (function(c){var b=false,a={add:"ajaxAdd",del:"ajaxDel",dim:"ajaxDim",process:"process",recolor:"recolor"},d;d={settings:{url:wpListL10n.url,type:"POST",response:"ajax-response",what:"",alt:"alternate",altOffset:0,addColor:null,delColor:null,dimAddColor:null,dimDelColor:null,confirm:null,addBefore:null,addAfter:null,delBefore:null,delAfter:null,dimBefore:null,dimAfter:null},nonce:function(h,g){var f=wpAjax.unserialize(h.attr("href"));return g.nonce||f._ajax_nonce||c("#"+g.element+" input[name=_ajax_nonce]").val()||f._wpnonce||c("#"+g.element+" input[name=_wpnonce]").val()||0},parseClass:function(i,g){var j=[],f;try{f=c(i).attr("class")||"";f=f.match(new RegExp(g+":[\\S]+"));if(f){j=f[0].split(":")}}catch(h){}return j},pre:function(j,h,f){var g,i;h=c.extend({},this.wpList.settings,{element:null,nonce:0,target:j.get(0)},h||{});if(c.isFunction(h.confirm)){if("add"!=f){g=c("#"+h.element).css("backgroundColor");c("#"+h.element).css("backgroundColor","#FF9966")}i=h.confirm.call(this,j,h,f,g);if("add"!=f){c("#"+h.element).css("backgroundColor",g)}if(!i){return false}}return h},ajaxAdd:function(k,g){k=c(k);g=g||{};var i=this,f=d.parseClass(k,"add"),l,h,j;g=d.pre.call(i,k,g,"add");g.element=f[2]||k.attr("id")||g.element||null;if(f[3]){g.addColor="#"+f[3]}else{g.addColor=g.addColor||"#FFFF33"}if(!g){return false}if(!k.is("[class^=add:"+i.id+":]")){return !d.add.call(i,k,g)}if(!g.element){return true}g.action="add-"+g.what;g.nonce=d.nonce(k,g);l=c("#"+g.element+" :input").not("[name=_ajax_nonce], [name=_wpnonce], [name=action]");h=wpAjax.validateForm("#"+g.element);if(!h){return false}g.data=c.param(c.extend({_ajax_nonce:g.nonce,action:g.action},wpAjax.unserialize(f[4]||"")));j=c.isFunction(l.fieldSerialize)?l.fieldSerialize():l.serialize();if(j){g.data+="&"+j}if(c.isFunction(g.addBefore)){g=g.addBefore(g);if(!g){return true}}if(!g.data.match(/_ajax_nonce=[a-f0-9]+/)){return true}g.success=function(m){var e=wpAjax.parseAjaxResponse(m,g.response,g.element),n;if(!e||e.errors){return false}if(true===e){return true}jQuery.each(e.responses,function(){d.add.call(i,this.data,c.extend({},g,{pos:this.position||0,id:this.id||0,oldId:this.oldId||null}))});if(c.isFunction(g.addAfter)){n=this.complete;this.complete=function(o,p){var q=c.extend({xml:o,status:p,parsed:e},g);g.addAfter(m,q);if(c.isFunction(n)){n(o,p)}}}i.wpList.recolor();d.clear.call(i,"#"+g.element)};c.ajax(g);return false},ajaxDel:function(k,h){k=c(k);h=h||{};var j=this,f=d.parseClass(k,"delete"),g,i;h=d.pre.call(j,k,h,"delete");h.element=f[2]||h.element||null;if(f[3]){h.delColor="#"+f[3]}else{h.delColor=h.delColor||"#FF3333"}if(!h||!h.element){return false}h.action="delete-"+h.what;h.nonce=d.nonce(k,h);h.data=c.extend({action:h.action,id:h.element.split("-").pop(),_ajax_nonce:h.nonce},wpAjax.unserialize(f[4]||""));if(c.isFunction(h.delBefore)){h=h.delBefore(h);if(!h){return true}}if(!h.data._ajax_nonce){return true}g=c("#"+h.element);if("none"!=h.delColor){i="slideUp";if(g.css("display").match(/table/)){i="fadeOut"}g.animate({backgroundColor:h.delColor},"fast")[i]("fast").queue(function(){j.wpList.recolor();c(this).dequeue()})}else{j.wpList.recolor()}h.success=function(l){var e=wpAjax.parseAjaxResponse(l,h.response,h.element),m;if(!e||e.errors){g.stop().stop().css("backgroundColor","#FF3333").show().queue(function(){j.wpList.recolor();c(this).dequeue()});return false}if(c.isFunction(h.delAfter)){m=this.complete;this.complete=function(n,o){g.queue(function(){var p=c.extend({xml:n,status:o,parsed:e},h);h.delAfter(l,p);if(c.isFunction(m)){m(n,o)}}).dequeue()}}};c.ajax(h);return false},ajaxDim:function(l,i){if(c(l).parent().css("display")=="none"){return false}l=c(l);i=i||{};var k=this,f=d.parseClass(l,"dim"),h,m,g,j;i=d.pre.call(k,l,i,"dim");i.element=f[2]||i.element||null;i.dimClass=f[3]||i.dimClass||null;if(f[4]){i.dimAddColor="#"+f[4]}else{i.dimAddColor=i.dimAddColor||"#FFFF33"}if(f[5]){i.dimDelColor="#"+f[5]}else{i.dimDelColor=i.dimDelColor||"#FF3333"}if(!i||!i.element||!i.dimClass){return true}i.action="dim-"+i.what;i.nonce=d.nonce(l,i);i.data=c.extend({action:i.action,id:i.element.split("-").pop(),dimClass:i.dimClass,_ajax_nonce:i.nonce},wpAjax.unserialize(f[6]||""));if(c.isFunction(i.dimBefore)){i=i.dimBefore(i);if(!i){return true}}h=c("#"+i.element);m=h.toggleClass(i.dimClass).is("."+i.dimClass);g=d.getColor(h);h.toggleClass(i.dimClass);j=m?i.dimAddColor:i.dimDelColor;if("none"!=j){h.animate({backgroundColor:j},"fast").queue(function(){h.toggleClass(i.dimClass);c(this).dequeue()}).animate({backgroundColor:g},{complete:function(){c(this).css("backgroundColor","")}})}if(!i.data._ajax_nonce){return true}i.success=function(n){var e=wpAjax.parseAjaxResponse(n,i.response,i.element),p;if(!e||e.errors){h.stop().stop().css("backgroundColor","#FF3333")[m?"removeClass":"addClass"](i.dimClass).show().queue(function(){k.wpList.recolor();c(this).dequeue()});return false}if(c.isFunction(i.dimAfter)){p=this.complete;this.complete=function(o,q){h.queue(function(){var r=c.extend({xml:o,status:q,parsed:e},i);i.dimAfter(n,r);if(c.isFunction(p)){p(o,q)}}).dequeue()}}};c.ajax(i);return false},getColor:function(f){if(f.constructor==Object){f=f.get(0)}var g=f,e,h=new RegExp("rgba\\(\\s*0,\\s*0,\\s*0,\\s*0\\s*\\)","i");do{e=jQuery.curCSS(g,"backgroundColor");if(e!=""&&e!="transparent"&&!e.match(h)||jQuery.nodeName(g,"body")){break}}while(g=g.parentNode);return e||"#ffffff"},add:function(l,h){l=c(l);var j=c(this),f=false,k={pos:0,id:0,oldId:null},m,i,g;if("string"==typeof h){h={what:h}}h=c.extend(k,this.wpList.settings,h);if(!l.size()||!h.what){return false}if(h.oldId){f=c("#"+h.what+"-"+h.oldId)}if(h.id&&(h.id!=h.oldId||!f||!f.size())){c("#"+h.what+"-"+h.id).remove()}if(f&&f.size()){f.replaceWith(l)}else{if(isNaN(h.pos)){m="after";if("-"==h.pos.substr(0,1)){h.pos=h.pos.substr(1);m="before"}i=j.find("#"+h.pos);if(1===i.size()){i[m](l)}else{j.append(l)}}else{if(h.pos<0){j.prepend(l)}else{j.append(l)}}}if(h.alt){if((j.children(":visible").index(l[0])+h.altOffset)%2){l.removeClass(h.alt)}else{l.addClass(h.alt)}}if("none"!=h.addColor){g=d.getColor(l);l.css("backgroundColor",h.addColor).animate({backgroundColor:g},{complete:function(){c(this).css("backgroundColor","")}})}j.each(function(){this.wpList.process(l)});return l},clear:function(i){var h=this,g,f;i=c(i);if(h.wpList&&i.parents("#"+h.id).size()){return}i.find(":input").each(function(){if(c(this).parents(".form-no-clear").size()){return}g=this.type.toLowerCase();f=this.tagName.toLowerCase();if("text"==g||"password"==g||"textarea"==f){this.value=""}else{if("checkbox"==g||"radio"==g){this.checked=false}else{if("select"==f){this.selectedIndex=null}}}})},process:function(e){var f=this;c("[class^=add:"+f.id+":]",e||null).filter("form").submit(function(){return f.wpList.add(this)}).end().not("form").click(function(){return f.wpList.add(this)}).each(function(){var j=this,i=d.parseClass(this,"add")[2]||j.id,g,h;if(!i){return}g=[];h=[];c("#"+i+" :input").focus(function(){b=this}).blur(function(){b=false}).each(function(){h.push(this);var k=c(this).parents("form:first").get(0);if(c.inArray(k,g)<0){g.push(k)}});c(g).submit(function(){if(0<=c.inArray(b,h)){c(j).trigger("click");c(b).focus();return false}})});c("[class^=delete:"+f.id+":]",e||null).click(function(){return f.wpList.del(this)});c("[class^=dim:"+f.id+":]",e||null).click(function(){return f.wpList.dim(this)})},recolor:function(){var g=this,f,e;if(!g.wpList.settings.alt){return}f=c(".list-item:visible",g);if(!f.size()){f=c(g).children(":visible")}e=[":even",":odd"];if(g.wpList.settings.altOffset%2){e.reverse()}f.filter(e[0]).addClass(g.wpList.settings.alt).end().filter(e[1]).removeClass(g.wpList.settings.alt)},init:function(){var e=this;e.wpList.process=function(f){e.each(function(){this.wpList.process(f)})};e.wpList.recolor=function(){e.each(function(){this.wpList.recolor()})}}};c.fn.wpList=function(e){this.each(function(){var f=this;this.wpList={settings:c.extend({},d.settings,{what:d.parseClass(this,"list")[1]||""},e)};c.each(a,function(g,h){f.wpList[g]=function(j,i){return d[h].call(f,j,i)}})});d.init.call(this);this.wpList.process();return this}})(jQuery); -
trunk/wp-includes/script-loader.php
r10258 r10291 41 41 $scripts->base_url = $guessurl; 42 42 $scripts->default_version = get_bloginfo( 'version' ); 43 44 $scripts->add( 'common', '/wp-admin/js/common.js', array('jquery', 'hoverIntent'), '20081226' ); 45 $scripts->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' ); 46 47 $scripts->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '20081210' ); 43 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : ''; 44 45 $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent'), '20090102' ); 46 47 $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", false, '1.6.1' ); 48 49 $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", false, '20090102' ); 48 50 $scripts->localize( 'quicktags', 'quicktagsL10n', array( 49 51 'quickLinks' => __('(Quick Links)'), … … 59 61 ) ); 60 62 61 $scripts->add( 'colorpicker', '/wp-includes/js/colorpicker.js', array('prototype'), '3517' );63 $scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' ); 62 64 63 65 // Modify this version when tinyMCE plugins are changed. … … 67 69 add_filter( 'tiny_mce_version', 'mce_version' ); 68 70 69 $scripts->add( 'editor', '/wp-admin/js/editor.js', false, mce_version() );71 $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", false, mce_version() ); 70 72 71 73 $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6'); 72 74 73 $scripts->add( 'wp-ajax-response', '/wp-includes/js/wp-ajax-response.js', array('jquery'), '20081210' );75 $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), '20090102' ); 74 76 $scripts->localize( 'wp-ajax-response', 'wpAjax', array( 75 77 'noPerm' => __('You do not have permission to do that.'), … … 78 80 ) ); 79 81 80 $scripts->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20081217' );81 82 $scripts->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('wp-ajax-response'), '20081210' );82 $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20090102' ); 83 84 $scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20090102' ); 83 85 $scripts->localize( 'wp-lists', 'wpListL10n', array( 84 86 'url' => admin_url('admin-ajax.php') … … 97 99 98 100 $scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.2.6'); 99 $scripts->add( 'jquery-form', '/wp-includes/js/jquery/jquery.form.js', array('jquery'), '2.02');100 $scripts->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.js', array('jquery'), '2.0-4561');101 $scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '2.02m'); 102 $scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color$suffix.js", array('jquery'), '2.0-4561m'); 101 103 $scripts->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' ); 102 $scripts->add( 'suggest', '/wp-includes/js/jquery/suggest.js', array('jquery'), '1.1b'); 103 $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20'); 104 $scripts->add( 'jquery-hotkeys', '/wp-includes/js/jquery/jquery.hotkeys.js', array('jquery'), '0.0.2' ); 105 $scripts->add( 'jquery-table-hotkeys', '/wp-includes/js/jquery/jquery.table-hotkeys.js', array('jquery', 'jquery-hotkeys'), '20081128' ); 106 $scripts->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1-20080430'); 107 $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.2.0-20081031'); 104 $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1bm'); 105 $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m'); 106 $scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array('jquery'), '0.0.2m' ); 107 $scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), '20090102' ); 108 $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox$suffix.js", array('jquery'), '3.1-20080430m'); 109 110 if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) { 111 $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.2.0-20081031'); 112 $scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload'), '2.2.0-20081031'); 113 $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.2.0-20081031'); 114 $scripts->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.2.0-20081201'); 115 // these error messages came from the sample swfupload js, they might need changing. 116 $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array( 117 'queue_limit_exceeded' => __('You have attempted to queue too many files.'), 118 'file_exceeds_size_limit' => sprintf(__('This file is too big. Your php.ini upload_max_filesize is %s.'), @ini_get('upload_max_filesize')), 119 'zero_byte_file' => __('This file is empty. Please try another.'), 120 'invalid_filetype' => __('This file type is not allowed. Please try another.'), 121 'default_error' => __('An error occurred in the upload. Please try again later.'), 122 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'), 123 'upload_limit_exceeded' => __('You may only upload 1 file.'), 124 'http_error' => __('HTTP error.'), 125 'upload_failed' => __('Upload failed.'), 126 'io_error' => __('IO error.'), 127 'security_error' => __('Security error.'), 128 'file_cancelled' => __('File cancelled.'), 129 'upload_stopped' => __('Upload stopped.'), 130 'dismiss' => __('Dismiss'), 131 'crunching' => __('Crunching…'), 132 'deleted' => __('Deleted'), 133 'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};' 134 ) ); 135 } else { 136 $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload-all.js', false, '2.2.0-20081201m'); 137 // these error messages came from the sample swfupload js, they might need changing. 138 $scripts->localize( 'swfupload', 'swfuploadL10n', array( 139 'queue_limit_exceeded' => __('You have attempted to queue too many files.'), 140 'file_exceeds_size_limit' => sprintf(__('This file is too big. Your php.ini upload_max_filesize is %s.'), @ini_get('upload_max_filesize')), 141 'zero_byte_file' => __('This file is empty. Please try another.'), 142 'invalid_filetype' => __('This file type is not allowed. Please try another.'), 143 'default_error' => __('An error occurred in the upload. Please try again later.'), 144 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'), 145 'upload_limit_exceeded' => __('You may only upload 1 file.'), 146 'http_error' => __('HTTP error.'), 147 'upload_failed' => __('Upload failed.'), 148 'io_error' => __('IO error.'), 149 'security_error' => __('Security error.'), 150 'file_cancelled' => __('File cancelled.'), 151 'upload_stopped' => __('Upload stopped.'), 152 'dismiss' => __('Dismiss'), 153 'crunching' => __('Crunching…'), 154 'deleted' => __('Deleted'), 155 'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};' 156 ) ); 157 $scripts->add( 'swfupload-swfobject', false, array('swfupload') ); 158 $scripts->add( 'swfupload-queue', false, array('swfupload') ); 159 $scripts->add( 'swfupload-handlers', false, array('swfupload') ); 160 } 108 161 $scripts->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.2.0-20081031'); 109 $scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload'), '2.2.0-20081031');110 162 $scripts->localize( 'swfupload-degrade', 'uploadDegradeOptions', array( 111 163 'is_lighttpd_before_150' => is_lighttpd_before_150(), 112 ) );113 $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.2.0-20081031');114 $scripts->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.2.0-20081201');115 // these error messages came from the sample swfupload js, they might need changing.116 $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array(117 'queue_limit_exceeded' => __('You have attempted to queue too many files.'),118 'file_exceeds_size_limit' => sprintf(__('This file is too big. Your php.ini upload_max_filesize is %s.'), @ini_get('upload_max_filesize')),119 'zero_byte_file' => __('This file is empty. Please try another.'),120 'invalid_filetype' => __('This file type is not allowed. Please try another.'),121 'default_error' => __('An error occurred in the upload. Please try again later.'),122 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),123 'upload_limit_exceeded' => __('You may only upload 1 file.'),124 'http_error' => __('HTTP error.'),125 'upload_failed' => __('Upload failed.'),126 'io_error' => __('IO error.'),127 'security_error' => __('Security error.'),128 'file_cancelled' => __('File cancelled.'),129 'upload_stopped' => __('Upload stopped.'),130 'dismiss' => __('Dismiss'),131 'crunching' => __('Crunching…'),132 'deleted' => __('Deleted'),133 'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};'134 164 ) ); 135 165 … … 141 171 $scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.5.2' ); 142 172 143 $scripts->add( 'comment-reply', '/wp-includes/js/comment-reply.js', false, '20081210');173 $scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", false, '20090102'); 144 174 145 175 if ( is_admin() ) { 146 $scripts->add( 'ajaxcat', '/wp-admin/js/cat.js', array( 'wp-lists' ), '20081210' );176 $scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' ); 147 177 $scripts->localize( 'ajaxcat', 'catL10n', array( 148 178 'add' => attribute_escape(__('Add')), … … 150 180 'l10n_print_after' => 'try{convertEntities(catL10n);}catch(e){};' 151 181 ) ); 152 $scripts->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists'), '20081210' ); 153 $scripts->add( 'admin-tags', '/wp-admin/js/tags.js', array('wp-lists'), '20081210' ); 154 $scripts->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('wp-lists'), '20081210' ); 155 $scripts->add( 'password-strength-meter', '/wp-admin/js/password-strength-meter.js', array('jquery'), '20081210' ); 182 183 $scripts->add( 'admin-categories', "/wp-admin/js/categories$suffix.js", array('wp-lists'), '20090102' ); 184 185 $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('wp-lists'), '20090102' ); 186 187 $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090102' ); 188 189 $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20090102' ); 156 190 $scripts->localize( 'password-strength-meter', 'pwsL10n', array( 157 191 'empty' => __('Strength indicator'), … … 162 196 'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};' 163 197 ) ); 164 $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20081226' ); 198 199 $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090102' ); 165 200 $scripts->localize( 'admin-comments', 'adminCommentsL10n', array( 166 201 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), 167 202 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']) 168 203 ) ); 169 $scripts->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20081210' ); 170 $scripts->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' ); 171 $scripts->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery-ui-sortable'), '20081210' ); 204 205 $scripts->add( 'admin-users', "/wp-admin/js/users$suffix.js", array('wp-lists'), '20090102' ); 206 207 $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", false, '3517m' ); 208 209 $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090102' ); 172 210 $scripts->localize( 'postbox', 'postboxL10n', array( 173 211 'requestFile' => admin_url('admin-ajax.php') 174 212 ) ); 175 $scripts->add( 'slug', '/wp-admin/js/slug.js', array('jquery'), '20081210' ); 213 214 $scripts->add( 'slug', "/wp-admin/js/slug$suffix.js", array('jquery'), '20090102' ); 176 215 $scripts->localize( 'slug', 'slugL10n', array( 177 216 'requestFile' => admin_url('admin-ajax.php'), … … 180 219 'l10n_print_after' => 'try{convertEntities(slugL10n);}catch(e){};' 181 220 ) ); 182 $scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20081226' ); 221 222 $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20090102' ); 183 223 $scripts->localize( 'post', 'postL10n', array( 184 224 'tagsUsed' => __('Tags used on this post:'), … … 206 246 'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};' 207 247 ) ); 208 $scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'wp-lists', 'postbox'), '20081226' ); 248 249 $scripts->add( 'page', "/wp-admin/js/page$suffix.js", array('jquery', 'slug', 'wp-lists', 'postbox'), '20090102' ); 209 250 $scripts->localize( 'page', 'postL10n', array( 210 251 'cancel' => __('Cancel'), … … 227 268 'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};' 228 269 ) ); 229 $scripts->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20081226' ); 230 $scripts->add( 'comment', '/wp-admin/js/comment.js', array('jquery'), '20081226' ); 270 271 $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20090102' ); 272 273 $scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array('jquery'), '20090102' ); 231 274 $scripts->localize( 'comment', 'commentL10n', array( 232 275 'cancel' => __('Cancel'), … … 235 278 'l10n_print_after' => 'try{convertEntities(commentL10n);}catch(e){};' 236 279 ) ); 237 $scripts->add( 'admin-gallery', '/wp-admin/js/gallery.js', array( 'jquery-ui-sortable' ), '20081210' ); 238 $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '20081210' ); 239 240 $scripts->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20081210' ); 280 $scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ), '20090102' ); 281 282 $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), '20090102' ); 283 284 $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'interface' ), '20090102' ); 241 285 $scripts->localize( 'admin-widgets', 'widgetsL10n', array( 242 286 'add' => __('Add'), … … 248 292 )); 249 293 250 $scripts->add( 'word-count', '/wp-admin/js/word-count.js', array( 'jquery' ), '20081210' );294 $scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), '20090102' ); 251 295 $scripts->localize( 'word-count', 'wordCountL10n', array( 252 296 'count' => __('Word count: %d'), … … 254 298 )); 255 299 256 $scripts->add( 'wp-gears', '/wp-admin/js/wp-gears.js', false, '20081210' );300 $scripts->add( 'wp-gears', "/wp-admin/js/wp-gears$suffix.js", false, '20090102' ); 257 301 $scripts->localize( 'wp-gears', 'wpGearsL10n', array( 258 302 'updateCompleted' => __('Update completed.'), … … 261 305 )); 262 306 263 $scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20081210' );264 265 $scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20081226' );307 $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20090102' ); 308 309 $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'jquery-form', 'suggest' ), '20090102' ); 266 310 $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array( 267 311 'error' => __('Error while saving the changes.'), … … 271 315 ) ); 272 316 273 $scripts->add( 'inline-edit-tax', '/wp-admin/js/inline-edit-tax.js', array( 'jquery', 'jquery-form' ), '20081226' );317 $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'jquery-form' ), '20090102' ); 274 318 $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array( 275 319 'error' => __('Error while saving the changes.'), … … 277 321 ) ); 278 322 279 $scripts->add( 'plugin-install', '/wp-admin/js/plugin-install.js', array( 'thickbox', 'jquery' ), '20081210' );323 $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'thickbox', 'jquery' ), '20090102' ); 280 324 $scripts->localize( 'plugin-install', 'plugininstallL10n', array( 281 325 'plugin_information' => __('Plugin Information:'), … … 285 329 $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' ); 286 330 287 $scripts->add( 'dashboard', '/wp-admin/js/dashboard.js', array( 'jquery', 'admin-comments', 'postbox' ), '20081226' );288 289 $scripts->add( 'hoverIntent', '/wp-includes/js/hoverIntent.js', array('jquery'), '20081210' );331 $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20090102' ); 332 333 $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '20090102' ); 290 334 291 335 } -
trunk/wp-settings.php
r10286 r10291 204 204 error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE); 205 205 } 206 207 // When this is defined and set to true the non-minified versions of the Javascripts will be used. 208 // Add define('SCRIPT_DEBUG', false); to wp-config.php to test the minified versions. 209 if ( !defined('SCRIPT_DEBUG') ) 210 define('SCRIPT_DEBUG', true); 206 211 207 212 // For an advanced caching plugin to use, static because you would only want one
Note: See TracChangeset
for help on using the changeset viewer.