# HG changeset patch # User Anthony Ly # Date 1355968012 28800 # Node ID 09a1c134465b1a1a3cf0abad017c00c54fdc96d8 # Parent f507feede89a8a0df9120eb6bc56f649280f465d man wordpress + plugins order post + slideshow diff -r f507feede89a -r 09a1c134465b web/.htpasswd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/.htpasswd Wed Dec 19 17:46:52 2012 -0800 @@ -0,0 +1,5 @@ +presentation:PGx8YW6qkQpAE +seminaire:kBbd6izNyoYL6 +fonds:5t5JRIE92LHpY +iri:B4quP.V1JF29A +simondon:VWI9WjodyJWGQ diff -r f507feede89a -r 09a1c134465b web/wp-activate.php --- a/web/wp-activate.php Wed Dec 19 12:35:13 2012 -0800 +++ b/web/wp-activate.php Wed Dec 19 17:46:52 2012 -0800 @@ -1,4 +1,12 @@ ").appendTo("head")})(jQuery),function(e,t){var n=function(e,t){return this instanceof n?this._init(e,t):new n(e,t)};n.fn=n.prototype={_color:0,_alpha:1,error:!1,_hsl:{h:0,s:0,l:0},_hsv:{h:0,s:0,v:0},_hSpace:"hsl",_init:function(e){var n="noop";switch(typeof e){case"object":return e.a!==t&&this.a(e.a),n=e.r!==t?"fromRgb":e.l!==t?"fromHsl":e.v!==t?"fromHsv":n,this[n](e);case"string":return this.fromCSS(e);case"number":return this.fromInt(parseInt(e,10))}return this},_error:function(){return this.error=!0,this},clone:function(){var e=new n(this.toInt()),t=["_alpha","_hSpace","_hsl","_hsv","error"];for(var r=t.length-1;r>=0;r--)e[t[r]]=this[t[r]];return e},setHSpace:function(e){return this._hSpace=e==="hsv"?e:"hsl",this},noop:function(){return this},fromCSS:function(e){var t,n,r=/^(rgb|hs(l|v))a?\(/;this.error=!1,e=e.replace(/^\s+/,"").replace(/\s+$/,"").replace(/;$/,"");if(e.match(r)&&e.match(/\)$/)){n=e.replace(/(\s|%)/g,"").replace(r,"").replace(/,?\);?$/,"").split(",");if(n.length<3)return this._error();if(n.length===4){this.a(parseFloat(n.pop()));if(this.error)return this}for(var i=n.length-1;i>=0;i--){n[i]=parseInt(n[i],10);if(isNaN(n[i]))return this._error()}return e.match(/^rgb/)?this.fromRgb({r:n[0],g:n[1],b:n[2]}):e.match(/^hsv/)?this.fromHsv({h:n[0],s:n[1],v:n[2]}):this.fromHsl({h:n[0],s:n[1],l:n[2]})}return this.fromHex(e)},fromRgb:function(e,n){return typeof e!="object"||e.r===t||e.g===t||e.b===t?this._error():(this.error=!1,this.fromInt(parseInt((e.r<<16)+(e.g<<8)+e.b,10),n))},fromHex:function(e){return e=e.replace(/^#/,"").replace(/^0x/,""),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),this.error=!/^[0-9A-F]{6}$/i.test(e),this.fromInt(parseInt(e,16))},fromHsl:function(e){var n,r,i,s,o,u,a,f;return typeof e!="object"||e.h===t||e.s===t||e.l===t?this._error():(this._hsl=e,this._hSpace="hsl",u=e.h/360,a=e.s/100,f=e.l/100,a===0?n=r=i=f:(s=f<.5?f*(1+a):f+a-f*a,o=2*f-s,n=this.hue2rgb(o,s,u+1/3),r=this.hue2rgb(o,s,u),i=this.hue2rgb(o,s,u-1/3)),this.fromRgb({r:n*255,g:r*255,b:i*255},!0))},fromHsv:function(e){var n,r,i,s,o,u,a,f,l,c,h;if(typeof e!="object"||e.h===t||e.s===t||e.v===t)return this._error();this._hsv=e,this._hSpace="hsv",n=e.h/360,r=e.s/100,i=e.v/100,a=Math.floor(n*6),f=n*6-a,l=i*(1-r),c=i*(1-f*r),h=i*(1-(1-f)*r);switch(a%6){case 0:s=i,o=h,u=l;break;case 1:s=c,o=i,u=l;break;case 2:s=l,o=i,u=h;break;case 3:s=l,o=c,u=i;break;case 4:s=h,o=l,u=i;break;case 5:s=i,o=l,u=c}return this.fromRgb({r:s*255,g:o*255,b:u*255},!0)},fromInt:function(e,n){return this._color=parseInt(e,10),isNaN(this._color)&&(this._color=0),this._color>16777215?this._color=16777215:this._color<0&&(this._color=0),n===t&&(this._hsv.h=this._hsv.s=this._hsl.h=this._hsl.s=0),this},hue2rgb:function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},toString:function(){var e=parseInt(this._color,10).toString(16);if(this.error)return"";if(e.length<6)for(var t=6-e.length-1;t>=0;t--)e="0"+e;return"#"+e},toCSS:function(e,t){e=e||"hex",t=parseFloat(t||this._alpha);switch(e){case"rgb":case"rgba":var n=this.toRgb();return t<1?"rgba( "+n.r+", "+n.g+", "+n.b+", "+t+" )":"rgb( "+n.r+", "+n.g+", "+n.b+" )";case"hsl":case"hsla":var r=this.toHsl();return t<1?"hsla( "+r.h+", "+r.s+"%, "+r.l+"%, "+t+" )":"hsl( "+r.h+", "+r.s+"%, "+r.l+"% )";default:return this.toString()}},toRgb:function(){return{r:255&this._color>>16,g:255&this._color>>8,b:255&this._color}},toHsl:function(){var e=this.toRgb(),t=e.r/255,n=e.g/255,r=e.b/255,i=Math.max(t,n,r),s=Math.min(t,n,r),o,u,a=(i+s)/2;if(i===s)o=u=0;else{var f=i-s;u=a>.5?f/(2-i-s):f/(i+s);switch(i){case t:o=(n-r)/f+(nr?(t+.05)/(r+.05):(r+.05)/(t+.05)}throw"getDistanceLuminosityFrom requires a Color object"},getMaxContrastColor:function(){var e=this.toLuminosity(),t=e>=.5?"000000":"ffffff";return new n(t)},getGrayscaleContrastingColor:function(e){if(!e)return this.getMaxContrastColor();var t=e<5?5:e,n=this.getMaxContrastColor();e=n.getDistanceLuminosityFrom(this);if(e<=t)return n;var r=0===n.toInt()?1:-1;while(e>t)n=n.incrementLightness(r),e=n.getDistanceLuminosityFrom(this);return n},getReadableContrastingColor:function(e,r){if(!e instanceof n)return this;var i=r===t?5:r,s=e.getDistanceLuminosityFrom(this),o=e.getMaxContrastColor(),u=o.getDistanceLuminosityFrom(e);if(u<=i)return o;if(s>=i)return this;var a=0===o.toInt()?-1:1;while(sn.range[1]?n.range[1]:r),s[e]=r,this._spaceFunc("from",n.space,s))}},_spaceFunc:function(e,t,n){var r=t||this._hSpace,i=e+r.charAt(0).toUpperCase()+r.substr(1);return this[i](n)}};var r={h:{mod:360},s:{range:[0,100]},l:{space:"hsl",range:[0,100]},v:{space:"hsv",range:[0,100]},r:{space:"rgb",range:[0,255]},g:{space:"rgb",range:[0,255]},b:{space:"rgb",range:[0,255]}};for(var i in r)r.hasOwnProperty(i)&&(n.fn[i]=n.fn._partial(i));e.Color=n}(typeof exports=="object"&&exports||this); \ No newline at end of file diff -r f507feede89a -r 09a1c134465b web/wp-admin/js/link.dev.js --- a/web/wp-admin/js/link.dev.js Wed Dec 19 12:35:13 2012 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -jQuery(document).ready( function($) { - - var newCat, noSyncChecks = false, syncChecks, catAddAfter; - - $('#link_name').focus(); - // postboxes - postboxes.add_postbox_toggles('link'); - - // category tabs - $('#category-tabs a').click(function(){ - var t = $(this).attr('href'); - $(this).parent().addClass('tabs').siblings('li').removeClass('tabs'); - $('.tabs-panel').hide(); - $(t).show(); - if ( '#categories-all' == t ) - deleteUserSetting('cats'); - else - setUserSetting('cats','pop'); - return false; - }); - if ( getUserSetting('cats') ) - $('#category-tabs a[href="#categories-pop"]').click(); - - // Ajax Cat - newCat = $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } ); - $('#link-category-add-submit').click( function() { newCat.focus(); } ); - syncChecks = function() { - if ( noSyncChecks ) - return; - noSyncChecks = true; - var th = $(this), c = th.is(':checked'), id = th.val().toString(); - $('#in-link-category-' + id + ', #in-popular-category-' + id).prop( 'checked', c ); - noSyncChecks = false; - }; - - catAddAfter = function( r, s ) { - $(s.what + ' response_data', r).each( function() { - var t = $($(this).text()); - t.find( 'label' ).each( function() { - var th = $(this), val = th.find('input').val(), id = th.find('input')[0].id, name = $.trim( th.text() ), o; - $('#' + id).change( syncChecks ); - o = $( '' ).text( name ); - } ); - } ); - }; - - $('#categorychecklist').wpList( { - alt: '', - what: 'link-category', - response: 'category-ajax-response', - addAfter: catAddAfter - } ); - - $('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');}); - $('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');}); - if ( 'pop' == getUserSetting('cats') ) - $('a[href="#categories-pop"]').click(); - - $('#category-add-toggle').click( function() { - $(this).parents('div:first').toggleClass( 'wp-hidden-children' ); - $('#category-tabs a[href="#categories-all"]').click(); - $('#newcategory').focus(); - return false; - } ); - - $('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change(); -}); diff -r f507feede89a -r 09a1c134465b web/wp-admin/js/link.js --- a/web/wp-admin/js/link.js Wed Dec 19 12:35:13 2012 -0800 +++ b/web/wp-admin/js/link.js Wed Dec 19 17:46:52 2012 -0800 @@ -1,1 +1,67 @@ -jQuery(document).ready(function(c){var b,a=false,d,e;c("#link_name").focus();postboxes.add_postbox_toggles("link");c("#category-tabs a").click(function(){var f=c(this).attr("href");c(this).parent().addClass("tabs").siblings("li").removeClass("tabs");c(".tabs-panel").hide();c(f).show();if("#categories-all"==f){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){c('#category-tabs a[href="#categories-pop"]').click()}b=c("#newcat").one("focus",function(){c(this).val("").removeClass("form-input-tip")});c("#link-category-add-submit").click(function(){b.focus()});d=function(){if(a){return}a=true;var f=c(this),h=f.is(":checked"),g=f.val().toString();c("#in-link-category-"+g+", #in-popular-category-"+g).prop("checked",h);a=false};e=function(g,f){c(f.what+" response_data",g).each(function(){var h=c(c(this).text());h.find("label").each(function(){var j=c(this),l=j.find("input").val(),m=j.find("input")[0].id,i=c.trim(j.text()),k;c("#"+m).change(d);k=c('').text(i)})})};c("#categorychecklist").wpList({alt:"",what:"link-category",response:"category-ajax-response",addAfter:e});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");c('#category-tabs a[href="#categories-all"]').click();c("#newcategory").focus();return false});c(".categorychecklist :checkbox").change(d).filter(":checked").change()}); \ No newline at end of file +jQuery(document).ready( function($) { + + var newCat, noSyncChecks = false, syncChecks, catAddAfter; + + $('#link_name').focus(); + // postboxes + postboxes.add_postbox_toggles('link'); + + // category tabs + $('#category-tabs a').click(function(){ + var t = $(this).attr('href'); + $(this).parent().addClass('tabs').siblings('li').removeClass('tabs'); + $('.tabs-panel').hide(); + $(t).show(); + if ( '#categories-all' == t ) + deleteUserSetting('cats'); + else + setUserSetting('cats','pop'); + return false; + }); + if ( getUserSetting('cats') ) + $('#category-tabs a[href="#categories-pop"]').click(); + + // Ajax Cat + newCat = $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } ); + $('#link-category-add-submit').click( function() { newCat.focus(); } ); + syncChecks = function() { + if ( noSyncChecks ) + return; + noSyncChecks = true; + var th = $(this), c = th.is(':checked'), id = th.val().toString(); + $('#in-link-category-' + id + ', #in-popular-category-' + id).prop( 'checked', c ); + noSyncChecks = false; + }; + + catAddAfter = function( r, s ) { + $(s.what + ' response_data', r).each( function() { + var t = $($(this).text()); + t.find( 'label' ).each( function() { + var th = $(this), val = th.find('input').val(), id = th.find('input')[0].id, name = $.trim( th.text() ), o; + $('#' + id).change( syncChecks ); + o = $( '' ).text( name ); + } ); + } ); + }; + + $('#categorychecklist').wpList( { + alt: '', + what: 'link-category', + response: 'category-ajax-response', + addAfter: catAddAfter + } ); + + $('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');}); + $('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');}); + if ( 'pop' == getUserSetting('cats') ) + $('a[href="#categories-pop"]').click(); + + $('#category-add-toggle').click( function() { + $(this).parents('div:first').toggleClass( 'wp-hidden-children' ); + $('#category-tabs a[href="#categories-all"]').click(); + $('#newcategory').focus(); + return false; + } ); + + $('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change(); +}); diff -r f507feede89a -r 09a1c134465b web/wp-admin/js/link.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-admin/js/link.min.js Wed Dec 19 17:46:52 2012 -0800 @@ -0,0 +1,1 @@ +jQuery(document).ready(function(c){var b,a=false,d,e;c("#link_name").focus();postboxes.add_postbox_toggles("link");c("#category-tabs a").click(function(){var f=c(this).attr("href");c(this).parent().addClass("tabs").siblings("li").removeClass("tabs");c(".tabs-panel").hide();c(f).show();if("#categories-all"==f){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){c('#category-tabs a[href="#categories-pop"]').click()}b=c("#newcat").one("focus",function(){c(this).val("").removeClass("form-input-tip")});c("#link-category-add-submit").click(function(){b.focus()});d=function(){if(a){return}a=true;var f=c(this),h=f.is(":checked"),g=f.val().toString();c("#in-link-category-"+g+", #in-popular-category-"+g).prop("checked",h);a=false};e=function(g,f){c(f.what+" response_data",g).each(function(){var h=c(c(this).text());h.find("label").each(function(){var j=c(this),l=j.find("input").val(),m=j.find("input")[0].id,i=c.trim(j.text()),k;c("#"+m).change(d);k=c('').text(i)})})};c("#categorychecklist").wpList({alt:"",what:"link-category",response:"category-ajax-response",addAfter:e});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");c('#category-tabs a[href="#categories-all"]').click();c("#newcategory").focus();return false});c(".categorychecklist :checkbox").change(d).filter(":checked").change()}); \ No newline at end of file diff -r f507feede89a -r 09a1c134465b web/wp-admin/js/media-gallery.dev.js --- a/web/wp-admin/js/media-gallery.dev.js Wed Dec 19 12:35:13 2012 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -jQuery(function($){ - $( 'body' ).bind( 'click.wp-gallery', function(e){ - var target = $( e.target ), id, img_size; - - if ( target.hasClass( 'wp-set-header' ) ) { - ( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' ); - e.preventDefault(); - } else if ( target.hasClass( 'wp-set-background' ) ) { - id = target.data( 'attachment-id' ); - img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val(); - - jQuery.post(ajaxurl, { - action: 'set-background-image', - attachment_id: id, - size: img_size - }, function(){ - var win = window.dialogArguments || opener || parent || top; - win.tb_remove(); - win.location.reload(); - }); - - e.preventDefault(); - } - }); -}); diff -r f507feede89a -r 09a1c134465b web/wp-admin/js/media-gallery.js --- a/web/wp-admin/js/media-gallery.js Wed Dec 19 12:35:13 2012 -0800 +++ b/web/wp-admin/js/media-gallery.js Wed Dec 19 17:46:52 2012 -0800 @@ -1,1 +1,25 @@ -jQuery(function(a){a("body").bind("click.wp-gallery",function(d){var c=a(d.target),f,b;if(c.hasClass("wp-set-header")){(window.dialogArguments||opener||parent||top).location.href=c.data("location");d.preventDefault()}else{if(c.hasClass("wp-set-background")){f=c.data("attachment-id");b=a('input[name="attachments['+f+'][image-size]"]:checked').val();jQuery.post(ajaxurl,{action:"set-background-image",attachment_id:f,size:b},function(){var e=window.dialogArguments||opener||parent||top;e.tb_remove();e.location.reload()});d.preventDefault()}}})}); \ No newline at end of file +jQuery(function($){ + $( 'body' ).bind( 'click.wp-gallery', function(e){ + var target = $( e.target ), id, img_size; + + if ( target.hasClass( 'wp-set-header' ) ) { + ( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' ); + e.preventDefault(); + } else if ( target.hasClass( 'wp-set-background' ) ) { + id = target.data( 'attachment-id' ); + img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val(); + + jQuery.post(ajaxurl, { + action: 'set-background-image', + attachment_id: id, + size: img_size + }, function(){ + var win = window.dialogArguments || opener || parent || top; + win.tb_remove(); + win.location.reload(); + }); + + e.preventDefault(); + } + }); +}); diff -r f507feede89a -r 09a1c134465b web/wp-admin/js/media-gallery.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-admin/js/media-gallery.min.js Wed Dec 19 17:46:52 2012 -0800 @@ -0,0 +1,1 @@ +jQuery(function(a){a("body").bind("click.wp-gallery",function(d){var c=a(d.target),f,b;if(c.hasClass("wp-set-header")){(window.dialogArguments||opener||parent||top).location.href=c.data("location");d.preventDefault()}else{if(c.hasClass("wp-set-background")){f=c.data("attachment-id");b=a('input[name="attachments['+f+'][image-size]"]:checked').val();jQuery.post(ajaxurl,{action:"set-background-image",attachment_id:f,size:b},function(){var e=window.dialogArguments||opener||parent||top;e.tb_remove();e.location.reload()});d.preventDefault()}}})}); \ No newline at end of file diff -r f507feede89a -r 09a1c134465b web/wp-admin/js/media-upload.dev.js --- a/web/wp-admin/js/media-upload.dev.js Wed Dec 19 12:35:13 2012 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -// send html to the post editor - -var wpActiveEditor; - -function send_to_editor(h) { - var ed, mce = typeof(tinymce) != 'undefined', qt = typeof(QTags) != 'undefined'; - - if ( !wpActiveEditor ) { - if ( mce && tinymce.activeEditor ) { - ed = tinymce.activeEditor; - wpActiveEditor = ed.id; - } else if ( !qt ) { - return false; - } - } else if ( mce ) { - if ( tinymce.activeEditor && (tinymce.activeEditor.id == 'mce_fullscreen' || tinymce.activeEditor.id == 'wp_mce_fullscreen') ) - ed = tinymce.activeEditor; - else - ed = tinymce.get(wpActiveEditor); - } - - if ( ed && !ed.isHidden() ) { - // restore caret position on IE - if ( tinymce.isIE && ed.windowManager.insertimagebookmark ) - ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark); - - if ( h.indexOf('[caption') === 0 ) { - if ( ed.wpSetImgCaption ) - h = ed.wpSetImgCaption(h); - } else if ( h.indexOf('[gallery') === 0 ) { - if ( ed.plugins.wpgallery ) - h = ed.plugins.wpgallery._do_gallery(h); - } else if ( h.indexOf('[embed') === 0 ) { - if ( ed.plugins.wordpress ) - h = ed.plugins.wordpress._setEmbed(h); - } - - ed.execCommand('mceInsertContent', false, h); - } else if ( qt ) { - QTags.insertContent(h); - } else { - document.getElementById(wpActiveEditor).value += h; - } - - try{tb_remove();}catch(e){}; -} - -// thickbox settings -var tb_position; -(function($) { - tb_position = function() { - var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width, adminbar_height = 0; - - if ( $('body.admin-bar').length ) - adminbar_height = 28; - - if ( tbWindow.size() ) { - tbWindow.width( W - 50 ).height( H - 45 - adminbar_height ); - $('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height ); - tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'}); - if ( typeof document.body.style.maxWidth != 'undefined' ) - tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'}); - }; - - return $('a.thickbox').each( function() { - var href = $(this).attr('href'); - if ( ! href ) return; - href = href.replace(/&width=[0-9]+/g, ''); - href = href.replace(/&height=[0-9]+/g, ''); - $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 - adminbar_height ) ); - }); - }; - - $(window).resize(function(){ tb_position(); }); - - // store caret position in IE - $(document).ready(function($){ - $('a.thickbox').click(function(){ - var ed; - - if ( typeof(tinymce) != 'undefined' && tinymce.isIE && ( ed = tinymce.get(wpActiveEditor) ) && !ed.isHidden() ) { - ed.focus(); - ed.windowManager.insertimagebookmark = ed.selection.getBookmark(); - } - }); - }); - -})(jQuery); diff -r f507feede89a -r 09a1c134465b web/wp-admin/js/media-upload.js --- a/web/wp-admin/js/media-upload.js Wed Dec 19 12:35:13 2012 -0800 +++ b/web/wp-admin/js/media-upload.js Wed Dec 19 17:46:52 2012 -0800 @@ -1,1 +1,88 @@ -var wpActiveEditor;function send_to_editor(c){var b,a=typeof(tinymce)!="undefined",f=typeof(QTags)!="undefined";if(!wpActiveEditor){if(a&&tinymce.activeEditor){b=tinymce.activeEditor;wpActiveEditor=b.id}else{if(!f){return false}}}else{if(a){if(tinymce.activeEditor&&(tinymce.activeEditor.id=="mce_fullscreen"||tinymce.activeEditor.id=="wp_mce_fullscreen")){b=tinymce.activeEditor}else{b=tinymce.get(wpActiveEditor)}}}if(b&&!b.isHidden()){if(tinymce.isIE&&b.windowManager.insertimagebookmark){b.selection.moveToBookmark(b.windowManager.insertimagebookmark)}if(c.indexOf("[caption")===0){if(b.wpSetImgCaption){c=b.wpSetImgCaption(c)}}else{if(c.indexOf("[gallery")===0){if(b.plugins.wpgallery){c=b.plugins.wpgallery._do_gallery(c)}}else{if(c.indexOf("[embed")===0){if(b.plugins.wordpress){c=b.plugins.wordpress._setEmbed(c)}}}}b.execCommand("mceInsertContent",false,c)}else{if(f){QTags.insertContent(c)}else{document.getElementById(wpActiveEditor).value+=c}}try{tb_remove()}catch(d){}}var tb_position;(function(a){tb_position=function(){var f=a("#TB_window"),e=a(window).width(),d=a(window).height(),c=(720]*?>/g, '' ); - } - if ( er ) { - $('#find-posts-response').html(er); - } - } - }; - - $(document).ready(function() { - $('#find-posts-submit').click(function(e) { - if ( '' == $('#find-posts-response').html() ) - e.preventDefault(); - }); - $( '#find-posts .find-box-search :input' ).keypress( function( event ) { - if ( 13 == event.which ) { - findPosts.send(); - return false; - } - } ); - $( '#find-posts-search' ).click( findPosts.send ); - $( '#find-posts-close' ).click( findPosts.close ); - $('#doaction, #doaction2').click(function(e){ - $('select[name^="action"]').each(function(){ - if ( $(this).val() == 'attach' ) { - e.preventDefault(); - findPosts.open(); - } - }); - }); - }); -})(jQuery); diff -r f507feede89a -r 09a1c134465b web/wp-admin/js/media.js --- a/web/wp-admin/js/media.js Wed Dec 19 12:35:13 2012 -0800 +++ b/web/wp-admin/js/media.js Wed Dec 19 17:46:52 2012 -0800 @@ -1,1 +1,124 @@ -var findPosts;(function(a){findPosts={open:function(d,c){var b=document.documentElement.scrollTop||a(document).scrollTop();if(d&&c){a("#affected").attr("name",d).val(c)}a("#find-posts").show().draggable({handle:"#find-posts-head"}).css({top:b+50+"px",left:"50%",marginLeft:"-250px"});a("#find-posts-input").focus().keyup(function(f){if(f.which==27){findPosts.close()}});return false},close:function(){a("#find-posts-response").html("");a("#find-posts").draggable("destroy").hide()},send:function(){var b={ps:a("#find-posts-input").val(),action:"find_posts",_ajax_nonce:a("#_ajax_nonce").val(),post_type:a('input[name="find-posts-what"]:checked').val()};a.ajax({type:"POST",url:ajaxurl,data:b,success:function(c){findPosts.show(c)},error:function(c){findPosts.error(c)}})},show:function(b){if(typeof(b)=="string"){this.error({responseText:b});return}var c=wpAjax.parseAjaxResponse(b);if(c.errors){this.error({responseText:wpAjax.broken})}c=c.responses[0];a("#find-posts-response").html(c.data)},error:function(b){var c=b.statusText;if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#find-posts-response").html(c)}}};a(document).ready(function(){a("#find-posts-submit").click(function(b){if(""==a("#find-posts-response").html()){b.preventDefault()}});a("#find-posts .find-box-search :input").keypress(function(b){if(13==b.which){findPosts.send();return false}});a("#find-posts-search").click(findPosts.send);a("#find-posts-close").click(findPosts.close);a("#doaction, #doaction2").click(function(b){a('select[name^="action"]').each(function(){if(a(this).val()=="attach"){b.preventDefault();findPosts.open()}})})})})(jQuery); \ No newline at end of file + +var findPosts; +(function($){ + findPosts = { + open : function(af_name, af_val) { + var st = document.documentElement.scrollTop || $(document).scrollTop(), + overlay = $( '.ui-find-overlay' ); + + if ( overlay.length == 0 ) { + $( 'body' ).append( '
' ); + findPosts.overlay(); + } + + overlay.show(); + + if ( af_name && af_val ) { + $('#affected').attr('name', af_name).val(af_val); + } + $('#find-posts').show().draggable({ + handle: '#find-posts-head' + }).css({'top':st + 50 + 'px','left':'50%','marginLeft':'-328px'}); + + $('#find-posts-input').focus().keyup(function(e){ + if (e.which == 27) { findPosts.close(); } // close on Escape + }); + + // Pull some results up by default + findPosts.send(); + + return false; + }, + + close : function() { + $('#find-posts-response').html(''); + $('#find-posts').draggable('destroy').hide(); + $( '.ui-find-overlay' ).hide(); + }, + + overlay : function() { + $( '.ui-find-overlay' ).css( + { 'z-index': '999', 'width': $( document ).width() + 'px', 'height': $( document ).height() + 'px' } + ).on('click', function () { + findPosts.close(); + }); + }, + + send : function() { + var post = { + ps: $('#find-posts-input').val(), + action: 'find_posts', + _ajax_nonce: $('#_ajax_nonce').val() + }, + spinner = $( '.find-box-search .spinner' ); + + spinner.show(); + + $.ajax({ + type : 'POST', + url : ajaxurl, + data : post, + success : function(x) { findPosts.show(x); spinner.hide(); }, + error : function(r) { findPosts.error(r); spinner.hide(); } + }); + }, + + show : function(x) { + + if ( typeof(x) == 'string' ) { + this.error({'responseText': x}); + return; + } + + var r = wpAjax.parseAjaxResponse(x); + + if ( r.errors ) { + this.error({'responseText': wpAjax.broken}); + } + r = r.responses[0]; + $('#find-posts-response').html(r.data); + + // Enable whole row to be clicked + $( '.found-posts td' ).on( 'click', function () { + $( this ).parent().find( '.found-radio input' ).prop( 'checked', true ); + }); + }, + + error : function(r) { + var er = r.statusText; + + if ( r.responseText ) { + er = r.responseText.replace( /<.[^<>]*?>/g, '' ); + } + if ( er ) { + $('#find-posts-response').html(er); + } + } + }; + + $(document).ready(function() { + $('#find-posts-submit').click(function(e) { + if ( '' == $('#find-posts-response').html() ) + e.preventDefault(); + }); + $( '#find-posts .find-box-search :input' ).keypress( function( event ) { + if ( 13 == event.which ) { + findPosts.send(); + return false; + } + } ); + $( '#find-posts-search' ).click( findPosts.send ); + $( '#find-posts-close' ).click( findPosts.close ); + $('#doaction, #doaction2').click(function(e){ + $('select[name^="action"]').each(function(){ + if ( $(this).val() == 'attach' ) { + e.preventDefault(); + findPosts.open(); + } + }); + }); + }); + $(window).resize(function() { + findPosts.overlay(); + }); +})(jQuery); diff -r f507feede89a -r 09a1c134465b web/wp-admin/js/media.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-admin/js/media.min.js Wed Dec 19 17:46:52 2012 -0800 @@ -0,0 +1,1 @@ +var findPosts;(function(a){findPosts={open:function(e,d){var c=document.documentElement.scrollTop||a(document).scrollTop(),b=a(".ui-find-overlay");if(b.length==0){a("body").append('
');findPosts.overlay()}b.show();if(e&&d){a("#affected").attr("name",e).val(d)}a("#find-posts").show().draggable({handle:"#find-posts-head"}).css({top:c+50+"px",left:"50%",marginLeft:"-328px"});a("#find-posts-input").focus().keyup(function(f){if(f.which==27){findPosts.close()}});findPosts.send();return false},close:function(){a("#find-posts-response").html("");a("#find-posts").draggable("destroy").hide();a(".ui-find-overlay").hide()},overlay:function(){a(".ui-find-overlay").css({"z-index":"999",width:a(document).width()+"px",height:a(document).height()+"px"}).on("click",function(){findPosts.close()})},send:function(){var b={ps:a("#find-posts-input").val(),action:"find_posts",_ajax_nonce:a("#_ajax_nonce").val()},c=a(".find-box-search .spinner");c.show();a.ajax({type:"POST",url:ajaxurl,data:b,success:function(d){findPosts.show(d);c.hide()},error:function(d){findPosts.error(d);c.hide()}})},show:function(b){if(typeof(b)=="string"){this.error({responseText:b});return}var c=wpAjax.parseAjaxResponse(b);if(c.errors){this.error({responseText:wpAjax.broken})}c=c.responses[0];a("#find-posts-response").html(c.data);a(".found-posts td").on("click",function(){a(this).parent().find(".found-radio input").prop("checked",true)})},error:function(b){var c=b.statusText;if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#find-posts-response").html(c)}}};a(document).ready(function(){a("#find-posts-submit").click(function(b){if(""==a("#find-posts-response").html()){b.preventDefault()}});a("#find-posts .find-box-search :input").keypress(function(b){if(13==b.which){findPosts.send();return false}});a("#find-posts-search").click(findPosts.send);a("#find-posts-close").click(findPosts.close);a("#doaction, #doaction2").click(function(b){a('select[name^="action"]').each(function(){if(a(this).val()=="attach"){b.preventDefault();findPosts.open()}})})});a(window).resize(function(){findPosts.overlay()})})(jQuery); \ No newline at end of file diff -r f507feede89a -r 09a1c134465b web/wp-admin/js/nav-menu.dev.js --- a/web/wp-admin/js/nav-menu.dev.js Wed Dec 19 12:35:13 2012 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,965 +0,0 @@ -/** - * WordPress Administration Navigation Menu - * Interface JS functions - * - * @version 2.0.0 - * - * @package WordPress - * @subpackage Administration - */ - -var wpNavMenu; - -(function($) { - - var api = wpNavMenu = { - - options : { - menuItemDepthPerLevel : 30, // Do not use directly. Use depthToPx and pxToDepth instead. - globalMaxDepth : 11 - }, - - menuList : undefined, // Set in init. - targetList : undefined, // Set in init. - menusChanged : false, - isRTL: !! ( 'undefined' != typeof isRtl && isRtl ), - negateIfRTL: ( 'undefined' != typeof isRtl && isRtl ) ? -1 : 1, - - // Functions that run on init. - init : function() { - api.menuList = $('#menu-to-edit'); - api.targetList = api.menuList; - - this.jQueryExtensions(); - - this.attachMenuEditListeners(); - - this.setupInputWithDefaultTitle(); - this.attachQuickSearchListeners(); - this.attachThemeLocationsListeners(); - - this.attachTabsPanelListeners(); - - this.attachUnsavedChangesListener(); - - if( api.menuList.length ) // If no menu, we're in the + tab. - this.initSortables(); - - this.initToggles(); - - this.initTabManager(); - }, - - jQueryExtensions : function() { - // jQuery extensions - $.fn.extend({ - menuItemDepth : function() { - var margin = api.isRTL ? this.eq(0).css('margin-right') : this.eq(0).css('margin-left'); - return api.pxToDepth( margin && -1 != margin.indexOf('px') ? margin.slice(0, -2) : 0 ); - }, - updateDepthClass : function(current, prev) { - return this.each(function(){ - var t = $(this); - prev = prev || t.menuItemDepth(); - $(this).removeClass('menu-item-depth-'+ prev ) - .addClass('menu-item-depth-'+ current ); - }); - }, - shiftDepthClass : function(change) { - return this.each(function(){ - var t = $(this), - depth = t.menuItemDepth(); - $(this).removeClass('menu-item-depth-'+ depth ) - .addClass('menu-item-depth-'+ (depth + change) ); - }); - }, - childMenuItems : function() { - var result = $(); - this.each(function(){ - var t = $(this), depth = t.menuItemDepth(), next = t.next(); - while( next.length && next.menuItemDepth() > depth ) { - result = result.add( next ); - next = next.next(); - } - }); - return result; - }, - updateParentMenuItemDBId : function() { - return this.each(function(){ - var item = $(this), - input = item.find('.menu-item-data-parent-id'), - depth = item.menuItemDepth(), - parent = item.prev(); - - if( depth == 0 ) { // Item is on the top level, has no parent - input.val(0); - } else { // Find the parent item, and retrieve its object id. - while( ! parent[0] || ! parent[0].className || -1 == parent[0].className.indexOf('menu-item') || ( parent.menuItemDepth() != depth - 1 ) ) - parent = parent.prev(); - input.val( parent.find('.menu-item-data-db-id').val() ); - } - }); - }, - hideAdvancedMenuItemFields : function() { - return this.each(function(){ - var that = $(this); - $('.hide-column-tog').not(':checked').each(function(){ - that.find('.field-' + $(this).val() ).addClass('hidden-field'); - }); - }); - }, - /** - * Adds selected menu items to the menu. - * - * @param jQuery metabox The metabox jQuery object. - */ - addSelectedToMenu : function(processMethod) { - if ( 0 == $('#menu-to-edit').length ) { - return false; - } - - return this.each(function() { - var t = $(this), menuItems = {}, - checkboxes = t.find('.tabs-panel-active .categorychecklist li input:checked'), - re = new RegExp('menu-item\\[(\[^\\]\]*)'); - - processMethod = processMethod || api.addMenuItemToBottom; - - // If no items are checked, bail. - if ( !checkboxes.length ) - return false; - - // Show the ajax spinner - t.find('img.waiting').show(); - - // Retrieve menu item data - $(checkboxes).each(function(){ - var t = $(this), - listItemDBIDMatch = re.exec( t.attr('name') ), - listItemDBID = 'undefined' == typeof listItemDBIDMatch[1] ? 0 : parseInt(listItemDBIDMatch[1], 10); - if ( this.className && -1 != this.className.indexOf('add-to-top') ) - processMethod = api.addMenuItemToTop; - menuItems[listItemDBID] = t.closest('li').getItemData( 'add-menu-item', listItemDBID ); - }); - - // Add the items - api.addItemToMenu(menuItems, processMethod, function(){ - // Deselect the items and hide the ajax spinner - checkboxes.removeAttr('checked'); - t.find('img.waiting').hide(); - }); - }); - }, - getItemData : function( itemType, id ) { - itemType = itemType || 'menu-item'; - - var itemData = {}, i, - fields = [ - 'menu-item-db-id', - 'menu-item-object-id', - 'menu-item-object', - 'menu-item-parent-id', - 'menu-item-position', - 'menu-item-type', - 'menu-item-title', - 'menu-item-url', - 'menu-item-description', - 'menu-item-attr-title', - 'menu-item-target', - 'menu-item-classes', - 'menu-item-xfn' - ]; - - if( !id && itemType == 'menu-item' ) { - id = this.find('.menu-item-data-db-id').val(); - } - - if( !id ) return itemData; - - this.find('input').each(function() { - var field; - i = fields.length; - while ( i-- ) { - if( itemType == 'menu-item' ) - field = fields[i] + '[' + id + ']'; - else if( itemType == 'add-menu-item' ) - field = 'menu-item[' + id + '][' + fields[i] + ']'; - - if ( - this.name && - field == this.name - ) { - itemData[fields[i]] = this.value; - } - } - }); - - return itemData; - }, - setItemData : function( itemData, itemType, id ) { // Can take a type, such as 'menu-item', or an id. - itemType = itemType || 'menu-item'; - - if( !id && itemType == 'menu-item' ) { - id = $('.menu-item-data-db-id', this).val(); - } - - if( !id ) return this; - - this.find('input').each(function() { - var t = $(this), field; - $.each( itemData, function( attr, val ) { - if( itemType == 'menu-item' ) - field = attr + '[' + id + ']'; - else if( itemType == 'add-menu-item' ) - field = 'menu-item[' + id + '][' + attr + ']'; - - if ( field == t.attr('name') ) { - t.val( val ); - } - }); - }); - return this; - } - }); - }, - - initToggles : function() { - // init postboxes - postboxes.add_postbox_toggles('nav-menus'); - - // adjust columns functions for menus UI - columns.useCheckboxesForHidden(); - columns.checked = function(field) { - $('.field-' + field).removeClass('hidden-field'); - } - columns.unchecked = function(field) { - $('.field-' + field).addClass('hidden-field'); - } - // hide fields - api.menuList.hideAdvancedMenuItemFields(); - }, - - initSortables : function() { - var currentDepth = 0, originalDepth, minDepth, maxDepth, - prev, next, prevBottom, nextThreshold, helperHeight, transport, - menuEdge = api.menuList.offset().left, - body = $('body'), maxChildDepth, - menuMaxDepth = initialMenuMaxDepth(); - - // Use the right edge if RTL. - menuEdge += api.isRTL ? api.menuList.width() : 0; - - api.menuList.sortable({ - handle: '.menu-item-handle', - placeholder: 'sortable-placeholder', - start: function(e, ui) { - var height, width, parent, children, tempHolder; - - // handle placement for rtl orientation - if ( api.isRTL ) - ui.item[0].style.right = 'auto'; - - transport = ui.item.children('.menu-item-transport'); - - // Set depths. currentDepth must be set before children are located. - originalDepth = ui.item.menuItemDepth(); - updateCurrentDepth(ui, originalDepth); - - // Attach child elements to parent - // Skip the placeholder - parent = ( ui.item.next()[0] == ui.placeholder[0] ) ? ui.item.next() : ui.item; - children = parent.childMenuItems(); - transport.append( children ); - - // Update the height of the placeholder to match the moving item. - height = transport.outerHeight(); - // If there are children, account for distance between top of children and parent - height += ( height > 0 ) ? (ui.placeholder.css('margin-top').slice(0, -2) * 1) : 0; - height += ui.helper.outerHeight(); - helperHeight = height; - height -= 2; // Subtract 2 for borders - ui.placeholder.height(height); - - // Update the width of the placeholder to match the moving item. - maxChildDepth = originalDepth; - children.each(function(){ - var depth = $(this).menuItemDepth(); - maxChildDepth = (depth > maxChildDepth) ? depth : maxChildDepth; - }); - width = ui.helper.find('.menu-item-handle').outerWidth(); // Get original width - width += api.depthToPx(maxChildDepth - originalDepth); // Account for children - width -= 2; // Subtract 2 for borders - ui.placeholder.width(width); - - // Update the list of menu items. - tempHolder = ui.placeholder.next(); - tempHolder.css( 'margin-top', helperHeight + 'px' ); // Set the margin to absorb the placeholder - ui.placeholder.detach(); // detach or jQuery UI will think the placeholder is a menu item - $(this).sortable( "refresh" ); // The children aren't sortable. We should let jQ UI know. - ui.item.after( ui.placeholder ); // reattach the placeholder. - tempHolder.css('margin-top', 0); // reset the margin - - // Now that the element is complete, we can update... - updateSharedVars(ui); - }, - stop: function(e, ui) { - var children, depthChange = currentDepth - originalDepth; - - // Return child elements to the list - children = transport.children().insertAfter(ui.item); - - // Update depth classes - if( depthChange != 0 ) { - ui.item.updateDepthClass( currentDepth ); - children.shiftDepthClass( depthChange ); - updateMenuMaxDepth( depthChange ); - } - // Register a change - api.registerChange(); - // Update the item data. - ui.item.updateParentMenuItemDBId(); - - // address sortable's incorrectly-calculated top in opera - ui.item[0].style.top = 0; - - // handle drop placement for rtl orientation - if ( api.isRTL ) { - ui.item[0].style.left = 'auto'; - ui.item[0].style.right = 0; - } - - // The width of the tab bar might have changed. Just in case. - api.refreshMenuTabs( true ); - }, - change: function(e, ui) { - // Make sure the placeholder is inside the menu. - // Otherwise fix it, or we're in trouble. - if( ! ui.placeholder.parent().hasClass('menu') ) - (prev.length) ? prev.after( ui.placeholder ) : api.menuList.prepend( ui.placeholder ); - - updateSharedVars(ui); - }, - sort: function(e, ui) { - var offset = ui.helper.offset(), - edge = api.isRTL ? offset.left + ui.helper.width() : offset.left, - depth = api.negateIfRTL * api.pxToDepth( edge - menuEdge ); - // Check and correct if depth is not within range. - // Also, if the dragged element is dragged upwards over - // an item, shift the placeholder to a child position. - if ( depth > maxDepth || offset.top < prevBottom ) depth = maxDepth; - else if ( depth < minDepth ) depth = minDepth; - - if( depth != currentDepth ) - updateCurrentDepth(ui, depth); - - // If we overlap the next element, manually shift downwards - if( nextThreshold && offset.top + helperHeight > nextThreshold ) { - next.after( ui.placeholder ); - updateSharedVars( ui ); - $(this).sortable( "refreshPositions" ); - } - } - }); - - function updateSharedVars(ui) { - var depth; - - prev = ui.placeholder.prev(); - next = ui.placeholder.next(); - - // Make sure we don't select the moving item. - if( prev[0] == ui.item[0] ) prev = prev.prev(); - if( next[0] == ui.item[0] ) next = next.next(); - - prevBottom = (prev.length) ? prev.offset().top + prev.height() : 0; - nextThreshold = (next.length) ? next.offset().top + next.height() / 3 : 0; - minDepth = (next.length) ? next.menuItemDepth() : 0; - - if( prev.length ) - maxDepth = ( (depth = prev.menuItemDepth() + 1) > api.options.globalMaxDepth ) ? api.options.globalMaxDepth : depth; - else - maxDepth = 0; - } - - function updateCurrentDepth(ui, depth) { - ui.placeholder.updateDepthClass( depth, currentDepth ); - currentDepth = depth; - } - - function initialMenuMaxDepth() { - if( ! body[0].className ) return 0; - var match = body[0].className.match(/menu-max-depth-(\d+)/); - return match && match[1] ? parseInt(match[1]) : 0; - } - - function updateMenuMaxDepth( depthChange ) { - var depth, newDepth = menuMaxDepth; - if ( depthChange === 0 ) { - return; - } else if ( depthChange > 0 ) { - depth = maxChildDepth + depthChange; - if( depth > menuMaxDepth ) - newDepth = depth; - } else if ( depthChange < 0 && maxChildDepth == menuMaxDepth ) { - while( ! $('.menu-item-depth-' + newDepth, api.menuList).length && newDepth > 0 ) - newDepth--; - } - // Update the depth class. - body.removeClass( 'menu-max-depth-' + menuMaxDepth ).addClass( 'menu-max-depth-' + newDepth ); - menuMaxDepth = newDepth; - } - }, - - attachMenuEditListeners : function() { - var that = this; - $('#update-nav-menu').bind('click', function(e) { - if ( e.target && e.target.className ) { - if ( -1 != e.target.className.indexOf('item-edit') ) { - return that.eventOnClickEditLink(e.target); - } else if ( -1 != e.target.className.indexOf('menu-save') ) { - return that.eventOnClickMenuSave(e.target); - } else if ( -1 != e.target.className.indexOf('menu-delete') ) { - return that.eventOnClickMenuDelete(e.target); - } else if ( -1 != e.target.className.indexOf('item-delete') ) { - return that.eventOnClickMenuItemDelete(e.target); - } else if ( -1 != e.target.className.indexOf('item-cancel') ) { - return that.eventOnClickCancelLink(e.target); - } - } - }); - $('#add-custom-links input[type="text"]').keypress(function(e){ - if ( e.keyCode === 13 ) { - e.preventDefault(); - $("#submit-customlinkdiv").click(); - } - }); - }, - - /** - * An interface for managing default values for input elements - * that is both JS and accessibility-friendly. - * - * Input elements that add the class 'input-with-default-title' - * will have their values set to the provided HTML title when empty. - */ - setupInputWithDefaultTitle : function() { - var name = 'input-with-default-title'; - - $('.' + name).each( function(){ - var $t = $(this), title = $t.attr('title'), val = $t.val(); - $t.data( name, title ); - - if( '' == val ) $t.val( title ); - else if ( title == val ) return; - else $t.removeClass( name ); - }).focus( function(){ - var $t = $(this); - if( $t.val() == $t.data(name) ) - $t.val('').removeClass( name ); - }).blur( function(){ - var $t = $(this); - if( '' == $t.val() ) - $t.addClass( name ).val( $t.data(name) ); - }); - }, - - attachThemeLocationsListeners : function() { - var loc = $('#nav-menu-theme-locations'), params = {}; - params['action'] = 'menu-locations-save'; - params['menu-settings-column-nonce'] = $('#menu-settings-column-nonce').val(); - loc.find('input[type="submit"]').click(function() { - loc.find('select').each(function() { - params[this.name] = $(this).val(); - }); - loc.find('.waiting').show(); - $.post( ajaxurl, params, function(r) { - loc.find('.waiting').hide(); - }); - return false; - }); - }, - - attachQuickSearchListeners : function() { - var searchTimer; - - $('.quick-search').keypress(function(e){ - var t = $(this); - - if( 13 == e.which ) { - api.updateQuickSearchResults( t ); - return false; - } - - if( searchTimer ) clearTimeout(searchTimer); - - searchTimer = setTimeout(function(){ - api.updateQuickSearchResults( t ); - }, 400); - }).attr('autocomplete','off'); - }, - - updateQuickSearchResults : function(input) { - var panel, params, - minSearchLength = 2, - q = input.val(); - - if( q.length < minSearchLength ) return; - - panel = input.parents('.tabs-panel'); - params = { - 'action': 'menu-quick-search', - 'response-format': 'markup', - 'menu': $('#menu').val(), - 'menu-settings-column-nonce': $('#menu-settings-column-nonce').val(), - 'q': q, - 'type': input.attr('name') - }; - - $('img.waiting', panel).show(); - - $.post( ajaxurl, params, function(menuMarkup) { - api.processQuickSearchQueryResponse(menuMarkup, params, panel); - }); - }, - - addCustomLink : function( processMethod ) { - var url = $('#custom-menu-item-url').val(), - label = $('#custom-menu-item-name').val(); - - processMethod = processMethod || api.addMenuItemToBottom; - - if ( '' == url || 'http://' == url ) - return false; - - // Show the ajax spinner - $('.customlinkdiv img.waiting').show(); - this.addLinkToMenu( url, label, processMethod, function() { - // Remove the ajax spinner - $('.customlinkdiv img.waiting').hide(); - // Set custom link form back to defaults - $('#custom-menu-item-name').val('').blur(); - $('#custom-menu-item-url').val('http://'); - }); - }, - - addLinkToMenu : function(url, label, processMethod, callback) { - processMethod = processMethod || api.addMenuItemToBottom; - callback = callback || function(){}; - - api.addItemToMenu({ - '-1': { - 'menu-item-type': 'custom', - 'menu-item-url': url, - 'menu-item-title': label - } - }, processMethod, callback); - }, - - addItemToMenu : function(menuItem, processMethod, callback) { - var menu = $('#menu').val(), - nonce = $('#menu-settings-column-nonce').val(); - - processMethod = processMethod || function(){}; - callback = callback || function(){}; - - params = { - 'action': 'add-menu-item', - 'menu': menu, - 'menu-settings-column-nonce': nonce, - 'menu-item': menuItem - }; - - $.post( ajaxurl, params, function(menuMarkup) { - var ins = $('#menu-instructions'); - processMethod(menuMarkup, params); - if( ! ins.hasClass('menu-instructions-inactive') && ins.siblings().length ) - ins.addClass('menu-instructions-inactive'); - callback(); - }); - }, - - /** - * Process the add menu item request response into menu list item. - * - * @param string menuMarkup The text server response of menu item markup. - * @param object req The request arguments. - */ - addMenuItemToBottom : function( menuMarkup, req ) { - $(menuMarkup).hideAdvancedMenuItemFields().appendTo( api.targetList ); - }, - - addMenuItemToTop : function( menuMarkup, req ) { - $(menuMarkup).hideAdvancedMenuItemFields().prependTo( api.targetList ); - }, - - attachUnsavedChangesListener : function() { - $('#menu-management input, #menu-management select, #menu-management, #menu-management textarea').change(function(){ - api.registerChange(); - }); - - if ( 0 != $('#menu-to-edit').length ) { - window.onbeforeunload = function(){ - if ( api.menusChanged ) - return navMenuL10n.saveAlert; - }; - } else { - // Make the post boxes read-only, as they can't be used yet - $('#menu-settings-column').find('input,select').prop('disabled', true).end().find('a').attr('href', '#').unbind('click'); - } - }, - - registerChange : function() { - api.menusChanged = true; - }, - - attachTabsPanelListeners : function() { - $('#menu-settings-column').bind('click', function(e) { - var selectAreaMatch, panelId, wrapper, items, - target = $(e.target); - - if ( target.hasClass('nav-tab-link') ) { - panelId = /#(.*)$/.exec(e.target.href); - if ( panelId && panelId[1] ) - panelId = panelId[1] - else - return false; - - wrapper = target.parents('.inside').first(); - - // upon changing tabs, we want to uncheck all checkboxes - $('input', wrapper).removeAttr('checked'); - - $('.tabs-panel-active', wrapper).removeClass('tabs-panel-active').addClass('tabs-panel-inactive'); - $('#' + panelId, wrapper).removeClass('tabs-panel-inactive').addClass('tabs-panel-active'); - - $('.tabs', wrapper).removeClass('tabs'); - target.parent().addClass('tabs'); - - // select the search bar - $('.quick-search', wrapper).focus(); - - return false; - } else if ( target.hasClass('select-all') ) { - selectAreaMatch = /#(.*)$/.exec(e.target.href); - if ( selectAreaMatch && selectAreaMatch[1] ) { - items = $('#' + selectAreaMatch[1] + ' .tabs-panel-active .menu-item-title input'); - if( items.length === items.filter(':checked').length ) - items.removeAttr('checked'); - else - items.prop('checked', true); - return false; - } - } else if ( target.hasClass('submit-add-to-menu') ) { - api.registerChange(); - - if ( e.target.id && 'submit-customlinkdiv' == e.target.id ) - api.addCustomLink( api.addMenuItemToBottom ); - else if ( e.target.id && -1 != e.target.id.indexOf('submit-') ) - $('#' + e.target.id.replace(/submit-/, '')).addSelectedToMenu( api.addMenuItemToBottom ); - return false; - } else if ( target.hasClass('page-numbers') ) { - $.post( ajaxurl, e.target.href.replace(/.*\?/, '').replace(/action=([^&]*)/, '') + '&action=menu-get-metabox', - function( resp ) { - if ( -1 == resp.indexOf('replace-id') ) - return; - - var metaBoxData = $.parseJSON(resp), - toReplace = document.getElementById(metaBoxData['replace-id']), - placeholder = document.createElement('div'), - wrap = document.createElement('div'); - - if ( ! metaBoxData['markup'] || ! toReplace ) - return; - - wrap.innerHTML = metaBoxData['markup'] ? metaBoxData['markup'] : ''; - - toReplace.parentNode.insertBefore( placeholder, toReplace ); - placeholder.parentNode.removeChild( toReplace ); - - placeholder.parentNode.insertBefore( wrap, placeholder ); - - placeholder.parentNode.removeChild( placeholder ); - - } - ); - - return false; - } - }); - }, - - initTabManager : function() { - var fixed = $('.nav-tabs-wrapper'), - fluid = fixed.children('.nav-tabs'), - active = fluid.children('.nav-tab-active'), - tabs = fluid.children('.nav-tab'), - tabsWidth = 0, - fixedRight, fixedLeft, - arrowLeft, arrowRight, resizeTimer, css = {}, - marginFluid = api.isRTL ? 'margin-right' : 'margin-left', - marginFixed = api.isRTL ? 'margin-left' : 'margin-right', - msPerPx = 2; - - /** - * Refreshes the menu tabs. - * Will show and hide arrows where necessary. - * Scrolls to the active tab by default. - * - * @param savePosition {boolean} Optional. Prevents scrolling so - * that the current position is maintained. Default false. - **/ - api.refreshMenuTabs = function( savePosition ) { - var fixedWidth = fixed.width(), - margin = 0, css = {}; - fixedLeft = fixed.offset().left; - fixedRight = fixedLeft + fixedWidth; - - if( !savePosition ) - active.makeTabVisible(); - - // Prevent space from building up next to the last tab if there's more to show - if( tabs.last().isTabVisible() ) { - margin = fixed.width() - tabsWidth; - margin = margin > 0 ? 0 : margin; - css[marginFluid] = margin + 'px'; - fluid.animate( css, 100, "linear" ); - } - - // Show the arrows only when necessary - if( fixedWidth > tabsWidth ) - arrowLeft.add( arrowRight ).hide(); - else - arrowLeft.add( arrowRight ).show(); - } - - $.fn.extend({ - makeTabVisible : function() { - var t = this.eq(0), left, right, css = {}, shift = 0; - - if( ! t.length ) return this; - - left = t.offset().left; - right = left + t.outerWidth(); - - if( right > fixedRight ) - shift = fixedRight - right; - else if ( left < fixedLeft ) - shift = fixedLeft - left; - - if( ! shift ) return this; - - css[marginFluid] = "+=" + api.negateIfRTL * shift + 'px'; - fluid.animate( css, Math.abs( shift ) * msPerPx, "linear" ); - return this; - }, - isTabVisible : function() { - var t = this.eq(0), - left = t.offset().left, - right = left + t.outerWidth(); - return ( right <= fixedRight && left >= fixedLeft ) ? true : false; - } - }); - - // Find the width of all tabs - tabs.each(function(){ - tabsWidth += $(this).outerWidth(true); - }); - - // Set up fixed margin for overflow, unset padding - css['padding'] = 0; - css[marginFixed] = (-1 * tabsWidth) + 'px'; - fluid.css( css ); - - // Build tab navigation - arrowLeft = $(''); - arrowRight = $(''); - // Attach to the document - fixed.wrap('