first commit
This commit is contained in:
318
wp-includes/js/admin-bar.js
Normal file
318
wp-includes/js/admin-bar.js
Normal file
@@ -0,0 +1,318 @@
|
||||
// use jQuery and hoverIntent if loaded
|
||||
if ( typeof(jQuery) != 'undefined' ) {
|
||||
if ( typeof(jQuery.fn.hoverIntent) == 'undefined' )
|
||||
(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);
|
||||
|
||||
jQuery(document).ready(function($){
|
||||
var adminbar = $('#wpadminbar'), refresh, touchOpen, touchClose, disableHoverIntent = false;
|
||||
|
||||
refresh = function(i, el){ // force the browser to refresh the tabbing index
|
||||
var node = $(el), tab = node.attr('tabindex');
|
||||
if ( tab )
|
||||
node.attr('tabindex', '0').attr('tabindex', tab);
|
||||
};
|
||||
|
||||
touchOpen = function(unbind) {
|
||||
adminbar.find('li.menupop').on('click.wp-mobile-hover', function(e) {
|
||||
var el = $(this);
|
||||
|
||||
if ( !el.hasClass('hover') ) {
|
||||
e.preventDefault();
|
||||
adminbar.find('li.menupop.hover').removeClass('hover');
|
||||
el.addClass('hover');
|
||||
}
|
||||
|
||||
if ( unbind ) {
|
||||
$('li.menupop').off('click.wp-mobile-hover');
|
||||
disableHoverIntent = false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
touchClose = function() {
|
||||
var mobileEvent = /Mobile\/.+Safari/.test(navigator.userAgent) ? 'touchstart' : 'click';
|
||||
// close any open drop-downs when the click/touch is not on the toolbar
|
||||
$(document.body).on( mobileEvent+'.wp-mobile-hover', function(e) {
|
||||
if ( !$(e.target).closest('#wpadminbar').length )
|
||||
adminbar.find('li.menupop.hover').removeClass('hover');
|
||||
});
|
||||
};
|
||||
|
||||
adminbar.removeClass('nojq').removeClass('nojs');
|
||||
|
||||
if ( 'ontouchstart' in window ) {
|
||||
adminbar.on('touchstart', function(){
|
||||
touchOpen(true);
|
||||
disableHoverIntent = true;
|
||||
});
|
||||
touchClose();
|
||||
} else if ( /IEMobile\/[1-9]/.test(navigator.userAgent) ) {
|
||||
touchOpen();
|
||||
touchClose();
|
||||
}
|
||||
|
||||
adminbar.find('li.menupop').hoverIntent({
|
||||
over: function(e){
|
||||
if ( disableHoverIntent )
|
||||
return;
|
||||
|
||||
$(this).addClass('hover');
|
||||
},
|
||||
out: function(e){
|
||||
if ( disableHoverIntent )
|
||||
return;
|
||||
|
||||
$(this).removeClass('hover');
|
||||
},
|
||||
timeout: 180,
|
||||
sensitivity: 7,
|
||||
interval: 100
|
||||
});
|
||||
|
||||
if ( window.location.hash )
|
||||
window.scrollBy( 0, -32 );
|
||||
|
||||
$('#wp-admin-bar-get-shortlink').click(function(e){
|
||||
e.preventDefault();
|
||||
$(this).addClass('selected').children('.shortlink-input').blur(function(){
|
||||
$(this).parents('#wp-admin-bar-get-shortlink').removeClass('selected');
|
||||
}).focus().select();
|
||||
});
|
||||
|
||||
$('#wpadminbar li.menupop > .ab-item').bind('keydown.adminbar', function(e){
|
||||
if ( e.which != 13 )
|
||||
return;
|
||||
|
||||
var target = $(e.target), wrap = target.closest('ab-sub-wrapper');
|
||||
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
if ( !wrap.length )
|
||||
wrap = $('#wpadminbar .quicklinks');
|
||||
|
||||
wrap.find('.menupop').removeClass('hover');
|
||||
target.parent().toggleClass('hover');
|
||||
target.siblings('.ab-sub-wrapper').find('.ab-item').each(refresh);
|
||||
}).each(refresh);
|
||||
|
||||
$('#wpadminbar .ab-item').bind('keydown.adminbar', function(e){
|
||||
if ( e.which != 27 )
|
||||
return;
|
||||
|
||||
var target = $(e.target);
|
||||
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
target.closest('.hover').removeClass('hover').children('.ab-item').focus();
|
||||
target.siblings('.ab-sub-wrapper').find('.ab-item').each(refresh);
|
||||
});
|
||||
|
||||
$('#wpadminbar').click( function(e) {
|
||||
if ( e.target.id != 'wpadminbar' && e.target.id != 'wp-admin-bar-top-secondary' )
|
||||
return;
|
||||
|
||||
e.preventDefault();
|
||||
$('html, body').animate({ scrollTop: 0 }, 'fast');
|
||||
});
|
||||
|
||||
// fix focus bug in WebKit
|
||||
$('.screen-reader-shortcut').keydown( function(e) {
|
||||
if ( 13 != e.which )
|
||||
return;
|
||||
|
||||
var id = $(this).attr('href');
|
||||
|
||||
if ( $.browser.webkit && id && id.charAt(0) == '#' ) {
|
||||
setTimeout(function () {
|
||||
$(id).focus();
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
(function(d, w) {
|
||||
var addEvent = function( obj, type, fn ) {
|
||||
if ( obj.addEventListener )
|
||||
obj.addEventListener(type, fn, false);
|
||||
else if ( obj.attachEvent )
|
||||
obj.attachEvent('on' + type, function() { return fn.call(obj, window.event);});
|
||||
},
|
||||
|
||||
aB, hc = new RegExp('\\bhover\\b', 'g'), q = [],
|
||||
rselected = new RegExp('\\bselected\\b', 'g'),
|
||||
|
||||
/**
|
||||
* Get the timeout ID of the given element
|
||||
*/
|
||||
getTOID = function(el) {
|
||||
var i = q.length;
|
||||
while ( i-- ) {
|
||||
if ( q[i] && el == q[i][1] )
|
||||
return q[i][0];
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
addHoverClass = function(t) {
|
||||
var i, id, inA, hovering, ul, li,
|
||||
ancestors = [],
|
||||
ancestorLength = 0;
|
||||
|
||||
while ( t && t != aB && t != d ) {
|
||||
if ( 'LI' == t.nodeName.toUpperCase() ) {
|
||||
ancestors[ ancestors.length ] = t;
|
||||
id = getTOID(t);
|
||||
if ( id )
|
||||
clearTimeout( id );
|
||||
t.className = t.className ? ( t.className.replace(hc, '') + ' hover' ) : 'hover';
|
||||
hovering = t;
|
||||
}
|
||||
t = t.parentNode;
|
||||
}
|
||||
|
||||
// Remove any selected classes.
|
||||
if ( hovering && hovering.parentNode ) {
|
||||
ul = hovering.parentNode;
|
||||
if ( ul && 'UL' == ul.nodeName.toUpperCase() ) {
|
||||
i = ul.childNodes.length;
|
||||
while ( i-- ) {
|
||||
li = ul.childNodes[i];
|
||||
if ( li != hovering )
|
||||
li.className = li.className ? li.className.replace( rselected, '' ) : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* remove the hover class for any objects not in the immediate element's ancestry */
|
||||
i = q.length;
|
||||
while ( i-- ) {
|
||||
inA = false;
|
||||
ancestorLength = ancestors.length;
|
||||
while( ancestorLength-- ) {
|
||||
if ( ancestors[ ancestorLength ] == q[i][1] )
|
||||
inA = true;
|
||||
}
|
||||
|
||||
if ( ! inA )
|
||||
q[i][1].className = q[i][1].className ? q[i][1].className.replace(hc, '') : '';
|
||||
}
|
||||
},
|
||||
|
||||
removeHoverClass = function(t) {
|
||||
while ( t && t != aB && t != d ) {
|
||||
if ( 'LI' == t.nodeName.toUpperCase() ) {
|
||||
(function(t) {
|
||||
var to = setTimeout(function() {
|
||||
t.className = t.className ? t.className.replace(hc, '') : '';
|
||||
}, 500);
|
||||
q[q.length] = [to, t];
|
||||
})(t);
|
||||
}
|
||||
t = t.parentNode;
|
||||
}
|
||||
},
|
||||
|
||||
clickShortlink = function(e) {
|
||||
var i, l, node,
|
||||
t = e.target || e.srcElement;
|
||||
|
||||
// Make t the shortlink menu item, or return.
|
||||
while ( true ) {
|
||||
// Check if we've gone past the shortlink node,
|
||||
// or if the user is clicking on the input.
|
||||
if ( ! t || t == d || t == aB )
|
||||
return;
|
||||
// Check if we've found the shortlink node.
|
||||
if ( t.id && t.id == 'wp-admin-bar-get-shortlink' )
|
||||
break;
|
||||
t = t.parentNode;
|
||||
}
|
||||
|
||||
// IE doesn't support preventDefault, and does support returnValue
|
||||
if ( e.preventDefault )
|
||||
e.preventDefault();
|
||||
e.returnValue = false;
|
||||
|
||||
if ( -1 == t.className.indexOf('selected') )
|
||||
t.className += ' selected';
|
||||
|
||||
for ( i = 0, l = t.childNodes.length; i < l; i++ ) {
|
||||
node = t.childNodes[i];
|
||||
if ( node.className && -1 != node.className.indexOf('shortlink-input') ) {
|
||||
node.focus();
|
||||
node.select();
|
||||
node.onblur = function() {
|
||||
t.className = t.className ? t.className.replace( rselected, '' ) : '';
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
scrollToTop = function(t) {
|
||||
var distance, speed, step, steps, timer, speed_step;
|
||||
|
||||
// Ensure that the #wpadminbar was the target of the click.
|
||||
if ( t.id != 'wpadminbar' && t.id != 'wp-admin-bar-top-secondary' )
|
||||
return;
|
||||
|
||||
distance = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
|
||||
|
||||
if ( distance < 1 )
|
||||
return;
|
||||
|
||||
speed_step = distance > 800 ? 130 : 100;
|
||||
speed = Math.min( 12, Math.round( distance / speed_step ) );
|
||||
step = distance > 800 ? Math.round( distance / 30 ) : Math.round( distance / 20 );
|
||||
steps = [];
|
||||
timer = 0;
|
||||
|
||||
// Animate scrolling to the top of the page by generating steps to
|
||||
// the top of the page and shifting to each step at a set interval.
|
||||
while ( distance ) {
|
||||
distance -= step;
|
||||
if ( distance < 0 )
|
||||
distance = 0;
|
||||
steps.push( distance );
|
||||
|
||||
setTimeout( function() {
|
||||
window.scrollTo( 0, steps.shift() );
|
||||
}, timer * speed );
|
||||
|
||||
timer++;
|
||||
}
|
||||
};
|
||||
|
||||
addEvent(w, 'load', function() {
|
||||
aB = d.getElementById('wpadminbar');
|
||||
|
||||
if ( d.body && aB ) {
|
||||
d.body.appendChild( aB );
|
||||
|
||||
if ( aB.className )
|
||||
aB.className = aB.className.replace(/nojs/, '');
|
||||
|
||||
addEvent(aB, 'mouseover', function(e) {
|
||||
addHoverClass( e.target || e.srcElement );
|
||||
});
|
||||
|
||||
addEvent(aB, 'mouseout', function(e) {
|
||||
removeHoverClass( e.target || e.srcElement );
|
||||
});
|
||||
|
||||
addEvent(aB, 'click', clickShortlink );
|
||||
|
||||
addEvent(aB, 'click', function(e) {
|
||||
scrollToTop( e.target || e.srcElement );
|
||||
});
|
||||
}
|
||||
|
||||
if ( w.location.hash )
|
||||
w.scrollBy(0,-32);
|
||||
});
|
||||
})(document, window);
|
||||
|
||||
}
|
||||
1
wp-includes/js/admin-bar.min.js
vendored
Normal file
1
wp-includes/js/admin-bar.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
351
wp-includes/js/autosave.js
Normal file
351
wp-includes/js/autosave.js
Normal file
@@ -0,0 +1,351 @@
|
||||
var autosave, autosaveLast = '', autosavePeriodical, autosaveOldMessage = '', autosaveDelayPreview = false, notSaved = true, blockSave = false, fullscreen, autosaveLockRelease = true;
|
||||
|
||||
jQuery(document).ready( function($) {
|
||||
|
||||
autosaveLast = ( $('#post #title').val() || '' ) + ( $('#post #content').val() || '' );
|
||||
autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true});
|
||||
|
||||
//Disable autosave after the form has been submitted
|
||||
$("#post").submit(function() {
|
||||
$.cancel(autosavePeriodical);
|
||||
autosaveLockRelease = false;
|
||||
});
|
||||
|
||||
$('input[type="submit"], a.submitdelete', '#submitpost').click(function(){
|
||||
blockSave = true;
|
||||
window.onbeforeunload = null;
|
||||
$(':button, :submit', '#submitpost').each(function(){
|
||||
var t = $(this);
|
||||
if ( t.hasClass('button-primary') )
|
||||
t.addClass('button-primary-disabled');
|
||||
else
|
||||
t.addClass('button-disabled');
|
||||
});
|
||||
if ( $(this).attr('id') == 'publish' )
|
||||
$('#major-publishing-actions .spinner').show();
|
||||
else
|
||||
$('#minor-publishing .spinner').show();
|
||||
});
|
||||
|
||||
window.onbeforeunload = function(){
|
||||
var mce = typeof(tinymce) != 'undefined' ? tinymce.activeEditor : false, title, content;
|
||||
|
||||
if ( mce && !mce.isHidden() ) {
|
||||
if ( mce.isDirty() )
|
||||
return autosaveL10n.saveAlert;
|
||||
} else {
|
||||
if ( fullscreen && fullscreen.settings.visible ) {
|
||||
title = $('#wp-fullscreen-title').val() || '';
|
||||
content = $("#wp_mce_fullscreen").val() || '';
|
||||
} else {
|
||||
title = $('#post #title').val() || '';
|
||||
content = $('#post #content').val() || '';
|
||||
}
|
||||
|
||||
if ( ( title || content ) && title + content != autosaveLast )
|
||||
return autosaveL10n.saveAlert;
|
||||
}
|
||||
};
|
||||
|
||||
$(window).unload( function(e) {
|
||||
if ( ! autosaveLockRelease )
|
||||
return;
|
||||
|
||||
// unload fires (twice) on removing the Thickbox iframe. Make sure we process only the main document unload.
|
||||
if ( e.target && e.target.nodeName != '#document' )
|
||||
return;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajaxurl,
|
||||
async: false,
|
||||
data: {
|
||||
action: 'wp-remove-post-lock',
|
||||
_wpnonce: $('#_wpnonce').val(),
|
||||
post_ID: $('#post_ID').val(),
|
||||
active_post_lock: $('#active_post_lock').val()
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
// preview
|
||||
$('#post-preview').click(function(){
|
||||
if ( $('#auto_draft').val() == '1' && notSaved ) {
|
||||
autosaveDelayPreview = true;
|
||||
autosave();
|
||||
return false;
|
||||
}
|
||||
doPreview();
|
||||
return false;
|
||||
});
|
||||
|
||||
doPreview = function() {
|
||||
$('input#wp-preview').val('dopreview');
|
||||
$('form#post').attr('target', 'wp-preview').submit().attr('target', '');
|
||||
|
||||
/*
|
||||
* Workaround for WebKit bug preventing a form submitting twice to the same action.
|
||||
* https://bugs.webkit.org/show_bug.cgi?id=28633
|
||||
*/
|
||||
if ( $.browser.safari ) {
|
||||
$('form#post').attr('action', function(index, value) {
|
||||
return value + '?t=' + new Date().getTime();
|
||||
});
|
||||
}
|
||||
|
||||
$('input#wp-preview').val('');
|
||||
}
|
||||
|
||||
// This code is meant to allow tabbing from Title to Post content.
|
||||
$('#title').on('keydown.editor-focus', function(e) {
|
||||
var ed;
|
||||
|
||||
if ( e.which != 9 )
|
||||
return;
|
||||
|
||||
if ( !e.ctrlKey && !e.altKey && !e.shiftKey ) {
|
||||
if ( typeof(tinymce) != 'undefined' )
|
||||
ed = tinymce.get('content');
|
||||
|
||||
if ( ed && !ed.isHidden() ) {
|
||||
$(this).one('keyup', function(e){
|
||||
$('#content_tbl td.mceToolbar > a').focus();
|
||||
});
|
||||
} else {
|
||||
$('#content').focus();
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// autosave new posts after a title is typed but not if Publish or Save Draft is clicked
|
||||
if ( '1' == $('#auto_draft').val() ) {
|
||||
$('#title').blur( function() {
|
||||
if ( !this.value || $('#auto_draft').val() != '1' )
|
||||
return;
|
||||
delayed_autosave();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function autosave_parse_response(response) {
|
||||
var res = wpAjax.parseAjaxResponse(response, 'autosave'), message = '', postID, sup;
|
||||
|
||||
if ( res && res.responses && res.responses.length ) {
|
||||
message = res.responses[0].data; // The saved message or error.
|
||||
// someone else is editing: disable autosave, set errors
|
||||
if ( res.responses[0].supplemental ) {
|
||||
sup = res.responses[0].supplemental;
|
||||
if ( 'disable' == sup['disable_autosave'] ) {
|
||||
autosave = function() {};
|
||||
autosaveLockRelease = false;
|
||||
res = { errors: true };
|
||||
}
|
||||
|
||||
if ( sup['active-post-lock'] ) {
|
||||
jQuery('#active_post_lock').val( sup['active-post-lock'] );
|
||||
}
|
||||
|
||||
if ( sup['alert'] ) {
|
||||
jQuery('#autosave-alert').remove();
|
||||
jQuery('#titlediv').after('<div id="autosave-alert" class="error below-h2"><p>' + sup['alert'] + '</p></div>');
|
||||
}
|
||||
|
||||
jQuery.each(sup, function(selector, value) {
|
||||
if ( selector.match(/^replace-/) ) {
|
||||
jQuery('#'+selector.replace('replace-', '')).val(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// if no errors: add slug UI
|
||||
if ( !res.errors ) {
|
||||
postID = parseInt( res.responses[0].id, 10 );
|
||||
if ( !isNaN(postID) && postID > 0 ) {
|
||||
autosave_update_slug(postID);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( message ) { // update autosave message
|
||||
jQuery('.autosave-message').html(message);
|
||||
} else if ( autosaveOldMessage && res ) {
|
||||
jQuery('.autosave-message').html( autosaveOldMessage );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// called when autosaving pre-existing post
|
||||
function autosave_saved(response) {
|
||||
blockSave = false;
|
||||
autosave_parse_response(response); // parse the ajax response
|
||||
autosave_enable_buttons(); // re-enable disabled form buttons
|
||||
}
|
||||
|
||||
// called when autosaving new post
|
||||
function autosave_saved_new(response) {
|
||||
blockSave = false;
|
||||
var res = autosave_parse_response(response), postID;
|
||||
if ( res && res.responses.length && !res.errors ) {
|
||||
// An ID is sent only for real auto-saves, not for autosave=0 "keepalive" saves
|
||||
postID = parseInt( res.responses[0].id, 10 );
|
||||
if ( !isNaN(postID) && postID > 0 ) {
|
||||
notSaved = false;
|
||||
jQuery('#auto_draft').val('0'); // No longer an auto-draft
|
||||
}
|
||||
autosave_enable_buttons();
|
||||
if ( autosaveDelayPreview ) {
|
||||
autosaveDelayPreview = false;
|
||||
doPreview();
|
||||
}
|
||||
} else {
|
||||
autosave_enable_buttons(); // re-enable disabled form buttons
|
||||
}
|
||||
}
|
||||
|
||||
function autosave_update_slug(post_id) {
|
||||
// create slug area only if not already there
|
||||
if ( 'undefined' != makeSlugeditClickable && jQuery.isFunction(makeSlugeditClickable) && !jQuery('#edit-slug-box > *').size() ) {
|
||||
jQuery.post( ajaxurl, {
|
||||
action: 'sample-permalink',
|
||||
post_id: post_id,
|
||||
new_title: fullscreen && fullscreen.settings.visible ? jQuery('#wp-fullscreen-title').val() : jQuery('#title').val(),
|
||||
samplepermalinknonce: jQuery('#samplepermalinknonce').val()
|
||||
},
|
||||
function(data) {
|
||||
if ( data !== '-1' ) {
|
||||
jQuery('#edit-slug-box').html(data);
|
||||
makeSlugeditClickable();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function autosave_loading() {
|
||||
jQuery('.autosave-message').html(autosaveL10n.savingText);
|
||||
}
|
||||
|
||||
function autosave_enable_buttons() {
|
||||
// delay that a bit to avoid some rare collisions while the DOM is being updated.
|
||||
setTimeout(function(){
|
||||
jQuery(':button, :submit', '#submitpost').removeAttr('disabled');
|
||||
jQuery('.spinner', '#submitpost').hide();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
function autosave_disable_buttons() {
|
||||
jQuery(':button, :submit', '#submitpost').prop('disabled', true);
|
||||
// Re-enable 5 sec later. Just gives autosave a head start to avoid collisions.
|
||||
setTimeout(autosave_enable_buttons, 5000);
|
||||
}
|
||||
|
||||
function delayed_autosave() {
|
||||
setTimeout(function(){
|
||||
if ( blockSave )
|
||||
return;
|
||||
autosave();
|
||||
}, 200);
|
||||
}
|
||||
|
||||
autosave = function() {
|
||||
// (bool) is rich editor enabled and active
|
||||
blockSave = true;
|
||||
var rich = (typeof tinymce != "undefined") && tinymce.activeEditor && !tinymce.activeEditor.isHidden(),
|
||||
post_data, doAutoSave, ed, origStatus, successCallback;
|
||||
|
||||
autosave_disable_buttons();
|
||||
|
||||
post_data = {
|
||||
action: "autosave",
|
||||
post_ID: jQuery("#post_ID").val() || 0,
|
||||
autosavenonce: jQuery('#autosavenonce').val(),
|
||||
post_type: jQuery('#post_type').val() || "",
|
||||
autosave: 1
|
||||
};
|
||||
|
||||
jQuery('.tags-input').each( function() {
|
||||
post_data[this.name] = this.value;
|
||||
} );
|
||||
|
||||
// We always send the ajax request in order to keep the post lock fresh.
|
||||
// This (bool) tells whether or not to write the post to the DB during the ajax request.
|
||||
doAutoSave = true;
|
||||
|
||||
// No autosave while thickbox is open (media buttons)
|
||||
if ( jQuery("#TB_window").css('display') == 'block' )
|
||||
doAutoSave = false;
|
||||
|
||||
/* Gotta do this up here so we can check the length when tinymce is in use */
|
||||
if ( rich && doAutoSave ) {
|
||||
ed = tinymce.activeEditor;
|
||||
// Don't run while the tinymce spellcheck is on. It resets all found words.
|
||||
if ( ed.plugins.spellchecker && ed.plugins.spellchecker.active ) {
|
||||
doAutoSave = false;
|
||||
} else {
|
||||
if ( 'mce_fullscreen' == ed.id || 'wp_mce_fullscreen' == ed.id )
|
||||
tinymce.get('content').setContent(ed.getContent({format : 'raw'}), {format : 'raw'});
|
||||
tinymce.triggerSave();
|
||||
}
|
||||
}
|
||||
|
||||
if ( fullscreen && fullscreen.settings.visible ) {
|
||||
post_data["post_title"] = jQuery('#wp-fullscreen-title').val() || '';
|
||||
post_data["content"] = jQuery("#wp_mce_fullscreen").val() || '';
|
||||
} else {
|
||||
post_data["post_title"] = jQuery("#title").val() || '';
|
||||
post_data["content"] = jQuery("#content").val() || '';
|
||||
}
|
||||
|
||||
if ( jQuery('#post_name').val() )
|
||||
post_data["post_name"] = jQuery('#post_name').val();
|
||||
|
||||
// Nothing to save or no change.
|
||||
if ( ( post_data["post_title"].length == 0 && post_data["content"].length == 0 ) || post_data["post_title"] + post_data["content"] == autosaveLast ) {
|
||||
doAutoSave = false;
|
||||
}
|
||||
|
||||
origStatus = jQuery('#original_post_status').val();
|
||||
|
||||
goodcats = ([]);
|
||||
jQuery("[name='post_category[]']:checked").each( function(i) {
|
||||
goodcats.push(this.value);
|
||||
} );
|
||||
post_data["catslist"] = goodcats.join(",");
|
||||
|
||||
if ( jQuery("#comment_status").prop("checked") )
|
||||
post_data["comment_status"] = 'open';
|
||||
if ( jQuery("#ping_status").prop("checked") )
|
||||
post_data["ping_status"] = 'open';
|
||||
if ( jQuery("#excerpt").size() )
|
||||
post_data["excerpt"] = jQuery("#excerpt").val();
|
||||
if ( jQuery("#post_author").size() )
|
||||
post_data["post_author"] = jQuery("#post_author").val();
|
||||
if ( jQuery("#parent_id").val() )
|
||||
post_data["parent_id"] = jQuery("#parent_id").val();
|
||||
post_data["user_ID"] = jQuery("#user-id").val();
|
||||
if ( jQuery('#auto_draft').val() == '1' )
|
||||
post_data["auto_draft"] = '1';
|
||||
|
||||
if ( doAutoSave ) {
|
||||
autosaveLast = post_data["post_title"] + post_data["content"];
|
||||
jQuery(document).triggerHandler('wpcountwords', [ post_data["content"] ]);
|
||||
} else {
|
||||
post_data['autosave'] = 0;
|
||||
}
|
||||
|
||||
if ( post_data["auto_draft"] == '1' ) {
|
||||
successCallback = autosave_saved_new; // new post
|
||||
} else {
|
||||
successCallback = autosave_saved; // pre-existing post
|
||||
}
|
||||
|
||||
autosaveOldMessage = jQuery('#autosave').html();
|
||||
jQuery.ajax({
|
||||
data: post_data,
|
||||
beforeSend: doAutoSave ? autosave_loading : null,
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
success: successCallback
|
||||
});
|
||||
}
|
||||
1
wp-includes/js/autosave.min.js
vendored
Normal file
1
wp-includes/js/autosave.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
38
wp-includes/js/backbone.min.js
vendored
Normal file
38
wp-includes/js/backbone.min.js
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
// Backbone.js 0.9.2
|
||||
|
||||
// (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc.
|
||||
// Backbone may be freely distributed under the MIT license.
|
||||
// For all details and documentation:
|
||||
// http://backbonejs.org
|
||||
(function(){var l=this,y=l.Backbone,z=Array.prototype.slice,A=Array.prototype.splice,g;g="undefined"!==typeof exports?exports:l.Backbone={};g.VERSION="0.9.2";var f=l._;!f&&"undefined"!==typeof require&&(f=require("underscore"));var i=l.jQuery||l.Zepto||l.ender;g.setDomLibrary=function(a){i=a};g.noConflict=function(){l.Backbone=y;return this};g.emulateHTTP=!1;g.emulateJSON=!1;var p=/\s+/,k=g.Events={on:function(a,b,c){var d,e,f,g,j;if(!b)return this;a=a.split(p);for(d=this._callbacks||(this._callbacks=
|
||||
{});e=a.shift();)f=(j=d[e])?j.tail:{},f.next=g={},f.context=c,f.callback=b,d[e]={tail:g,next:j?j.next:f};return this},off:function(a,b,c){var d,e,h,g,j,q;if(e=this._callbacks){if(!a&&!b&&!c)return delete this._callbacks,this;for(a=a?a.split(p):f.keys(e);d=a.shift();)if(h=e[d],delete e[d],h&&(b||c))for(g=h.tail;(h=h.next)!==g;)if(j=h.callback,q=h.context,b&&j!==b||c&&q!==c)this.on(d,j,q);return this}},trigger:function(a){var b,c,d,e,f,g;if(!(d=this._callbacks))return this;f=d.all;a=a.split(p);for(g=
|
||||
z.call(arguments,1);b=a.shift();){if(c=d[b])for(e=c.tail;(c=c.next)!==e;)c.callback.apply(c.context||this,g);if(c=f){e=c.tail;for(b=[b].concat(g);(c=c.next)!==e;)c.callback.apply(c.context||this,b)}}return this}};k.bind=k.on;k.unbind=k.off;var o=g.Model=function(a,b){var c;a||(a={});b&&b.parse&&(a=this.parse(a));if(c=n(this,"defaults"))a=f.extend({},c,a);b&&b.collection&&(this.collection=b.collection);this.attributes={};this._escapedAttributes={};this.cid=f.uniqueId("c");this.changed={};this._silent=
|
||||
{};this._pending={};this.set(a,{silent:!0});this.changed={};this._silent={};this._pending={};this._previousAttributes=f.clone(this.attributes);this.initialize.apply(this,arguments)};f.extend(o.prototype,k,{changed:null,_silent:null,_pending:null,idAttribute:"id",initialize:function(){},toJSON:function(){return f.clone(this.attributes)},get:function(a){return this.attributes[a]},escape:function(a){var b;if(b=this._escapedAttributes[a])return b;b=this.get(a);return this._escapedAttributes[a]=f.escape(null==
|
||||
b?"":""+b)},has:function(a){return null!=this.get(a)},set:function(a,b,c){var d,e;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b);c||(c={});if(!d)return this;d instanceof o&&(d=d.attributes);if(c.unset)for(e in d)d[e]=void 0;if(!this._validate(d,c))return!1;this.idAttribute in d&&(this.id=d[this.idAttribute]);var b=c.changes={},h=this.attributes,g=this._escapedAttributes,j=this._previousAttributes||{};for(e in d){a=d[e];if(!f.isEqual(h[e],a)||c.unset&&f.has(h,e))delete g[e],(c.silent?this._silent:
|
||||
b)[e]=!0;c.unset?delete h[e]:h[e]=a;!f.isEqual(j[e],a)||f.has(h,e)!=f.has(j,e)?(this.changed[e]=a,c.silent||(this._pending[e]=!0)):(delete this.changed[e],delete this._pending[e])}c.silent||this.change(c);return this},unset:function(a,b){(b||(b={})).unset=!0;return this.set(a,null,b)},clear:function(a){(a||(a={})).unset=!0;return this.set(f.clone(this.attributes),a)},fetch:function(a){var a=a?f.clone(a):{},b=this,c=a.success;a.success=function(d,e,f){if(!b.set(b.parse(d,f),a))return!1;c&&c(b,d)};
|
||||
a.error=g.wrapError(a.error,b,a);return(this.sync||g.sync).call(this,"read",this,a)},save:function(a,b,c){var d,e;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b);c=c?f.clone(c):{};if(c.wait){if(!this._validate(d,c))return!1;e=f.clone(this.attributes)}a=f.extend({},c,{silent:!0});if(d&&!this.set(d,c.wait?a:c))return!1;var h=this,i=c.success;c.success=function(a,b,e){b=h.parse(a,e);if(c.wait){delete c.wait;b=f.extend(d||{},b)}if(!h.set(b,c))return false;i?i(h,a):h.trigger("sync",h,a,c)};c.error=g.wrapError(c.error,
|
||||
h,c);b=this.isNew()?"create":"update";b=(this.sync||g.sync).call(this,b,this,c);c.wait&&this.set(e,a);return b},destroy:function(a){var a=a?f.clone(a):{},b=this,c=a.success,d=function(){b.trigger("destroy",b,b.collection,a)};if(this.isNew())return d(),!1;a.success=function(e){a.wait&&d();c?c(b,e):b.trigger("sync",b,e,a)};a.error=g.wrapError(a.error,b,a);var e=(this.sync||g.sync).call(this,"delete",this,a);a.wait||d();return e},url:function(){var a=n(this,"urlRoot")||n(this.collection,"url")||t();
|
||||
return this.isNew()?a:a+("/"==a.charAt(a.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(a){return a},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},change:function(a){a||(a={});var b=this._changing;this._changing=!0;for(var c in this._silent)this._pending[c]=!0;var d=f.extend({},a.changes,this._silent);this._silent={};for(c in d)this.trigger("change:"+c,this,this.get(c),a);if(b)return this;for(;!f.isEmpty(this._pending);){this._pending=
|
||||
{};this.trigger("change",this,a);for(c in this.changed)!this._pending[c]&&!this._silent[c]&&delete this.changed[c];this._previousAttributes=f.clone(this.attributes)}this._changing=!1;return this},hasChanged:function(a){return!arguments.length?!f.isEmpty(this.changed):f.has(this.changed,a)},changedAttributes:function(a){if(!a)return this.hasChanged()?f.clone(this.changed):!1;var b,c=!1,d=this._previousAttributes,e;for(e in a)if(!f.isEqual(d[e],b=a[e]))(c||(c={}))[e]=b;return c},previous:function(a){return!arguments.length||
|
||||
!this._previousAttributes?null:this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},isValid:function(){return!this.validate(this.attributes)},_validate:function(a,b){if(b.silent||!this.validate)return!0;var a=f.extend({},this.attributes,a),c=this.validate(a,b);if(!c)return!0;b&&b.error?b.error(this,c,b):this.trigger("error",this,c,b);return!1}});var r=g.Collection=function(a,b){b||(b={});b.model&&(this.model=b.model);b.comparator&&(this.comparator=b.comparator);
|
||||
this._reset();this.initialize.apply(this,arguments);a&&this.reset(a,{silent:!0,parse:b.parse})};f.extend(r.prototype,k,{model:o,initialize:function(){},toJSON:function(a){return this.map(function(b){return b.toJSON(a)})},add:function(a,b){var c,d,e,g,i,j={},k={},l=[];b||(b={});a=f.isArray(a)?a.slice():[a];c=0;for(d=a.length;c<d;c++){if(!(e=a[c]=this._prepareModel(a[c],b)))throw Error("Can't add an invalid model to a collection");g=e.cid;i=e.id;j[g]||this._byCid[g]||null!=i&&(k[i]||this._byId[i])?
|
||||
l.push(c):j[g]=k[i]=e}for(c=l.length;c--;)a.splice(l[c],1);c=0;for(d=a.length;c<d;c++)(e=a[c]).on("all",this._onModelEvent,this),this._byCid[e.cid]=e,null!=e.id&&(this._byId[e.id]=e);this.length+=d;A.apply(this.models,[null!=b.at?b.at:this.models.length,0].concat(a));this.comparator&&this.sort({silent:!0});if(b.silent)return this;c=0;for(d=this.models.length;c<d;c++)if(j[(e=this.models[c]).cid])b.index=c,e.trigger("add",e,this,b);return this},remove:function(a,b){var c,d,e,g;b||(b={});a=f.isArray(a)?
|
||||
a.slice():[a];c=0;for(d=a.length;c<d;c++)if(g=this.getByCid(a[c])||this.get(a[c]))delete this._byId[g.id],delete this._byCid[g.cid],e=this.indexOf(g),this.models.splice(e,1),this.length--,b.silent||(b.index=e,g.trigger("remove",g,this,b)),this._removeReference(g);return this},push:function(a,b){a=this._prepareModel(a,b);this.add(a,b);return a},pop:function(a){var b=this.at(this.length-1);this.remove(b,a);return b},unshift:function(a,b){a=this._prepareModel(a,b);this.add(a,f.extend({at:0},b));return a},
|
||||
shift:function(a){var b=this.at(0);this.remove(b,a);return b},get:function(a){return null==a?void 0:this._byId[null!=a.id?a.id:a]},getByCid:function(a){return a&&this._byCid[a.cid||a]},at:function(a){return this.models[a]},where:function(a){return f.isEmpty(a)?[]:this.filter(function(b){for(var c in a)if(a[c]!==b.get(c))return!1;return!0})},sort:function(a){a||(a={});if(!this.comparator)throw Error("Cannot sort a set without a comparator");var b=f.bind(this.comparator,this);1==this.comparator.length?
|
||||
this.models=this.sortBy(b):this.models.sort(b);a.silent||this.trigger("reset",this,a);return this},pluck:function(a){return f.map(this.models,function(b){return b.get(a)})},reset:function(a,b){a||(a=[]);b||(b={});for(var c=0,d=this.models.length;c<d;c++)this._removeReference(this.models[c]);this._reset();this.add(a,f.extend({silent:!0},b));b.silent||this.trigger("reset",this,b);return this},fetch:function(a){a=a?f.clone(a):{};void 0===a.parse&&(a.parse=!0);var b=this,c=a.success;a.success=function(d,
|
||||
e,f){b[a.add?"add":"reset"](b.parse(d,f),a);c&&c(b,d)};a.error=g.wrapError(a.error,b,a);return(this.sync||g.sync).call(this,"read",this,a)},create:function(a,b){var c=this,b=b?f.clone(b):{},a=this._prepareModel(a,b);if(!a)return!1;b.wait||c.add(a,b);var d=b.success;b.success=function(e,f){b.wait&&c.add(e,b);d?d(e,f):e.trigger("sync",a,f,b)};a.save(null,b);return a},parse:function(a){return a},chain:function(){return f(this.models).chain()},_reset:function(){this.length=0;this.models=[];this._byId=
|
||||
{};this._byCid={}},_prepareModel:function(a,b){b||(b={});a instanceof o?a.collection||(a.collection=this):(b.collection=this,a=new this.model(a,b),a._validate(a.attributes,b)||(a=!1));return a},_removeReference:function(a){this==a.collection&&delete a.collection;a.off("all",this._onModelEvent,this)},_onModelEvent:function(a,b,c,d){("add"==a||"remove"==a)&&c!=this||("destroy"==a&&this.remove(b,d),b&&a==="change:"+b.idAttribute&&(delete this._byId[b.previous(b.idAttribute)],this._byId[b.id]=b),this.trigger.apply(this,
|
||||
arguments))}});f.each("forEach,each,map,reduce,reduceRight,find,detect,filter,select,reject,every,all,some,any,include,contains,invoke,max,min,sortBy,sortedIndex,toArray,size,first,initial,rest,last,without,indexOf,shuffle,lastIndexOf,isEmpty,groupBy".split(","),function(a){r.prototype[a]=function(){return f[a].apply(f,[this.models].concat(f.toArray(arguments)))}});var u=g.Router=function(a){a||(a={});a.routes&&(this.routes=a.routes);this._bindRoutes();this.initialize.apply(this,arguments)},B=/:\w+/g,
|
||||
C=/\*\w+/g,D=/[-[\]{}()+?.,\\^$|#\s]/g;f.extend(u.prototype,k,{initialize:function(){},route:function(a,b,c){g.history||(g.history=new m);f.isRegExp(a)||(a=this._routeToRegExp(a));c||(c=this[b]);g.history.route(a,f.bind(function(d){d=this._extractParameters(a,d);c&&c.apply(this,d);this.trigger.apply(this,["route:"+b].concat(d));g.history.trigger("route",this,b,d)},this));return this},navigate:function(a,b){g.history.navigate(a,b)},_bindRoutes:function(){if(this.routes){var a=[],b;for(b in this.routes)a.unshift([b,
|
||||
this.routes[b]]);b=0;for(var c=a.length;b<c;b++)this.route(a[b][0],a[b][1],this[a[b][1]])}},_routeToRegExp:function(a){a=a.replace(D,"\\$&").replace(B,"([^/]+)").replace(C,"(.*?)");return RegExp("^"+a+"$")},_extractParameters:function(a,b){return a.exec(b).slice(1)}});var m=g.History=function(){this.handlers=[];f.bindAll(this,"checkUrl")},s=/^[#\/]/,E=/msie [\w.]+/;m.started=!1;f.extend(m.prototype,k,{interval:50,getHash:function(a){return(a=(a?a.location:window.location).href.match(/#(.*)$/))?a[1]:
|
||||
""},getFragment:function(a,b){if(null==a)if(this._hasPushState||b){var a=window.location.pathname,c=window.location.search;c&&(a+=c)}else a=this.getHash();a.indexOf(this.options.root)||(a=a.substr(this.options.root.length));return a.replace(s,"")},start:function(a){if(m.started)throw Error("Backbone.history has already been started");m.started=!0;this.options=f.extend({},{root:"/"},this.options,a);this._wantsHashChange=!1!==this.options.hashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState=
|
||||
!(!this.options.pushState||!window.history||!window.history.pushState);var a=this.getFragment(),b=document.documentMode;if(b=E.exec(navigator.userAgent.toLowerCase())&&(!b||7>=b))this.iframe=i('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(a);this._hasPushState?i(window).bind("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!b?i(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,
|
||||
this.interval));this.fragment=a;a=window.location;b=a.pathname==this.options.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!b)return this.fragment=this.getFragment(null,!0),window.location.replace(this.options.root+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&b&&a.hash&&(this.fragment=this.getHash().replace(s,""),window.history.replaceState({},document.title,a.protocol+"//"+a.host+this.options.root+this.fragment));if(!this.options.silent)return this.loadUrl()},
|
||||
stop:function(){i(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl);clearInterval(this._checkUrlInterval);m.started=!1},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(){var a=this.getFragment();a==this.fragment&&this.iframe&&(a=this.getFragment(this.getHash(this.iframe)));if(a==this.fragment)return!1;this.iframe&&this.navigate(a);this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(a){var b=this.fragment=this.getFragment(a);return f.any(this.handlers,
|
||||
function(a){if(a.route.test(b))return a.callback(b),!0})},navigate:function(a,b){if(!m.started)return!1;if(!b||!0===b)b={trigger:b};var c=(a||"").replace(s,"");this.fragment!=c&&(this._hasPushState?(0!=c.indexOf(this.options.root)&&(c=this.options.root+c),this.fragment=c,window.history[b.replace?"replaceState":"pushState"]({},document.title,c)):this._wantsHashChange?(this.fragment=c,this._updateHash(window.location,c,b.replace),this.iframe&&c!=this.getFragment(this.getHash(this.iframe))&&(b.replace||
|
||||
this.iframe.document.open().close(),this._updateHash(this.iframe.location,c,b.replace))):window.location.assign(this.options.root+a),b.trigger&&this.loadUrl(a))},_updateHash:function(a,b,c){c?a.replace(a.toString().replace(/(javascript:|#).*$/,"")+"#"+b):a.hash=b}});var v=g.View=function(a){this.cid=f.uniqueId("view");this._configure(a||{});this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents()},F=/^(\S+)\s*(.*)$/,w="model,collection,el,id,attributes,className,tagName".split(",");
|
||||
f.extend(v.prototype,k,{tagName:"div",$:function(a){return this.$el.find(a)},initialize:function(){},render:function(){return this},remove:function(){this.$el.remove();return this},make:function(a,b,c){a=document.createElement(a);b&&i(a).attr(b);c&&i(a).html(c);return a},setElement:function(a,b){this.$el&&this.undelegateEvents();this.$el=a instanceof i?a:i(a);this.el=this.$el[0];!1!==b&&this.delegateEvents();return this},delegateEvents:function(a){if(a||(a=n(this,"events"))){this.undelegateEvents();
|
||||
for(var b in a){var c=a[b];f.isFunction(c)||(c=this[a[b]]);if(!c)throw Error('Method "'+a[b]+'" does not exist');var d=b.match(F),e=d[1],d=d[2],c=f.bind(c,this),e=e+(".delegateEvents"+this.cid);""===d?this.$el.bind(e,c):this.$el.delegate(d,e,c)}}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+this.cid)},_configure:function(a){this.options&&(a=f.extend({},this.options,a));for(var b=0,c=w.length;b<c;b++){var d=w[b];a[d]&&(this[d]=a[d])}this.options=a},_ensureElement:function(){if(this.el)this.setElement(this.el,
|
||||
!1);else{var a=n(this,"attributes")||{};this.id&&(a.id=this.id);this.className&&(a["class"]=this.className);this.setElement(this.make(this.tagName,a),!1)}}});o.extend=r.extend=u.extend=v.extend=function(a,b){var c=G(this,a,b);c.extend=this.extend;return c};var H={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};g.sync=function(a,b,c){var d=H[a];c||(c={});var e={type:d,dataType:"json"};c.url||(e.url=n(b,"url")||t());if(!c.data&&b&&("create"==a||"update"==a))e.contentType="application/json",
|
||||
e.data=JSON.stringify(b.toJSON());g.emulateJSON&&(e.contentType="application/x-www-form-urlencoded",e.data=e.data?{model:e.data}:{});if(g.emulateHTTP&&("PUT"===d||"DELETE"===d))g.emulateJSON&&(e.data._method=d),e.type="POST",e.beforeSend=function(a){a.setRequestHeader("X-HTTP-Method-Override",d)};"GET"!==e.type&&!g.emulateJSON&&(e.processData=!1);return i.ajax(f.extend(e,c))};g.wrapError=function(a,b,c){return function(d,e){e=d===b?e:d;a?a(b,e,c):b.trigger("error",b,e,c)}};var x=function(){},G=function(a,
|
||||
b,c){var d;d=b&&b.hasOwnProperty("constructor")?b.constructor:function(){a.apply(this,arguments)};f.extend(d,a);x.prototype=a.prototype;d.prototype=new x;b&&f.extend(d.prototype,b);c&&f.extend(d,c);d.prototype.constructor=d;d.__super__=a.prototype;return d},n=function(a,b){return!a||!a[b]?null:f.isFunction(a[b])?a[b]():a[b]},t=function(){throw Error('A "url" property or function must be specified');}}).call(this);
|
||||
707
wp-includes/js/colorpicker.js
Normal file
707
wp-includes/js/colorpicker.js
Normal file
@@ -0,0 +1,707 @@
|
||||
// ===================================================================
|
||||
// Author: Matt Kruse <matt@mattkruse.com>
|
||||
// WWW: http://www.mattkruse.com/
|
||||
//
|
||||
// NOTICE: You may use this code for any purpose, commercial or
|
||||
// private, without any further permission from the author. You may
|
||||
// remove this notice from your final code if you wish, however it is
|
||||
// appreciated by the author if at least my web site address is kept.
|
||||
//
|
||||
// You may *NOT* re-distribute this code in any way except through its
|
||||
// use. That means, you can include it in your product, or your web
|
||||
// site, or any other form where the code is actually being used. You
|
||||
// may not put the plain javascript up on your site for download or
|
||||
// include it in your javascript libraries for download.
|
||||
// If you wish to share this code with others, please just point them
|
||||
// to the URL instead.
|
||||
// Please DO NOT link directly to my .js files from your site. Copy
|
||||
// the files to your server and use them there. Thank you.
|
||||
// ===================================================================
|
||||
|
||||
|
||||
/* SOURCE FILE: AnchorPosition.js */
|
||||
|
||||
/*
|
||||
AnchorPosition.js
|
||||
Author: Matt Kruse
|
||||
Last modified: 10/11/02
|
||||
|
||||
DESCRIPTION: These functions find the position of an <A> tag in a document,
|
||||
so other elements can be positioned relative to it.
|
||||
|
||||
COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small
|
||||
positioning errors - usually with Window positioning - occur on the
|
||||
Macintosh platform.
|
||||
|
||||
FUNCTIONS:
|
||||
getAnchorPosition(anchorname)
|
||||
Returns an Object() having .x and .y properties of the pixel coordinates
|
||||
of the upper-left corner of the anchor. Position is relative to the PAGE.
|
||||
|
||||
getAnchorWindowPosition(anchorname)
|
||||
Returns an Object() having .x and .y properties of the pixel coordinates
|
||||
of the upper-left corner of the anchor, relative to the WHOLE SCREEN.
|
||||
|
||||
NOTES:
|
||||
|
||||
1) For popping up separate browser windows, use getAnchorWindowPosition.
|
||||
Otherwise, use getAnchorPosition
|
||||
|
||||
2) Your anchor tag MUST contain both NAME and ID attributes which are the
|
||||
same. For example:
|
||||
<A NAME="test" ID="test"> </A>
|
||||
|
||||
3) There must be at least a space between <A> </A> for IE5.5 to see the
|
||||
anchor tag correctly. Do not do <A></A> with no space.
|
||||
*/
|
||||
|
||||
// getAnchorPosition(anchorname)
|
||||
// This function returns an object having .x and .y properties which are the coordinates
|
||||
// of the named anchor, relative to the page.
|
||||
function getAnchorPosition(anchorname) {
|
||||
// This function will return an Object with x and y properties
|
||||
var useWindow=false;
|
||||
var coordinates=new Object();
|
||||
var x=0,y=0;
|
||||
// Browser capability sniffing
|
||||
var use_gebi=false, use_css=false, use_layers=false;
|
||||
if (document.getElementById) { use_gebi=true; }
|
||||
else if (document.all) { use_css=true; }
|
||||
else if (document.layers) { use_layers=true; }
|
||||
// Logic to find position
|
||||
if (use_gebi && document.all) {
|
||||
x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
|
||||
y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
|
||||
}
|
||||
else if (use_gebi) {
|
||||
var o=document.getElementById(anchorname);
|
||||
x=AnchorPosition_getPageOffsetLeft(o);
|
||||
y=AnchorPosition_getPageOffsetTop(o);
|
||||
}
|
||||
else if (use_css) {
|
||||
x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
|
||||
y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
|
||||
}
|
||||
else if (use_layers) {
|
||||
var found=0;
|
||||
for (var i=0; i<document.anchors.length; i++) {
|
||||
if (document.anchors[i].name==anchorname) { found=1; break; }
|
||||
}
|
||||
if (found==0) {
|
||||
coordinates.x=0; coordinates.y=0; return coordinates;
|
||||
}
|
||||
x=document.anchors[i].x;
|
||||
y=document.anchors[i].y;
|
||||
}
|
||||
else {
|
||||
coordinates.x=0; coordinates.y=0; return coordinates;
|
||||
}
|
||||
coordinates.x=x;
|
||||
coordinates.y=y;
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
// getAnchorWindowPosition(anchorname)
|
||||
// This function returns an object having .x and .y properties which are the coordinates
|
||||
// of the named anchor, relative to the window
|
||||
function getAnchorWindowPosition(anchorname) {
|
||||
var coordinates=getAnchorPosition(anchorname);
|
||||
var x=0;
|
||||
var y=0;
|
||||
if (document.getElementById) {
|
||||
if (isNaN(window.screenX)) {
|
||||
x=coordinates.x-document.body.scrollLeft+window.screenLeft;
|
||||
y=coordinates.y-document.body.scrollTop+window.screenTop;
|
||||
}
|
||||
else {
|
||||
x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
|
||||
y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
|
||||
}
|
||||
}
|
||||
else if (document.all) {
|
||||
x=coordinates.x-document.body.scrollLeft+window.screenLeft;
|
||||
y=coordinates.y-document.body.scrollTop+window.screenTop;
|
||||
}
|
||||
else if (document.layers) {
|
||||
x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
|
||||
y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
|
||||
}
|
||||
coordinates.x=x;
|
||||
coordinates.y=y;
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
// Functions for IE to get position of an object
|
||||
function AnchorPosition_getPageOffsetLeft (el) {
|
||||
var ol=el.offsetLeft;
|
||||
while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
|
||||
return ol;
|
||||
}
|
||||
function AnchorPosition_getWindowOffsetLeft (el) {
|
||||
return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
|
||||
}
|
||||
function AnchorPosition_getPageOffsetTop (el) {
|
||||
var ot=el.offsetTop;
|
||||
while((el=el.offsetParent) != null) { ot += el.offsetTop; }
|
||||
return ot;
|
||||
}
|
||||
function AnchorPosition_getWindowOffsetTop (el) {
|
||||
return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
|
||||
}
|
||||
|
||||
/* SOURCE FILE: PopupWindow.js */
|
||||
|
||||
/*
|
||||
PopupWindow.js
|
||||
Author: Matt Kruse
|
||||
Last modified: 02/16/04
|
||||
|
||||
DESCRIPTION: This object allows you to easily and quickly popup a window
|
||||
in a certain place. The window can either be a DIV or a separate browser
|
||||
window.
|
||||
|
||||
COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small
|
||||
positioning errors - usually with Window positioning - occur on the
|
||||
Macintosh platform. Due to bugs in Netscape 4.x, populating the popup
|
||||
window with <STYLE> tags may cause errors.
|
||||
|
||||
USAGE:
|
||||
// Create an object for a WINDOW popup
|
||||
var win = new PopupWindow();
|
||||
|
||||
// Create an object for a DIV window using the DIV named 'mydiv'
|
||||
var win = new PopupWindow('mydiv');
|
||||
|
||||
// Set the window to automatically hide itself when the user clicks
|
||||
// anywhere else on the page except the popup
|
||||
win.autoHide();
|
||||
|
||||
// Show the window relative to the anchor name passed in
|
||||
win.showPopup(anchorname);
|
||||
|
||||
// Hide the popup
|
||||
win.hidePopup();
|
||||
|
||||
// Set the size of the popup window (only applies to WINDOW popups
|
||||
win.setSize(width,height);
|
||||
|
||||
// Populate the contents of the popup window that will be shown. If you
|
||||
// change the contents while it is displayed, you will need to refresh()
|
||||
win.populate(string);
|
||||
|
||||
// set the URL of the window, rather than populating its contents
|
||||
// manually
|
||||
win.setUrl("http://www.site.com/");
|
||||
|
||||
// Refresh the contents of the popup
|
||||
win.refresh();
|
||||
|
||||
// Specify how many pixels to the right of the anchor the popup will appear
|
||||
win.offsetX = 50;
|
||||
|
||||
// Specify how many pixels below the anchor the popup will appear
|
||||
win.offsetY = 100;
|
||||
|
||||
NOTES:
|
||||
1) Requires the functions in AnchorPosition.js
|
||||
|
||||
2) Your anchor tag MUST contain both NAME and ID attributes which are the
|
||||
same. For example:
|
||||
<A NAME="test" ID="test"> </A>
|
||||
|
||||
3) There must be at least a space between <A> </A> for IE5.5 to see the
|
||||
anchor tag correctly. Do not do <A></A> with no space.
|
||||
|
||||
4) When a PopupWindow object is created, a handler for 'onmouseup' is
|
||||
attached to any event handler you may have already defined. Do NOT define
|
||||
an event handler for 'onmouseup' after you define a PopupWindow object or
|
||||
the autoHide() will not work correctly.
|
||||
*/
|
||||
|
||||
// Set the position of the popup window based on the anchor
|
||||
function PopupWindow_getXYPosition(anchorname) {
|
||||
var coordinates;
|
||||
if (this.type == "WINDOW") {
|
||||
coordinates = getAnchorWindowPosition(anchorname);
|
||||
}
|
||||
else {
|
||||
coordinates = getAnchorPosition(anchorname);
|
||||
}
|
||||
this.x = coordinates.x;
|
||||
this.y = coordinates.y;
|
||||
}
|
||||
// Set width/height of DIV/popup window
|
||||
function PopupWindow_setSize(width,height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
// Fill the window with contents
|
||||
function PopupWindow_populate(contents) {
|
||||
this.contents = contents;
|
||||
this.populated = false;
|
||||
}
|
||||
// Set the URL to go to
|
||||
function PopupWindow_setUrl(url) {
|
||||
this.url = url;
|
||||
}
|
||||
// Set the window popup properties
|
||||
function PopupWindow_setWindowProperties(props) {
|
||||
this.windowProperties = props;
|
||||
}
|
||||
// Refresh the displayed contents of the popup
|
||||
function PopupWindow_refresh() {
|
||||
if (this.divName != null) {
|
||||
// refresh the DIV object
|
||||
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 d = document.layers[this.divName];
|
||||
d.document.open();
|
||||
d.document.writeln(this.contents);
|
||||
d.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Position and show the popup, relative to an anchor object
|
||||
function PopupWindow_showPopup(anchorname) {
|
||||
this.getXYPosition(anchorname);
|
||||
this.x += this.offsetX;
|
||||
this.y += this.offsetY;
|
||||
if (!this.populated && (this.contents != "")) {
|
||||
this.populated = true;
|
||||
this.refresh();
|
||||
}
|
||||
if (this.divName != null) {
|
||||
// Show the DIV object
|
||||
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 the popup window will go off-screen, move it so it doesn't
|
||||
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 avoidAboutBlank = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) || navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled );
|
||||
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+"");
|
||||
}
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
// Hide the popup
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Pass an event and return whether or not it was the popup DIV that was clicked
|
||||
function PopupWindow_isClicked(e) {
|
||||
if (this.divName != null) {
|
||||
if (this.use_layers) {
|
||||
var clickX = e.pageX;
|
||||
var clickY = e.pageY;
|
||||
var t = document.layers[this.divName];
|
||||
if ((clickX > t.left) && (clickX < t.left+t.clip.width) && (clickY > t.top) && (clickY < t.top+t.clip.height)) {
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
}
|
||||
else if (document.all) { // Need to hard-code this to trap IE for error-handling
|
||||
var t = window.event.srcElement;
|
||||
while (t.parentElement != null) {
|
||||
if (t.id==this.divName) {
|
||||
return true;
|
||||
}
|
||||
t = t.parentElement;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (this.use_gebi && e) {
|
||||
var t = e.originalTarget;
|
||||
while (t.parentNode != null) {
|
||||
if (t.id==this.divName) {
|
||||
return true;
|
||||
}
|
||||
t = t.parentNode;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check an onMouseDown event to see if we should hide
|
||||
function PopupWindow_hideIfNotClicked(e) {
|
||||
if (this.autoHideEnabled && !this.isClicked(e)) {
|
||||
this.hidePopup();
|
||||
}
|
||||
}
|
||||
// Call this to make the DIV disable automatically when mouse is clicked outside it
|
||||
function PopupWindow_autoHide() {
|
||||
this.autoHideEnabled = true;
|
||||
}
|
||||
// This global function checks all PopupWindow objects onmouseup to see if they should be hidden
|
||||
function PopupWindow_hidePopupWindows(e) {
|
||||
for (var i=0; i<popupWindowObjects.length; i++) {
|
||||
if (popupWindowObjects[i] != null) {
|
||||
var p = popupWindowObjects[i];
|
||||
p.hideIfNotClicked(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Run this immediately to attach the event listener
|
||||
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;
|
||||
}
|
||||
}
|
||||
// CONSTRUCTOR for the PopupWindow object
|
||||
// Pass it a DIV name to use a DHTML popup, otherwise will default to window popup
|
||||
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;
|
||||
// Method mappings
|
||||
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;
|
||||
}
|
||||
|
||||
/* SOURCE FILE: ColorPicker2.js */
|
||||
|
||||
/*
|
||||
Last modified: 02/24/2003
|
||||
|
||||
DESCRIPTION: This widget is used to select a color, in hexadecimal #RRGGBB
|
||||
form. It uses a color "swatch" to display the standard 216-color web-safe
|
||||
palette. The user can then click on a color to select it.
|
||||
|
||||
COMPATABILITY: See notes in AnchorPosition.js and PopupWindow.js.
|
||||
Only the latest DHTML-capable browsers will show the color and hex values
|
||||
at the bottom as your mouse goes over them.
|
||||
|
||||
USAGE:
|
||||
// Create a new ColorPicker object using DHTML popup
|
||||
var cp = new ColorPicker();
|
||||
|
||||
// Create a new ColorPicker object using Window Popup
|
||||
var cp = new ColorPicker('window');
|
||||
|
||||
// Add a link in your page to trigger the popup. For example:
|
||||
<A HREF="#" onClick="cp.show('pick');return false;" NAME="pick" ID="pick">Pick</A>
|
||||
|
||||
// Or use the built-in "select" function to do the dirty work for you:
|
||||
<A HREF="#" onClick="cp.select(document.forms[0].color,'pick');return false;" NAME="pick" ID="pick">Pick</A>
|
||||
|
||||
// If using DHTML popup, write out the required DIV tag near the bottom
|
||||
// of your page.
|
||||
<SCRIPT LANGUAGE="JavaScript">cp.writeDiv()</SCRIPT>
|
||||
|
||||
// Write the 'pickColor' function that will be called when the user clicks
|
||||
// a color and do something with the value. This is only required if you
|
||||
// want to do something other than simply populate a form field, which is
|
||||
// what the 'select' function will give you.
|
||||
function pickColor(color) {
|
||||
field.value = color;
|
||||
}
|
||||
|
||||
NOTES:
|
||||
1) Requires the functions in AnchorPosition.js and PopupWindow.js
|
||||
|
||||
2) Your anchor tag MUST contain both NAME and ID attributes which are the
|
||||
same. For example:
|
||||
<A NAME="test" ID="test"> </A>
|
||||
|
||||
3) There must be at least a space between <A> </A> for IE5.5 to see the
|
||||
anchor tag correctly. Do not do <A></A> with no space.
|
||||
|
||||
4) When a ColorPicker object is created, a handler for 'onmouseup' is
|
||||
attached to any event handler you may have already defined. Do NOT define
|
||||
an event handler for 'onmouseup' after you define a ColorPicker object or
|
||||
the color picker will not hide itself correctly.
|
||||
*/
|
||||
ColorPicker_targetInput = null;
|
||||
function ColorPicker_writeDiv() {
|
||||
document.writeln("<DIV ID=\"colorPickerDiv\" STYLE=\"position:absolute;visibility:hidden;\"> </DIV>");
|
||||
}
|
||||
|
||||
function ColorPicker_show(anchorname) {
|
||||
this.showPopup(anchorname);
|
||||
}
|
||||
|
||||
function ColorPicker_pickColor(color,obj) {
|
||||
obj.hidePopup();
|
||||
pickColor(color);
|
||||
}
|
||||
|
||||
// A Default "pickColor" function to accept the color passed back from popup.
|
||||
// User can over-ride this with their own function.
|
||||
function pickColor(color) {
|
||||
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 = color;
|
||||
}
|
||||
|
||||
// This function is the easiest way to popup the window, select a color, and
|
||||
// have the value populate a form field, which is what most people want to do.
|
||||
function ColorPicker_select(inputobj,linkname) {
|
||||
if (inputobj.type!="text" && inputobj.type!="hidden" && inputobj.type!="textarea") {
|
||||
alert("colorpicker.select: Input object passed is not a valid form input object");
|
||||
window.ColorPicker_targetInput=null;
|
||||
return;
|
||||
}
|
||||
window.ColorPicker_targetInput = inputobj;
|
||||
this.show(linkname);
|
||||
}
|
||||
|
||||
// This function runs when you move your mouse over a color block, if you have a newer browser
|
||||
function ColorPicker_highlightColor(c) {
|
||||
var thedoc = (arguments.length>1)?arguments[1]:window.document;
|
||||
var d = thedoc.getElementById("colorPickerSelectedColor");
|
||||
d.style.backgroundColor = c;
|
||||
d = thedoc.getElementById("colorPickerSelectedColorValue");
|
||||
d.innerHTML = c;
|
||||
}
|
||||
|
||||
function ColorPicker() {
|
||||
var windowMode = false;
|
||||
// Create a new PopupWindow object
|
||||
if (arguments.length==0) {
|
||||
var divname = "colorPickerDiv";
|
||||
}
|
||||
else if (arguments[0] == "window") {
|
||||
var divname = '';
|
||||
windowMode = true;
|
||||
}
|
||||
else {
|
||||
var divname = arguments[0];
|
||||
}
|
||||
|
||||
if (divname != "") {
|
||||
var cp = new PopupWindow(divname);
|
||||
}
|
||||
else {
|
||||
var cp = new PopupWindow();
|
||||
cp.setSize(225,250);
|
||||
}
|
||||
|
||||
// Object variables
|
||||
cp.currentValue = "#FFFFFF";
|
||||
|
||||
// Method Mappings
|
||||
cp.writeDiv = ColorPicker_writeDiv;
|
||||
cp.highlightColor = ColorPicker_highlightColor;
|
||||
cp.show = ColorPicker_show;
|
||||
cp.select = ColorPicker_select;
|
||||
|
||||
// Code to populate color picker window
|
||||
var colors = 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 total = colors.length;
|
||||
var width = 72;
|
||||
var cp_contents = "";
|
||||
var windowRef = (windowMode)?"window.opener.":"";
|
||||
if (windowMode) {
|
||||
cp_contents += "<html><head><title>Select Color</title></head>";
|
||||
cp_contents += "<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0><span style='text-align: center;'>";
|
||||
}
|
||||
cp_contents += "<table style='border: none;' cellspacing=0 cellpadding=0>";
|
||||
var use_highlight = (document.getElementById || document.all)?true:false;
|
||||
for (var i=0; i<total; i++) {
|
||||
if ((i % width) == 0) { cp_contents += "<tr>"; }
|
||||
if (use_highlight) { var mo = 'onMouseOver="'+windowRef+'ColorPicker_highlightColor(\''+colors[i]+'\',window.document)"'; }
|
||||
else { mo = ""; }
|
||||
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>';
|
||||
if ( ((i+1)>=total) || (((i+1) % width) == 0)) {
|
||||
cp_contents += "</tr>";
|
||||
}
|
||||
}
|
||||
// If the browser supports dynamically changing TD cells, add the fancy stuff
|
||||
if (document.getElementById) {
|
||||
var width1 = Math.floor(width/2);
|
||||
var width2 = width = width1;
|
||||
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>";
|
||||
}
|
||||
cp_contents += "</table>";
|
||||
if (windowMode) {
|
||||
cp_contents += "</span></body></html>";
|
||||
}
|
||||
// end populate code
|
||||
|
||||
// Write the contents to the popup object
|
||||
cp.populate(cp_contents+"\n");
|
||||
// Move the table down a bit so you can see it
|
||||
cp.offsetY = 25;
|
||||
cp.autoHide();
|
||||
return cp;
|
||||
}
|
||||
1
wp-includes/js/colorpicker.min.js
vendored
Normal file
1
wp-includes/js/colorpicker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
48
wp-includes/js/comment-reply.js
Normal file
48
wp-includes/js/comment-reply.js
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
addComment = {
|
||||
moveForm : function(commId, parentId, respondId, postId) {
|
||||
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');
|
||||
|
||||
if ( ! comm || ! respond || ! cancel || ! parent )
|
||||
return;
|
||||
|
||||
t.respondId = respondId;
|
||||
postId = postId || false;
|
||||
|
||||
if ( ! t.I('wp-temp-form-div') ) {
|
||||
div = document.createElement('div');
|
||||
div.id = 'wp-temp-form-div';
|
||||
div.style.display = 'none';
|
||||
respond.parentNode.insertBefore(div, respond);
|
||||
}
|
||||
|
||||
comm.parentNode.insertBefore(respond, comm.nextSibling);
|
||||
if ( post && postId )
|
||||
post.value = postId;
|
||||
parent.value = parentId;
|
||||
cancel.style.display = '';
|
||||
|
||||
cancel.onclick = function() {
|
||||
var t = addComment, temp = t.I('wp-temp-form-div'), respond = t.I(t.respondId);
|
||||
|
||||
if ( ! temp || ! respond )
|
||||
return;
|
||||
|
||||
t.I('comment_parent').value = '0';
|
||||
temp.parentNode.insertBefore(respond, temp);
|
||||
temp.parentNode.removeChild(temp);
|
||||
this.style.display = 'none';
|
||||
this.onclick = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
try { t.I('comment').focus(); }
|
||||
catch(e) {}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
I : function(e) {
|
||||
return document.getElementById(e);
|
||||
}
|
||||
}
|
||||
1
wp-includes/js/comment-reply.min.js
vendored
Normal file
1
wp-includes/js/comment-reply.min.js
vendored
Normal file
@@ -0,0 +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)}};
|
||||
165
wp-includes/js/crop/cropper.css
Normal file
165
wp-includes/js/crop/cropper.css
Normal file
@@ -0,0 +1,165 @@
|
||||
.imgCrop_wrap {
|
||||
/* width: 500px; @done_in_js */
|
||||
/* height: 375px; @done_in_js */
|
||||
position: relative;
|
||||
cursor: crosshair;
|
||||
}
|
||||
|
||||
/* an extra classname is applied for Opera < 9.0 to fix it's lack of opacity support */
|
||||
.imgCrop_wrap.opera8 .imgCrop_overlay,
|
||||
.imgCrop_wrap.opera8 .imgCrop_clickArea {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/* fix for IE displaying all boxes at line-height by default, although they are still 1 pixel high until we combine them with the pointless span */
|
||||
.imgCrop_wrap,
|
||||
.imgCrop_wrap * {
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.imgCrop_overlay {
|
||||
background-color: #000;
|
||||
opacity: 0.5;
|
||||
filter:alpha(opacity=50);
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.imgCrop_selArea {
|
||||
position: absolute;
|
||||
/* @done_in_js
|
||||
top: 20px;
|
||||
left: 20px;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: transparent url(castle.jpg) no-repeat -210px -110px;
|
||||
*/
|
||||
cursor: move;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/* clickArea is all a fix for IE 5.5 & 6 to allow the user to click on the given area */
|
||||
.imgCrop_clickArea {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #FFF;
|
||||
opacity: 0.01;
|
||||
filter:alpha(opacity=01);
|
||||
}
|
||||
|
||||
.imgCrop_marqueeHoriz {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background: transparent url(marqueeHoriz.gif) repeat-x 0 0;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.imgCrop_marqueeVert {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 1px;
|
||||
background: transparent url(marqueeVert.gif) repeat-y 0 0;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.imgCrop_marqueeNorth { top: 0; left: 0; }
|
||||
.imgCrop_marqueeEast { top: 0; right: 0; }
|
||||
.imgCrop_marqueeSouth { bottom: 0px; left: 0; }
|
||||
.imgCrop_marqueeWest { top: 0; left: 0; }
|
||||
|
||||
|
||||
.imgCrop_handle {
|
||||
position: absolute;
|
||||
border: 1px solid #333;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
background: #FFF;
|
||||
opacity: 0.5;
|
||||
filter:alpha(opacity=50);
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
/* fix IE 5 box model */
|
||||
* html .imgCrop_handle {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
wid\th: 6px;
|
||||
hei\ght: 6px;
|
||||
}
|
||||
|
||||
.imgCrop_handleN {
|
||||
top: -3px;
|
||||
left: 0;
|
||||
/* margin-left: 49%; @done_in_js */
|
||||
cursor: n-resize;
|
||||
}
|
||||
|
||||
.imgCrop_handleNE {
|
||||
top: -3px;
|
||||
right: -3px;
|
||||
cursor: ne-resize;
|
||||
}
|
||||
|
||||
.imgCrop_handleE {
|
||||
top: 0;
|
||||
right: -3px;
|
||||
/* margin-top: 49%; @done_in_js */
|
||||
cursor: e-resize;
|
||||
}
|
||||
|
||||
.imgCrop_handleSE {
|
||||
right: -3px;
|
||||
bottom: -3px;
|
||||
cursor: se-resize;
|
||||
}
|
||||
|
||||
.imgCrop_handleS {
|
||||
right: 0;
|
||||
bottom: -3px;
|
||||
/* margin-right: 49%; @done_in_js */
|
||||
cursor: s-resize;
|
||||
}
|
||||
|
||||
.imgCrop_handleSW {
|
||||
left: -3px;
|
||||
bottom: -3px;
|
||||
cursor: sw-resize;
|
||||
}
|
||||
|
||||
.imgCrop_handleW {
|
||||
top: 0;
|
||||
left: -3px;
|
||||
/* margin-top: 49%; @done_in_js */
|
||||
cursor: e-resize;
|
||||
}
|
||||
|
||||
.imgCrop_handleNW {
|
||||
top: -3px;
|
||||
left: -3px;
|
||||
cursor: nw-resize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an area to click & drag around on as the default browser behaviour is to let you drag the image
|
||||
*/
|
||||
.imgCrop_dragArea {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 200;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.imgCrop_previewWrap {
|
||||
/* width: 200px; @done_in_js */
|
||||
/* height: 200px; @done_in_js */
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.imgCrop_previewWrap img {
|
||||
position: absolute;
|
||||
}
|
||||
516
wp-includes/js/crop/cropper.js
Normal file
516
wp-includes/js/crop/cropper.js
Normal file
@@ -0,0 +1,516 @@
|
||||
/**
|
||||
* Copyright (c) 2006, David Spurr (http://www.defusion.org.uk/)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the David Spurr nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://www.opensource.org/licenses/bsd-license.php
|
||||
*
|
||||
* See scriptaculous.js for full scriptaculous licence
|
||||
*/
|
||||
|
||||
var CropDraggable=Class.create();
|
||||
Object.extend(Object.extend(CropDraggable.prototype,Draggable.prototype),{initialize:function(_1){
|
||||
this.options=Object.extend({drawMethod:function(){
|
||||
}},arguments[1]||{});
|
||||
this.element=$(_1);
|
||||
this.handle=this.element;
|
||||
this.delta=this.currentDelta();
|
||||
this.dragging=false;
|
||||
this.eventMouseDown=this.initDrag.bindAsEventListener(this);
|
||||
Event.observe(this.handle,"mousedown",this.eventMouseDown);
|
||||
Draggables.register(this);
|
||||
},draw:function(_2){
|
||||
var _3=Position.cumulativeOffset(this.element);
|
||||
var d=this.currentDelta();
|
||||
_3[0]-=d[0];
|
||||
_3[1]-=d[1];
|
||||
var p=[0,1].map(function(i){
|
||||
return (_2[i]-_3[i]-this.offset[i]);
|
||||
}.bind(this));
|
||||
this.options.drawMethod(p);
|
||||
}});
|
||||
var Cropper={};
|
||||
Cropper.Img=Class.create();
|
||||
Cropper.Img.prototype={initialize:function(_7,_8){
|
||||
this.options=Object.extend({ratioDim:{x:0,y:0},minWidth:0,minHeight:0,displayOnInit:false,onEndCrop:Prototype.emptyFunction,captureKeys:true},_8||{});
|
||||
if(this.options.minWidth>0&&this.options.minHeight>0){
|
||||
this.options.ratioDim.x=this.options.minWidth;
|
||||
this.options.ratioDim.y=this.options.minHeight;
|
||||
}
|
||||
this.img=$(_7);
|
||||
this.clickCoords={x:0,y:0};
|
||||
this.dragging=false;
|
||||
this.resizing=false;
|
||||
this.isWebKit=/Konqueror|Safari|KHTML/.test(navigator.userAgent);
|
||||
this.isIE=/MSIE/.test(navigator.userAgent);
|
||||
this.isOpera8=/Opera\s[1-8]/.test(navigator.userAgent);
|
||||
this.ratioX=0;
|
||||
this.ratioY=0;
|
||||
this.attached=false;
|
||||
$A(document.getElementsByTagName("script")).each(function(s){
|
||||
if(s.src.match(/cropper\.js/)){
|
||||
var _a=s.src.replace(/cropper\.js(.*)?/,"");
|
||||
var _b=document.createElement("link");
|
||||
_b.rel="stylesheet";
|
||||
_b.type="text/css";
|
||||
_b.href=_a+"cropper.css";
|
||||
_b.media="screen";
|
||||
document.getElementsByTagName("head")[0].appendChild(_b);
|
||||
}
|
||||
});
|
||||
if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0){
|
||||
var _c=this.getGCD(this.options.ratioDim.x,this.options.ratioDim.y);
|
||||
this.ratioX=this.options.ratioDim.x/_c;
|
||||
this.ratioY=this.options.ratioDim.y/_c;
|
||||
}
|
||||
this.subInitialize();
|
||||
if(this.img.complete||this.isWebKit){
|
||||
this.onLoad();
|
||||
}else{
|
||||
Event.observe(this.img,"load",this.onLoad.bindAsEventListener(this));
|
||||
}
|
||||
},getGCD:function(a,b){return 1;
|
||||
if(b==0){
|
||||
return a;
|
||||
}
|
||||
return this.getGCD(b,a%b);
|
||||
},onLoad:function(){
|
||||
var _f="imgCrop_";
|
||||
var _10=this.img.parentNode;
|
||||
var _11="";
|
||||
if(this.isOpera8){
|
||||
_11=" opera8";
|
||||
}
|
||||
this.imgWrap=Builder.node("div",{"class":_f+"wrap"+_11});
|
||||
if(this.isIE){
|
||||
this.north=Builder.node("div",{"class":_f+"overlay "+_f+"north"},[Builder.node("span")]);
|
||||
this.east=Builder.node("div",{"class":_f+"overlay "+_f+"east"},[Builder.node("span")]);
|
||||
this.south=Builder.node("div",{"class":_f+"overlay "+_f+"south"},[Builder.node("span")]);
|
||||
this.west=Builder.node("div",{"class":_f+"overlay "+_f+"west"},[Builder.node("span")]);
|
||||
var _12=[this.north,this.east,this.south,this.west];
|
||||
}else{
|
||||
this.overlay=Builder.node("div",{"class":_f+"overlay"});
|
||||
var _12=[this.overlay];
|
||||
}
|
||||
this.dragArea=Builder.node("div",{"class":_f+"dragArea"},_12);
|
||||
this.handleN=Builder.node("div",{"class":_f+"handle "+_f+"handleN"});
|
||||
this.handleNE=Builder.node("div",{"class":_f+"handle "+_f+"handleNE"});
|
||||
this.handleE=Builder.node("div",{"class":_f+"handle "+_f+"handleE"});
|
||||
this.handleSE=Builder.node("div",{"class":_f+"handle "+_f+"handleSE"});
|
||||
this.handleS=Builder.node("div",{"class":_f+"handle "+_f+"handleS"});
|
||||
this.handleSW=Builder.node("div",{"class":_f+"handle "+_f+"handleSW"});
|
||||
this.handleW=Builder.node("div",{"class":_f+"handle "+_f+"handleW"});
|
||||
this.handleNW=Builder.node("div",{"class":_f+"handle "+_f+"handleNW"});
|
||||
this.selArea=Builder.node("div",{"class":_f+"selArea"},[Builder.node("div",{"class":_f+"marqueeHoriz "+_f+"marqueeNorth"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeVert "+_f+"marqueeEast"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeHoriz "+_f+"marqueeSouth"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeVert "+_f+"marqueeWest"},[Builder.node("span")]),this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW,Builder.node("div",{"class":_f+"clickArea"})]);
|
||||
Element.setStyle($(this.selArea),{backgroundColor:"transparent",backgroundRepeat:"no-repeat",backgroundPosition:"0 0"});
|
||||
this.imgWrap.appendChild(this.img);
|
||||
this.imgWrap.appendChild(this.dragArea);
|
||||
this.dragArea.appendChild(this.selArea);
|
||||
this.dragArea.appendChild(Builder.node("div",{"class":_f+"clickArea"}));
|
||||
_10.appendChild(this.imgWrap);
|
||||
Event.observe(this.dragArea,"mousedown",this.startDrag.bindAsEventListener(this));
|
||||
Event.observe(document,"mousemove",this.onDrag.bindAsEventListener(this));
|
||||
Event.observe(document,"mouseup",this.endCrop.bindAsEventListener(this));
|
||||
var _13=[this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW];
|
||||
for(var i=0;i<_13.length;i++){
|
||||
Event.observe(_13[i],"mousedown",this.startResize.bindAsEventListener(this));
|
||||
}
|
||||
if(this.options.captureKeys){
|
||||
Event.observe(document,"keydown",this.handleKeys.bindAsEventListener(this));
|
||||
}
|
||||
new CropDraggable(this.selArea,{drawMethod:this.moveArea.bindAsEventListener(this)});
|
||||
this.setParams();
|
||||
},setParams:function(){
|
||||
this.imgW=this.img.width;
|
||||
this.imgH=this.img.height;
|
||||
if(!this.isIE){
|
||||
Element.setStyle($(this.overlay),{width:this.imgW+"px",height:this.imgH+"px"});
|
||||
Element.hide($(this.overlay));
|
||||
Element.setStyle($(this.selArea),{backgroundImage:"url("+this.img.src+")"});
|
||||
}else{
|
||||
Element.setStyle($(this.north),{height:0});
|
||||
Element.setStyle($(this.east),{width:0,height:0});
|
||||
Element.setStyle($(this.south),{height:0});
|
||||
Element.setStyle($(this.west),{width:0,height:0});
|
||||
}
|
||||
Element.setStyle($(this.imgWrap),{"width":this.imgW+"px","height":this.imgH+"px"});
|
||||
Element.hide($(this.selArea));
|
||||
var _15=Position.positionedOffset(this.imgWrap);
|
||||
this.wrapOffsets={"top":_15[1],"left":_15[0]};
|
||||
var _16={x1:0,y1:0,x2:0,y2:0};
|
||||
this.setAreaCoords(_16);
|
||||
if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0&&this.options.displayOnInit){
|
||||
_16.x1=Math.ceil((this.imgW-this.options.ratioDim.x)/2);
|
||||
_16.y1=Math.ceil((this.imgH-this.options.ratioDim.y)/2);
|
||||
_16.x2=_16.x1+this.options.ratioDim.x;
|
||||
_16.y2=_16.y1+this.options.ratioDim.y;
|
||||
Element.show(this.selArea);
|
||||
this.drawArea();
|
||||
this.endCrop();
|
||||
}
|
||||
this.attached=true;
|
||||
},remove:function(){
|
||||
this.attached=false;
|
||||
this.imgWrap.parentNode.insertBefore(this.img,this.imgWrap);
|
||||
this.imgWrap.parentNode.removeChild(this.imgWrap);
|
||||
Event.stopObserving(this.dragArea,"mousedown",this.startDrag.bindAsEventListener(this));
|
||||
Event.stopObserving(document,"mousemove",this.onDrag.bindAsEventListener(this));
|
||||
Event.stopObserving(document,"mouseup",this.endCrop.bindAsEventListener(this));
|
||||
var _17=[this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW];
|
||||
for(var i=0;i<_17.length;i++){
|
||||
Event.stopObserving(_17[i],"mousedown",this.startResize.bindAsEventListener(this));
|
||||
}
|
||||
if(this.options.captureKeys){
|
||||
Event.stopObserving(document,"keydown",this.handleKeys.bindAsEventListener(this));
|
||||
}
|
||||
},reset:function(){
|
||||
if(!this.attached){
|
||||
this.onLoad();
|
||||
}else{
|
||||
this.setParams();
|
||||
}
|
||||
this.endCrop();
|
||||
},handleKeys:function(e){
|
||||
var dir={x:0,y:0};
|
||||
if(!this.dragging){
|
||||
switch(e.keyCode){
|
||||
case (37):
|
||||
dir.x=-1;
|
||||
break;
|
||||
case (38):
|
||||
dir.y=-1;
|
||||
break;
|
||||
case (39):
|
||||
dir.x=1;
|
||||
break;
|
||||
case (40):
|
||||
dir.y=1;
|
||||
break;
|
||||
}
|
||||
if(dir.x!=0||dir.y!=0){
|
||||
if(e.shiftKey){
|
||||
dir.x*=10;
|
||||
dir.y*=10;
|
||||
}
|
||||
this.moveArea([this.areaCoords.x1+dir.x,this.areaCoords.y1+dir.y]);
|
||||
Event.stop(e);
|
||||
}
|
||||
}
|
||||
},calcW:function(){
|
||||
return (this.areaCoords.x2-this.areaCoords.x1);
|
||||
},calcH:function(){
|
||||
return (this.areaCoords.y2-this.areaCoords.y1);
|
||||
},moveArea:function(_1b){
|
||||
this.setAreaCoords({x1:_1b[0],y1:_1b[1],x2:_1b[0]+this.calcW(),y2:_1b[1]+this.calcH()},true);
|
||||
this.drawArea();
|
||||
},cloneCoords:function(_1c){
|
||||
return {x1:_1c.x1,y1:_1c.y1,x2:_1c.x2,y2:_1c.y2};
|
||||
},setAreaCoords:function(_1d,_1e,_1f,_20,_21){
|
||||
var _22=typeof _1e!="undefined"?_1e:false;
|
||||
var _23=typeof _1f!="undefined"?_1f:false;
|
||||
if(_1e){
|
||||
var _24=_1d.x2-_1d.x1;
|
||||
var _25=_1d.y2-_1d.y1;
|
||||
if(_1d.x1<0){
|
||||
_1d.x1=0;
|
||||
_1d.x2=_24;
|
||||
}
|
||||
if(_1d.y1<0){
|
||||
_1d.y1=0;
|
||||
_1d.y2=_25;
|
||||
}
|
||||
if(_1d.x2>this.imgW){
|
||||
_1d.x2=this.imgW;
|
||||
_1d.x1=this.imgW-_24;
|
||||
}
|
||||
if(_1d.y2>this.imgH){
|
||||
_1d.y2=this.imgH;
|
||||
_1d.y1=this.imgH-_25;
|
||||
}
|
||||
}else{
|
||||
if(_1d.x1<0){
|
||||
_1d.x1=0;
|
||||
}
|
||||
if(_1d.y1<0){
|
||||
_1d.y1=0;
|
||||
}
|
||||
if(_1d.x2>this.imgW){
|
||||
_1d.x2=this.imgW;
|
||||
}
|
||||
if(_1d.y2>this.imgH){
|
||||
_1d.y2=this.imgH;
|
||||
}
|
||||
if(typeof (_20)!="undefined"){
|
||||
if(this.ratioX>0){
|
||||
this.applyRatio(_1d,{x:this.ratioX,y:this.ratioY},_20,_21);
|
||||
}else{
|
||||
if(_23){
|
||||
this.applyRatio(_1d,{x:1,y:1},_20,_21);
|
||||
}
|
||||
}
|
||||
var _26={a1:_1d.x1,a2:_1d.x2};
|
||||
var _27={a1:_1d.y1,a2:_1d.y2};
|
||||
var _28=this.options.minWidth;
|
||||
var _29=this.options.minHeight;
|
||||
if((_28==0||_29==0)&&_23){
|
||||
if(_28>0){
|
||||
_29=_28;
|
||||
}else{
|
||||
if(_29>0){
|
||||
_28=_29;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.applyMinDimension(_26,_28,_20.x,{min:0,max:this.imgW});
|
||||
this.applyMinDimension(_27,_29,_20.y,{min:0,max:this.imgH});
|
||||
_1d={x1:_26.a1,y1:_27.a1,x2:_26.a2,y2:_27.a2};
|
||||
}
|
||||
}
|
||||
this.areaCoords=_1d;
|
||||
},applyMinDimension:function(_2a,_2b,_2c,_2d){
|
||||
if((_2a.a2-_2a.a1)<_2b){
|
||||
if(_2c==1){
|
||||
_2a.a2=_2a.a1+_2b;
|
||||
}else{
|
||||
_2a.a1=_2a.a2-_2b;
|
||||
}
|
||||
if(_2a.a1<_2d.min){
|
||||
_2a.a1=_2d.min;
|
||||
_2a.a2=_2b;
|
||||
}else{
|
||||
if(_2a.a2>_2d.max){
|
||||
_2a.a1=_2d.max-_2b;
|
||||
_2a.a2=_2d.max;
|
||||
}
|
||||
}
|
||||
}
|
||||
},applyRatio:function(_2e,_2f,_30,_31){
|
||||
var _32;
|
||||
if(_31=="N"||_31=="S"){
|
||||
_32=this.applyRatioToAxis({a1:_2e.y1,b1:_2e.x1,a2:_2e.y2,b2:_2e.x2},{a:_2f.y,b:_2f.x},{a:_30.y,b:_30.x},{min:0,max:this.imgW});
|
||||
_2e.x1=_32.b1;
|
||||
_2e.y1=_32.a1;
|
||||
_2e.x2=_32.b2;
|
||||
_2e.y2=_32.a2;
|
||||
}else{
|
||||
_32=this.applyRatioToAxis({a1:_2e.x1,b1:_2e.y1,a2:_2e.x2,b2:_2e.y2},{a:_2f.x,b:_2f.y},{a:_30.x,b:_30.y},{min:0,max:this.imgH});
|
||||
_2e.x1=_32.a1;
|
||||
_2e.y1=_32.b1;
|
||||
_2e.x2=_32.a2;
|
||||
_2e.y2=_32.b2;
|
||||
}
|
||||
},applyRatioToAxis:function(_33,_34,_35,_36){
|
||||
var _37=Object.extend(_33,{});
|
||||
var _38=_37.a2-_37.a1;
|
||||
var _3a=Math.floor(_38*_34.b/_34.a);
|
||||
var _3b;
|
||||
var _3c;
|
||||
var _3d=null;
|
||||
if(_35.b==1){
|
||||
_3b=_37.b1+_3a;
|
||||
if(_3b>_36.max){
|
||||
_3b=_36.max;
|
||||
_3d=_3b-_37.b1;
|
||||
}
|
||||
_37.b2=_3b;
|
||||
}else{
|
||||
_3b=_37.b2-_3a;
|
||||
if(_3b<_36.min){
|
||||
_3b=_36.min;
|
||||
_3d=_3b+_37.b2;
|
||||
}
|
||||
_37.b1=_3b;
|
||||
}
|
||||
if(_3d!=null){
|
||||
_3c=Math.floor(_3d*_34.a/_34.b);
|
||||
if(_35.a==1){
|
||||
_37.a2=_37.a1+_3c;
|
||||
}else{
|
||||
_37.a1=_37.a1=_37.a2-_3c;
|
||||
}
|
||||
}
|
||||
return _37;
|
||||
},drawArea:function(){
|
||||
if(!this.isIE){
|
||||
Element.show($(this.overlay));
|
||||
}
|
||||
var _3e=this.calcW();
|
||||
var _3f=this.calcH();
|
||||
var _40=this.areaCoords.x2;
|
||||
var _41=this.areaCoords.y2;
|
||||
var _42=this.selArea.style;
|
||||
_42.left=this.areaCoords.x1+"px";
|
||||
_42.top=this.areaCoords.y1+"px";
|
||||
_42.width=_3e+"px";
|
||||
_42.height=_3f+"px";
|
||||
var _43=Math.ceil((_3e-6)/2)+"px";
|
||||
var _44=Math.ceil((_3f-6)/2)+"px";
|
||||
this.handleN.style.left=_43;
|
||||
this.handleE.style.top=_44;
|
||||
this.handleS.style.left=_43;
|
||||
this.handleW.style.top=_44;
|
||||
if(this.isIE){
|
||||
this.north.style.height=this.areaCoords.y1+"px";
|
||||
var _45=this.east.style;
|
||||
_45.top=this.areaCoords.y1+"px";
|
||||
_45.height=_3f+"px";
|
||||
_45.left=_40+"px";
|
||||
_45.width=(this.img.width-_40)+"px";
|
||||
var _46=this.south.style;
|
||||
_46.top=_41+"px";
|
||||
_46.height=(this.img.height-_41)+"px";
|
||||
var _47=this.west.style;
|
||||
_47.top=this.areaCoords.y1+"px";
|
||||
_47.height=_3f+"px";
|
||||
_47.width=this.areaCoords.x1+"px";
|
||||
}else{
|
||||
_42.backgroundPosition="-"+this.areaCoords.x1+"px "+"-"+this.areaCoords.y1+"px";
|
||||
}
|
||||
this.subDrawArea();
|
||||
this.forceReRender();
|
||||
},forceReRender:function(){
|
||||
if(this.isIE||this.isWebKit){
|
||||
var n=document.createTextNode(" ");
|
||||
var d,el,fixEL,i;
|
||||
if(this.isIE){
|
||||
fixEl=this.selArea;
|
||||
}else{
|
||||
if(this.isWebKit){
|
||||
fixEl=document.getElementsByClassName("imgCrop_marqueeSouth",this.imgWrap)[0];
|
||||
d=Builder.node("div","");
|
||||
d.style.visibility="hidden";
|
||||
var _4a=["SE","S","SW"];
|
||||
for(i=0;i<_4a.length;i++){
|
||||
el=document.getElementsByClassName("imgCrop_handle"+_4a[i],this.selArea)[0];
|
||||
if(el.childNodes.length){
|
||||
el.removeChild(el.childNodes[0]);
|
||||
}
|
||||
el.appendChild(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
fixEl.appendChild(n);
|
||||
fixEl.removeChild(n);
|
||||
}
|
||||
},startResize:function(e){
|
||||
this.startCoords=this.cloneCoords(this.areaCoords);
|
||||
this.resizing=true;
|
||||
this.resizeHandle=Element.classNames(Event.element(e)).toString().replace(/([^N|NE|E|SE|S|SW|W|NW])+/,"");
|
||||
Event.stop(e);
|
||||
},startDrag:function(e){
|
||||
Element.show(this.selArea);
|
||||
this.clickCoords=this.getCurPos(e);
|
||||
this.setAreaCoords({x1:this.clickCoords.x,y1:this.clickCoords.y,x2:this.clickCoords.x,y2:this.clickCoords.y});
|
||||
this.dragging=true;
|
||||
this.onDrag(e);
|
||||
Event.stop(e);
|
||||
},getCurPos:function(e){
|
||||
return curPos={x:Event.pointerX(e)-this.wrapOffsets.left,y:Event.pointerY(e)-this.wrapOffsets.top};
|
||||
},onDrag:function(e){
|
||||
var _4f=null;
|
||||
if(this.dragging||this.resizing){
|
||||
var _50=this.getCurPos(e);
|
||||
var _51=this.cloneCoords(this.areaCoords);
|
||||
var _52={x:1,y:1};
|
||||
}
|
||||
if(this.dragging){
|
||||
if(_50.x<this.clickCoords.x){
|
||||
_52.x=-1;
|
||||
}
|
||||
if(_50.y<this.clickCoords.y){
|
||||
_52.y=-1;
|
||||
}
|
||||
this.transformCoords(_50.x,this.clickCoords.x,_51,"x");
|
||||
this.transformCoords(_50.y,this.clickCoords.y,_51,"y");
|
||||
}else{
|
||||
if(this.resizing){
|
||||
_4f=this.resizeHandle;
|
||||
if(_4f.match(/E/)){
|
||||
this.transformCoords(_50.x,this.startCoords.x1,_51,"x");
|
||||
if(_50.x<this.startCoords.x1){
|
||||
_52.x=-1;
|
||||
}
|
||||
}else{
|
||||
if(_4f.match(/W/)){
|
||||
this.transformCoords(_50.x,this.startCoords.x2,_51,"x");
|
||||
if(_50.x<this.startCoords.x2){
|
||||
_52.x=-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_4f.match(/N/)){
|
||||
this.transformCoords(_50.y,this.startCoords.y2,_51,"y");
|
||||
if(_50.y<this.startCoords.y2){
|
||||
_52.y=-1;
|
||||
}
|
||||
}else{
|
||||
if(_4f.match(/S/)){
|
||||
this.transformCoords(_50.y,this.startCoords.y1,_51,"y");
|
||||
if(_50.y<this.startCoords.y1){
|
||||
_52.y=-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this.dragging||this.resizing){
|
||||
this.setAreaCoords(_51,false,e.shiftKey,_52,_4f);
|
||||
this.drawArea();
|
||||
Event.stop(e);
|
||||
}
|
||||
},transformCoords:function(_53,_54,_55,_56){
|
||||
var _57=new Array();
|
||||
if(_53<_54){
|
||||
_57[0]=_53;
|
||||
_57[1]=_54;
|
||||
}else{
|
||||
_57[0]=_54;
|
||||
_57[1]=_53;
|
||||
}
|
||||
if(_56=="x"){
|
||||
_55.x1=_57[0];
|
||||
_55.x2=_57[1];
|
||||
}else{
|
||||
_55.y1=_57[0];
|
||||
_55.y2=_57[1];
|
||||
}
|
||||
},endCrop:function(){
|
||||
this.dragging=false;
|
||||
this.resizing=false;
|
||||
this.options.onEndCrop(this.areaCoords,{width:this.calcW(),height:this.calcH()});
|
||||
},subInitialize:function(){
|
||||
},subDrawArea:function(){
|
||||
}};
|
||||
Cropper.ImgWithPreview=Class.create();
|
||||
Object.extend(Object.extend(Cropper.ImgWithPreview.prototype,Cropper.Img.prototype),{subInitialize:function(){
|
||||
this.hasPreviewImg=false;
|
||||
if(typeof (this.options.previewWrap)!="undefined"&&this.options.minWidth>0&&this.options.minHeight>0){
|
||||
this.previewWrap=$(this.options.previewWrap);
|
||||
this.previewImg=this.img.cloneNode(false);
|
||||
this.options.displayOnInit=true;
|
||||
this.hasPreviewImg=true;
|
||||
Element.addClassName(this.previewWrap,"imgCrop_previewWrap");
|
||||
Element.setStyle(this.previewWrap,{width:this.options.minWidth+"px",height:this.options.minHeight+"px"});
|
||||
this.previewWrap.appendChild(this.previewImg);
|
||||
}
|
||||
},subDrawArea:function(){
|
||||
if(this.hasPreviewImg){
|
||||
var _58=this.calcW();
|
||||
var _59=this.calcH();
|
||||
var _5a={x:this.imgW/_58,y:this.imgH/_59};
|
||||
var _5b={x:_58/this.options.minWidth,y:_59/this.options.minHeight};
|
||||
var _5c={w:Math.ceil(this.options.minWidth*_5a.x)+"px",h:Math.ceil(this.options.minHeight*_5a.y)+"px",x:"-"+Math.ceil(this.areaCoords.x1/_5b.x)+"px",y:"-"+Math.ceil(this.areaCoords.y1/_5b.y)+"px"};
|
||||
var _5d=this.previewImg.style;
|
||||
_5d.width=_5c.w;
|
||||
_5d.height=_5c.h;
|
||||
_5d.left=_5c.x;
|
||||
_5d.top=_5c.y;
|
||||
}
|
||||
}});
|
||||
BIN
wp-includes/js/crop/marqueeHoriz.gif
Normal file
BIN
wp-includes/js/crop/marqueeHoriz.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 277 B |
BIN
wp-includes/js/crop/marqueeVert.gif
Normal file
BIN
wp-includes/js/crop/marqueeVert.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 293 B |
585
wp-includes/js/customize-base.js
Normal file
585
wp-includes/js/customize-base.js
Normal file
@@ -0,0 +1,585 @@
|
||||
window.wp = window.wp || {};
|
||||
|
||||
(function( exports, $ ){
|
||||
var api, extend, ctor, inherits,
|
||||
slice = Array.prototype.slice;
|
||||
|
||||
/* =====================================================================
|
||||
* Micro-inheritance - thank you, backbone.js.
|
||||
* ===================================================================== */
|
||||
|
||||
extend = function( protoProps, classProps ) {
|
||||
var child = inherits( this, protoProps, classProps );
|
||||
child.extend = this.extend;
|
||||
return child;
|
||||
};
|
||||
|
||||
// Shared empty constructor function to aid in prototype-chain creation.
|
||||
ctor = function() {};
|
||||
|
||||
// Helper function to correctly set up the prototype chain, for subclasses.
|
||||
// Similar to `goog.inherits`, but uses a hash of prototype properties and
|
||||
// class properties to be extended.
|
||||
inherits = function( parent, protoProps, staticProps ) {
|
||||
var child;
|
||||
|
||||
// The constructor function for the new subclass is either defined by you
|
||||
// (the "constructor" property in your `extend` definition), or defaulted
|
||||
// by us to simply call `super()`.
|
||||
if ( protoProps && protoProps.hasOwnProperty( 'constructor' ) ) {
|
||||
child = protoProps.constructor;
|
||||
} else {
|
||||
child = function() {
|
||||
// Storing the result `super()` before returning the value
|
||||
// prevents a bug in Opera where, if the constructor returns
|
||||
// a function, Opera will reject the return value in favor of
|
||||
// the original object. This causes all sorts of trouble.
|
||||
var result = parent.apply( this, arguments );
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
// Inherit class (static) properties from parent.
|
||||
$.extend( child, parent );
|
||||
|
||||
// Set the prototype chain to inherit from `parent`, without calling
|
||||
// `parent`'s constructor function.
|
||||
ctor.prototype = parent.prototype;
|
||||
child.prototype = new ctor();
|
||||
|
||||
// Add prototype properties (instance properties) to the subclass,
|
||||
// if supplied.
|
||||
if ( protoProps )
|
||||
$.extend( child.prototype, protoProps );
|
||||
|
||||
// Add static properties to the constructor function, if supplied.
|
||||
if ( staticProps )
|
||||
$.extend( child, staticProps );
|
||||
|
||||
// Correctly set child's `prototype.constructor`.
|
||||
child.prototype.constructor = child;
|
||||
|
||||
// Set a convenience property in case the parent's prototype is needed later.
|
||||
child.__super__ = parent.prototype;
|
||||
|
||||
return child;
|
||||
};
|
||||
|
||||
api = {};
|
||||
|
||||
/* =====================================================================
|
||||
* Base class.
|
||||
* ===================================================================== */
|
||||
|
||||
api.Class = function( applicator, argsArray, options ) {
|
||||
var magic, args = arguments;
|
||||
|
||||
if ( applicator && argsArray && api.Class.applicator === applicator ) {
|
||||
args = argsArray;
|
||||
$.extend( this, options || {} );
|
||||
}
|
||||
|
||||
magic = this;
|
||||
if ( this.instance ) {
|
||||
magic = function() {
|
||||
return magic.instance.apply( magic, arguments );
|
||||
};
|
||||
|
||||
$.extend( magic, this );
|
||||
}
|
||||
|
||||
magic.initialize.apply( magic, args );
|
||||
return magic;
|
||||
};
|
||||
|
||||
api.Class.applicator = {};
|
||||
|
||||
api.Class.prototype.initialize = function() {};
|
||||
|
||||
/*
|
||||
* Checks whether a given instance extended a constructor.
|
||||
*
|
||||
* The magic surrounding the instance parameter causes the instanceof
|
||||
* keyword to return inaccurate results; it defaults to the function's
|
||||
* prototype instead of the constructor chain. Hence this function.
|
||||
*/
|
||||
api.Class.prototype.extended = function( constructor ) {
|
||||
var proto = this;
|
||||
|
||||
while ( typeof proto.constructor !== 'undefined' ) {
|
||||
if ( proto.constructor === constructor )
|
||||
return true;
|
||||
if ( typeof proto.constructor.__super__ === 'undefined' )
|
||||
return false;
|
||||
proto = proto.constructor.__super__;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
api.Class.extend = extend;
|
||||
|
||||
/* =====================================================================
|
||||
* Events mixin.
|
||||
* ===================================================================== */
|
||||
|
||||
api.Events = {
|
||||
trigger: function( id ) {
|
||||
if ( this.topics && this.topics[ id ] )
|
||||
this.topics[ id ].fireWith( this, slice.call( arguments, 1 ) );
|
||||
return this;
|
||||
},
|
||||
|
||||
bind: function( id, callback ) {
|
||||
this.topics = this.topics || {};
|
||||
this.topics[ id ] = this.topics[ id ] || $.Callbacks();
|
||||
this.topics[ id ].add.apply( this.topics[ id ], slice.call( arguments, 1 ) );
|
||||
return this;
|
||||
},
|
||||
|
||||
unbind: function( id, callback ) {
|
||||
if ( this.topics && this.topics[ id ] )
|
||||
this.topics[ id ].remove.apply( this.topics[ id ], slice.call( arguments, 1 ) );
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
/* =====================================================================
|
||||
* Observable values that support two-way binding.
|
||||
* ===================================================================== */
|
||||
|
||||
api.Value = api.Class.extend({
|
||||
initialize: function( initial, options ) {
|
||||
this._value = initial; // @todo: potentially change this to a this.set() call.
|
||||
this.callbacks = $.Callbacks();
|
||||
|
||||
$.extend( this, options || {} );
|
||||
|
||||
this.set = $.proxy( this.set, this );
|
||||
},
|
||||
|
||||
/*
|
||||
* Magic. Returns a function that will become the instance.
|
||||
* Set to null to prevent the instance from extending a function.
|
||||
*/
|
||||
instance: function() {
|
||||
return arguments.length ? this.set.apply( this, arguments ) : this.get();
|
||||
},
|
||||
|
||||
get: function() {
|
||||
return this._value;
|
||||
},
|
||||
|
||||
set: function( to ) {
|
||||
var from = this._value;
|
||||
|
||||
to = this._setter.apply( this, arguments );
|
||||
to = this.validate( to );
|
||||
|
||||
// Bail if the sanitized value is null or unchanged.
|
||||
if ( null === to || this._value === to )
|
||||
return this;
|
||||
|
||||
this._value = to;
|
||||
|
||||
this.callbacks.fireWith( this, [ to, from ] );
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
_setter: function( to ) {
|
||||
return to;
|
||||
},
|
||||
|
||||
setter: function( callback ) {
|
||||
var from = this.get();
|
||||
this._setter = callback;
|
||||
// Temporarily clear value so setter can decide if it's valid.
|
||||
this._value = null;
|
||||
this.set( from );
|
||||
return this;
|
||||
},
|
||||
|
||||
resetSetter: function() {
|
||||
this._setter = this.constructor.prototype._setter;
|
||||
this.set( this.get() );
|
||||
return this;
|
||||
},
|
||||
|
||||
validate: function( value ) {
|
||||
return value;
|
||||
},
|
||||
|
||||
bind: function( callback ) {
|
||||
this.callbacks.add.apply( this.callbacks, arguments );
|
||||
return this;
|
||||
},
|
||||
|
||||
unbind: function( callback ) {
|
||||
this.callbacks.remove.apply( this.callbacks, arguments );
|
||||
return this;
|
||||
},
|
||||
|
||||
link: function() { // values*
|
||||
var set = this.set;
|
||||
$.each( arguments, function() {
|
||||
this.bind( set );
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
||||
unlink: function() { // values*
|
||||
var set = this.set;
|
||||
$.each( arguments, function() {
|
||||
this.unbind( set );
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
||||
sync: function() { // values*
|
||||
var that = this;
|
||||
$.each( arguments, function() {
|
||||
that.link( this );
|
||||
this.link( that );
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
||||
unsync: function() { // values*
|
||||
var that = this;
|
||||
$.each( arguments, function() {
|
||||
that.unlink( this );
|
||||
this.unlink( that );
|
||||
});
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
/* =====================================================================
|
||||
* A collection of observable values.
|
||||
* ===================================================================== */
|
||||
|
||||
api.Values = api.Class.extend({
|
||||
defaultConstructor: api.Value,
|
||||
|
||||
initialize: function( options ) {
|
||||
$.extend( this, options || {} );
|
||||
|
||||
this._value = {};
|
||||
this._deferreds = {};
|
||||
},
|
||||
|
||||
instance: function( id ) {
|
||||
if ( arguments.length === 1 )
|
||||
return this.value( id );
|
||||
|
||||
return this.when.apply( this, arguments );
|
||||
},
|
||||
|
||||
value: function( id ) {
|
||||
return this._value[ id ];
|
||||
},
|
||||
|
||||
has: function( id ) {
|
||||
return typeof this._value[ id ] !== 'undefined';
|
||||
},
|
||||
|
||||
add: function( id, value ) {
|
||||
if ( this.has( id ) )
|
||||
return this.value( id );
|
||||
|
||||
this._value[ id ] = value;
|
||||
value.parent = this;
|
||||
if ( value.extended( api.Value ) )
|
||||
value.bind( this._change );
|
||||
|
||||
this.trigger( 'add', value );
|
||||
|
||||
if ( this._deferreds[ id ] )
|
||||
this._deferreds[ id ].resolve();
|
||||
|
||||
return this._value[ id ];
|
||||
},
|
||||
|
||||
create: function( id ) {
|
||||
return this.add( id, new this.defaultConstructor( api.Class.applicator, slice.call( arguments, 1 ) ) );
|
||||
},
|
||||
|
||||
each: function( callback, context ) {
|
||||
context = typeof context === 'undefined' ? this : context;
|
||||
|
||||
$.each( this._value, function( key, obj ) {
|
||||
callback.call( context, obj, key );
|
||||
});
|
||||
},
|
||||
|
||||
remove: function( id ) {
|
||||
var value;
|
||||
|
||||
if ( this.has( id ) ) {
|
||||
value = this.value( id );
|
||||
this.trigger( 'remove', value );
|
||||
if ( value.extended( api.Value ) )
|
||||
value.unbind( this._change );
|
||||
delete value.parent;
|
||||
}
|
||||
|
||||
delete this._value[ id ];
|
||||
delete this._deferreds[ id ];
|
||||
},
|
||||
|
||||
/**
|
||||
* Runs a callback once all requested values exist.
|
||||
*
|
||||
* when( ids*, [callback] );
|
||||
*
|
||||
* For example:
|
||||
* when( id1, id2, id3, function( value1, value2, value3 ) {} );
|
||||
*
|
||||
* @returns $.Deferred.promise();
|
||||
*/
|
||||
when: function() {
|
||||
var self = this,
|
||||
ids = slice.call( arguments ),
|
||||
dfd = $.Deferred();
|
||||
|
||||
// If the last argument is a callback, bind it to .done()
|
||||
if ( $.isFunction( ids[ ids.length - 1 ] ) )
|
||||
dfd.done( ids.pop() );
|
||||
|
||||
$.when.apply( $, $.map( ids, function( id ) {
|
||||
if ( self.has( id ) )
|
||||
return;
|
||||
|
||||
return self._deferreds[ id ] = self._deferreds[ id ] || $.Deferred();
|
||||
})).done( function() {
|
||||
var values = $.map( ids, function( id ) {
|
||||
return self( id );
|
||||
});
|
||||
|
||||
// If a value is missing, we've used at least one expired deferred.
|
||||
// Call Values.when again to generate a new deferred.
|
||||
if ( values.length !== ids.length ) {
|
||||
// ids.push( callback );
|
||||
self.when.apply( self, ids ).done( function() {
|
||||
dfd.resolveWith( self, values );
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
dfd.resolveWith( self, values );
|
||||
});
|
||||
|
||||
return dfd.promise();
|
||||
},
|
||||
|
||||
_change: function() {
|
||||
this.parent.trigger( 'change', this );
|
||||
}
|
||||
});
|
||||
|
||||
$.extend( api.Values.prototype, api.Events );
|
||||
|
||||
/* =====================================================================
|
||||
* An observable value that syncs with an element.
|
||||
*
|
||||
* Handles inputs, selects, and textareas by default.
|
||||
* ===================================================================== */
|
||||
|
||||
api.ensure = function( element ) {
|
||||
return typeof element == 'string' ? $( element ) : element;
|
||||
};
|
||||
|
||||
api.Element = api.Value.extend({
|
||||
initialize: function( element, options ) {
|
||||
var self = this,
|
||||
synchronizer = api.Element.synchronizer.html,
|
||||
type, update, refresh;
|
||||
|
||||
this.element = api.ensure( element );
|
||||
this.events = '';
|
||||
|
||||
if ( this.element.is('input, select, textarea') ) {
|
||||
this.events += 'change';
|
||||
synchronizer = api.Element.synchronizer.val;
|
||||
|
||||
if ( this.element.is('input') ) {
|
||||
type = this.element.prop('type');
|
||||
if ( api.Element.synchronizer[ type ] )
|
||||
synchronizer = api.Element.synchronizer[ type ];
|
||||
if ( 'text' === type || 'password' === type )
|
||||
this.events += ' keyup';
|
||||
} else if ( this.element.is('textarea') ) {
|
||||
this.events += ' keyup';
|
||||
}
|
||||
}
|
||||
|
||||
api.Value.prototype.initialize.call( this, null, $.extend( options || {}, synchronizer ) );
|
||||
this._value = this.get();
|
||||
|
||||
update = this.update;
|
||||
refresh = this.refresh;
|
||||
|
||||
this.update = function( to ) {
|
||||
if ( to !== refresh.call( self ) )
|
||||
update.apply( this, arguments );
|
||||
};
|
||||
this.refresh = function() {
|
||||
self.set( refresh.call( self ) );
|
||||
};
|
||||
|
||||
this.bind( this.update );
|
||||
this.element.bind( this.events, this.refresh );
|
||||
},
|
||||
|
||||
find: function( selector ) {
|
||||
return $( selector, this.element );
|
||||
},
|
||||
|
||||
refresh: function() {},
|
||||
|
||||
update: function() {}
|
||||
});
|
||||
|
||||
api.Element.synchronizer = {};
|
||||
|
||||
$.each( [ 'html', 'val' ], function( i, method ) {
|
||||
api.Element.synchronizer[ method ] = {
|
||||
update: function( to ) {
|
||||
this.element[ method ]( to );
|
||||
},
|
||||
refresh: function() {
|
||||
return this.element[ method ]();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
api.Element.synchronizer.checkbox = {
|
||||
update: function( to ) {
|
||||
this.element.prop( 'checked', to );
|
||||
},
|
||||
refresh: function() {
|
||||
return this.element.prop( 'checked' );
|
||||
}
|
||||
};
|
||||
|
||||
api.Element.synchronizer.radio = {
|
||||
update: function( to ) {
|
||||
this.element.filter( function() {
|
||||
return this.value === to;
|
||||
}).prop( 'checked', true );
|
||||
},
|
||||
refresh: function() {
|
||||
return this.element.filter( ':checked' ).val();
|
||||
}
|
||||
};
|
||||
|
||||
/* =====================================================================
|
||||
* Messenger for postMessage.
|
||||
* ===================================================================== */
|
||||
|
||||
$.support.postMessage = !! window.postMessage;
|
||||
|
||||
api.Messenger = api.Class.extend({
|
||||
add: function( key, initial, options ) {
|
||||
return this[ key ] = new api.Value( initial, options );
|
||||
},
|
||||
|
||||
/**
|
||||
* Initialize Messenger.
|
||||
*
|
||||
* @param {object} params Parameters to configure the messenger.
|
||||
* {string} .url The URL to communicate with.
|
||||
* {window} .targetWindow The window instance to communicate with. Default window.parent.
|
||||
* {string} .channel If provided, will send the channel with each message and only accept messages a matching channel.
|
||||
* @param {object} options Extend any instance parameter or method with this object.
|
||||
*/
|
||||
initialize: function( params, options ) {
|
||||
// Target the parent frame by default, but only if a parent frame exists.
|
||||
var defaultTarget = window.parent == window ? null : window.parent;
|
||||
|
||||
$.extend( this, options || {} );
|
||||
|
||||
this.add( 'channel', params.channel );
|
||||
this.add( 'url', params.url || '' );
|
||||
this.add( 'targetWindow', params.targetWindow || defaultTarget );
|
||||
this.add( 'origin', this.url() ).link( this.url ).setter( function( to ) {
|
||||
return to.replace( /([^:]+:\/\/[^\/]+).*/, '$1' );
|
||||
});
|
||||
|
||||
// Since we want jQuery to treat the receive function as unique
|
||||
// to this instance, we give the function a new guid.
|
||||
//
|
||||
// This will prevent every Messenger's receive function from being
|
||||
// unbound when calling $.off( 'message', this.receive );
|
||||
this.receive = $.proxy( this.receive, this );
|
||||
this.receive.guid = $.guid++;
|
||||
|
||||
$( window ).on( 'message', this.receive );
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
$( window ).off( 'message', this.receive );
|
||||
},
|
||||
|
||||
receive: function( event ) {
|
||||
var message;
|
||||
|
||||
event = event.originalEvent;
|
||||
|
||||
if ( ! this.targetWindow() )
|
||||
return;
|
||||
|
||||
// Check to make sure the origin is valid.
|
||||
if ( this.origin() && event.origin !== this.origin() )
|
||||
return;
|
||||
|
||||
message = JSON.parse( event.data );
|
||||
|
||||
// Check required message properties.
|
||||
if ( ! message || ! message.id || typeof message.data === 'undefined' )
|
||||
return;
|
||||
|
||||
// Check if channel names match.
|
||||
if ( ( message.channel || this.channel() ) && this.channel() !== message.channel )
|
||||
return;
|
||||
|
||||
this.trigger( message.id, message.data );
|
||||
},
|
||||
|
||||
send: function( id, data ) {
|
||||
var message;
|
||||
|
||||
data = typeof data === 'undefined' ? null : data;
|
||||
|
||||
if ( ! this.url() || ! this.targetWindow() )
|
||||
return;
|
||||
|
||||
message = { id: id, data: data };
|
||||
if ( this.channel() )
|
||||
message.channel = this.channel();
|
||||
|
||||
this.targetWindow().postMessage( JSON.stringify( message ), this.origin() );
|
||||
}
|
||||
});
|
||||
|
||||
// Add the Events mixin to api.Messenger.
|
||||
$.extend( api.Messenger.prototype, api.Events );
|
||||
|
||||
/* =====================================================================
|
||||
* Core customize object.
|
||||
* ===================================================================== */
|
||||
|
||||
api = $.extend( new api.Values(), api );
|
||||
api.get = function() {
|
||||
var result = {};
|
||||
|
||||
this.each( function( obj, key ) {
|
||||
result[ key ] = obj.get();
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
// Expose the API to the world.
|
||||
exports.customize = api;
|
||||
})( wp, jQuery );
|
||||
1
wp-includes/js/customize-base.min.js
vendored
Normal file
1
wp-includes/js/customize-base.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
164
wp-includes/js/customize-loader.js
Normal file
164
wp-includes/js/customize-loader.js
Normal file
@@ -0,0 +1,164 @@
|
||||
window.wp = window.wp || {};
|
||||
|
||||
(function( exports, $ ){
|
||||
var api = wp.customize,
|
||||
Loader;
|
||||
|
||||
$.extend( $.support, {
|
||||
history: !! ( window.history && history.pushState ),
|
||||
hashchange: ('onhashchange' in window) && (document.documentMode === undefined || document.documentMode > 7)
|
||||
});
|
||||
|
||||
Loader = $.extend( {}, api.Events, {
|
||||
initialize: function() {
|
||||
this.body = $( document.body );
|
||||
|
||||
// Ensure the loader is supported.
|
||||
// Check for settings, postMessage support, and whether we require CORS support.
|
||||
if ( ! Loader.settings || ! $.support.postMessage || ( ! $.support.cors && Loader.settings.isCrossDomain ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.window = $( window );
|
||||
this.element = $( '<div id="customize-container" />' ).appendTo( this.body );
|
||||
|
||||
this.bind( 'open', this.overlay.show );
|
||||
this.bind( 'close', this.overlay.hide );
|
||||
|
||||
$('#wpbody').on( 'click', '.load-customize', function( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
// Store a reference to the link that opened the customizer.
|
||||
Loader.link = $(this);
|
||||
// Load the theme.
|
||||
Loader.open( Loader.link.attr('href') );
|
||||
});
|
||||
|
||||
// Add navigation listeners.
|
||||
if ( $.support.history )
|
||||
this.window.on( 'popstate', Loader.popstate );
|
||||
|
||||
if ( $.support.hashchange ) {
|
||||
this.window.on( 'hashchange', Loader.hashchange );
|
||||
this.window.triggerHandler( 'hashchange' );
|
||||
}
|
||||
},
|
||||
|
||||
popstate: function( e ) {
|
||||
var state = e.originalEvent.state;
|
||||
if ( state && state.customize )
|
||||
Loader.open( state.customize );
|
||||
else if ( Loader.active )
|
||||
Loader.close();
|
||||
},
|
||||
|
||||
hashchange: function( e ) {
|
||||
var hash = window.location.toString().split('#')[1];
|
||||
|
||||
if ( hash && 0 === hash.indexOf( 'wp_customize=on' ) )
|
||||
Loader.open( Loader.settings.url + '?' + hash );
|
||||
|
||||
if ( ! hash && ! $.support.history )
|
||||
Loader.close();
|
||||
},
|
||||
|
||||
open: function( src ) {
|
||||
var hash;
|
||||
|
||||
if ( this.active )
|
||||
return;
|
||||
|
||||
// Load the full page on mobile devices.
|
||||
if ( Loader.settings.browser.mobile )
|
||||
return window.location = src;
|
||||
|
||||
this.active = true;
|
||||
this.body.addClass('customize-loading');
|
||||
|
||||
this.iframe = $( '<iframe />', { src: src }).appendTo( this.element );
|
||||
this.iframe.one( 'load', this.loaded );
|
||||
|
||||
// Create a postMessage connection with the iframe.
|
||||
this.messenger = new api.Messenger({
|
||||
url: src,
|
||||
channel: 'loader',
|
||||
targetWindow: this.iframe[0].contentWindow
|
||||
});
|
||||
|
||||
// Wait for the connection from the iframe before sending any postMessage events.
|
||||
this.messenger.bind( 'ready', function() {
|
||||
Loader.messenger.send( 'back' );
|
||||
});
|
||||
|
||||
this.messenger.bind( 'close', function() {
|
||||
if ( $.support.history )
|
||||
history.back();
|
||||
else if ( $.support.hashchange )
|
||||
window.location.hash = '';
|
||||
else
|
||||
Loader.close();
|
||||
});
|
||||
|
||||
this.messenger.bind( 'activated', function( location ) {
|
||||
if ( location )
|
||||
window.location = location;
|
||||
});
|
||||
|
||||
hash = src.split('?')[1];
|
||||
|
||||
// Ensure we don't call pushState if the user hit the forward button.
|
||||
if ( $.support.history && window.location.href !== src )
|
||||
history.pushState( { customize: src }, '', src );
|
||||
else if ( ! $.support.history && $.support.hashchange && hash )
|
||||
window.location.hash = 'wp_customize=on&' + hash;
|
||||
|
||||
this.trigger( 'open' );
|
||||
},
|
||||
|
||||
opened: function() {
|
||||
Loader.body.addClass( 'customize-active full-overlay-active' );
|
||||
},
|
||||
|
||||
close: function() {
|
||||
if ( ! this.active )
|
||||
return;
|
||||
this.active = false;
|
||||
|
||||
this.trigger( 'close' );
|
||||
|
||||
// Return focus to link that was originally clicked.
|
||||
if ( this.link )
|
||||
this.link.focus();
|
||||
},
|
||||
|
||||
closed: function() {
|
||||
Loader.iframe.remove();
|
||||
Loader.messenger.destroy();
|
||||
Loader.iframe = null;
|
||||
Loader.messenger = null;
|
||||
Loader.body.removeClass( 'customize-active full-overlay-active' ).removeClass( 'customize-loading' );
|
||||
},
|
||||
|
||||
loaded: function() {
|
||||
Loader.body.removeClass('customize-loading');
|
||||
},
|
||||
|
||||
overlay: {
|
||||
show: function() {
|
||||
this.element.fadeIn( 200, Loader.opened );
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.element.fadeOut( 200, Loader.closed );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$( function() {
|
||||
Loader.settings = _wpCustomizeLoaderSettings;
|
||||
Loader.initialize();
|
||||
});
|
||||
|
||||
// Expose the API to the world.
|
||||
api.Loader = Loader;
|
||||
})( wp, jQuery );
|
||||
1
wp-includes/js/customize-loader.min.js
vendored
Normal file
1
wp-includes/js/customize-loader.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
window.wp=window.wp||{};(function(a,c){var b=wp.customize,d;c.extend(c.support,{history:!!(window.history&&history.pushState),hashchange:("onhashchange" in window)&&(document.documentMode===undefined||document.documentMode>7)});d=c.extend({},b.Events,{initialize:function(){this.body=c(document.body);if(!d.settings||!c.support.postMessage||(!c.support.cors&&d.settings.isCrossDomain)){return}this.window=c(window);this.element=c('<div id="customize-container" />').appendTo(this.body);this.bind("open",this.overlay.show);this.bind("close",this.overlay.hide);c("#wpbody").on("click",".load-customize",function(e){e.preventDefault();d.link=c(this);d.open(d.link.attr("href"))});if(c.support.history){this.window.on("popstate",d.popstate)}if(c.support.hashchange){this.window.on("hashchange",d.hashchange);this.window.triggerHandler("hashchange")}},popstate:function(g){var f=g.originalEvent.state;if(f&&f.customize){d.open(f.customize)}else{if(d.active){d.close()}}},hashchange:function(g){var f=window.location.toString().split("#")[1];if(f&&0===f.indexOf("wp_customize=on")){d.open(d.settings.url+"?"+f)}if(!f&&!c.support.history){d.close()}},open:function(f){var e;if(this.active){return}if(d.settings.browser.mobile){return window.location=f}this.active=true;this.body.addClass("customize-loading");this.iframe=c("<iframe />",{src:f}).appendTo(this.element);this.iframe.one("load",this.loaded);this.messenger=new b.Messenger({url:f,channel:"loader",targetWindow:this.iframe[0].contentWindow});this.messenger.bind("ready",function(){d.messenger.send("back")});this.messenger.bind("close",function(){if(c.support.history){history.back()}else{if(c.support.hashchange){window.location.hash=""}else{d.close()}}});this.messenger.bind("activated",function(g){if(g){window.location=g}});e=f.split("?")[1];if(c.support.history&&window.location.href!==f){history.pushState({customize:f},"",f)}else{if(!c.support.history&&c.support.hashchange&&e){window.location.hash="wp_customize=on&"+e}}this.trigger("open")},opened:function(){d.body.addClass("customize-active full-overlay-active")},close:function(){if(!this.active){return}this.active=false;this.trigger("close");if(this.link){this.link.focus()}},closed:function(){d.iframe.remove();d.messenger.destroy();d.iframe=null;d.messenger=null;d.body.removeClass("customize-active full-overlay-active").removeClass("customize-loading")},loaded:function(){d.body.removeClass("customize-loading")},overlay:{show:function(){this.element.fadeIn(200,d.opened)},hide:function(){this.element.fadeOut(200,d.closed)}}});c(function(){d.settings=_wpCustomizeLoaderSettings;d.initialize()});b.Loader=d})(wp,jQuery);
|
||||
146
wp-includes/js/customize-preview.js
Normal file
146
wp-includes/js/customize-preview.js
Normal file
@@ -0,0 +1,146 @@
|
||||
(function( exports, $ ){
|
||||
var api = wp.customize,
|
||||
debounce;
|
||||
|
||||
debounce = function( fn, delay, context ) {
|
||||
var timeout;
|
||||
return function() {
|
||||
var args = arguments;
|
||||
|
||||
context = context || this;
|
||||
|
||||
clearTimeout( timeout );
|
||||
timeout = setTimeout( function() {
|
||||
timeout = null;
|
||||
fn.apply( context, args );
|
||||
}, delay );
|
||||
};
|
||||
};
|
||||
|
||||
api.Preview = api.Messenger.extend({
|
||||
/**
|
||||
* Requires params:
|
||||
* - url - the URL of preview frame
|
||||
*/
|
||||
initialize: function( params, options ) {
|
||||
var self = this;
|
||||
|
||||
api.Messenger.prototype.initialize.call( this, params, options );
|
||||
|
||||
this.body = $( document.body );
|
||||
this.body.on( 'click.preview', 'a', function( event ) {
|
||||
event.preventDefault();
|
||||
self.send( 'scroll', 0 );
|
||||
self.send( 'url', $(this).prop('href') );
|
||||
});
|
||||
|
||||
// You cannot submit forms.
|
||||
// @todo: Allow form submissions by mixing $_POST data with the customize setting $_POST data.
|
||||
this.body.on( 'submit.preview', 'form', function( event ) {
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
this.window = $( window );
|
||||
this.window.on( 'scroll.preview', debounce( function() {
|
||||
self.send( 'scroll', self.window.scrollTop() );
|
||||
}, 200 ));
|
||||
|
||||
this.bind( 'scroll', function( distance ) {
|
||||
self.window.scrollTop( distance );
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$( function() {
|
||||
api.settings = window._wpCustomizeSettings;
|
||||
if ( ! api.settings )
|
||||
return;
|
||||
|
||||
var preview, bg;
|
||||
|
||||
preview = new api.Preview({
|
||||
url: window.location.href,
|
||||
channel: api.settings.channel
|
||||
});
|
||||
|
||||
preview.bind( 'settings', function( values ) {
|
||||
$.each( values, function( id, value ) {
|
||||
if ( api.has( id ) )
|
||||
api( id ).set( value );
|
||||
else
|
||||
api.create( id, value );
|
||||
});
|
||||
});
|
||||
|
||||
preview.trigger( 'settings', api.settings.values );
|
||||
|
||||
preview.bind( 'setting', function( args ) {
|
||||
var value;
|
||||
|
||||
args = args.slice();
|
||||
|
||||
if ( value = api( args.shift() ) )
|
||||
value.set.apply( value, args );
|
||||
});
|
||||
|
||||
preview.bind( 'sync', function( events ) {
|
||||
$.each( events, function( event, args ) {
|
||||
preview.trigger( event, args );
|
||||
});
|
||||
preview.send( 'synced' );
|
||||
});
|
||||
|
||||
preview.bind( 'active', function() {
|
||||
if ( api.settings.nonce )
|
||||
preview.send( 'nonce', api.settings.nonce );
|
||||
});
|
||||
|
||||
preview.send( 'ready' );
|
||||
|
||||
/* Custom Backgrounds */
|
||||
bg = $.map(['color', 'image', 'position_x', 'repeat', 'attachment'], function( prop ) {
|
||||
return 'background_' + prop;
|
||||
});
|
||||
|
||||
api.when.apply( api, bg ).done( function( color, image, position_x, repeat, attachment ) {
|
||||
var body = $(document.body),
|
||||
head = $('head'),
|
||||
style = $('#custom-background-css'),
|
||||
update;
|
||||
|
||||
// If custom backgrounds are active and we can't find the
|
||||
// default output, bail.
|
||||
if ( body.hasClass('custom-background') && ! style.length )
|
||||
return;
|
||||
|
||||
update = function() {
|
||||
var css = '';
|
||||
|
||||
// The body will support custom backgrounds if either
|
||||
// the color or image are set.
|
||||
//
|
||||
// See get_body_class() in /wp-includes/post-template.php
|
||||
body.toggleClass( 'custom-background', !! ( color() || image() ) );
|
||||
|
||||
if ( color() )
|
||||
css += 'background-color: ' + color() + ';';
|
||||
|
||||
if ( image() ) {
|
||||
css += 'background-image: url("' + image() + '");';
|
||||
css += 'background-position: top ' + position_x() + ';';
|
||||
css += 'background-repeat: ' + repeat() + ';';
|
||||
css += 'background-attachment: ' + attachment() + ';';
|
||||
}
|
||||
|
||||
// Refresh the stylesheet by removing and recreating it.
|
||||
style.remove();
|
||||
style = $('<style type="text/css" id="custom-background-css">body.custom-background { ' + css + ' }</style>').appendTo( head );
|
||||
};
|
||||
|
||||
$.each( arguments, function() {
|
||||
this.bind( update );
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
})( wp, jQuery );
|
||||
1
wp-includes/js/customize-preview.min.js
vendored
Normal file
1
wp-includes/js/customize-preview.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(b,d){var c=wp.customize,a;a=function(g,e,f){var h;return function(){var i=arguments;f=f||this;clearTimeout(h);h=setTimeout(function(){h=null;g.apply(f,i)},e)}};c.Preview=c.Messenger.extend({initialize:function(g,f){var e=this;c.Messenger.prototype.initialize.call(this,g,f);this.body=d(document.body);this.body.on("click.preview","a",function(h){h.preventDefault();e.send("scroll",0);e.send("url",d(this).prop("href"))});this.body.on("submit.preview","form",function(h){h.preventDefault()});this.window=d(window);this.window.on("scroll.preview",a(function(){e.send("scroll",e.window.scrollTop())},200));this.bind("scroll",function(h){e.window.scrollTop(h)})}});d(function(){c.settings=window._wpCustomizeSettings;if(!c.settings){return}var f,e;f=new c.Preview({url:window.location.href,channel:c.settings.channel});f.bind("settings",function(g){d.each(g,function(i,h){if(c.has(i)){c(i).set(h)}else{c.create(i,h)}})});f.trigger("settings",c.settings.values);f.bind("setting",function(g){var h;g=g.slice();if(h=c(g.shift())){h.set.apply(h,g)}});f.bind("sync",function(g){d.each(g,function(i,h){f.trigger(i,h)});f.send("synced")});f.bind("active",function(){if(c.settings.nonce){f.send("nonce",c.settings.nonce)}});f.send("ready");e=d.map(["color","image","position_x","repeat","attachment"],function(g){return"background_"+g});c.when.apply(c,e).done(function(j,i,m,h,l){var n=d(document.body),o=d("head"),g=d("#custom-background-css"),k;if(n.hasClass("custom-background")&&!g.length){return}k=function(){var p="";n.toggleClass("custom-background",!!(j()||i()));if(j()){p+="background-color: "+j()+";"}if(i()){p+='background-image: url("'+i()+'");';p+="background-position: top "+m()+";";p+="background-repeat: "+h()+";";p+="background-attachment: "+l()+";"}g.remove();g=d('<style type="text/css" id="custom-background-css">body.custom-background { '+p+" }</style>").appendTo(o)};d.each(arguments,function(){this.bind(k)})})})})(wp,jQuery);
|
||||
106
wp-includes/js/hoverIntent.js
Normal file
106
wp-includes/js/hoverIntent.js
Normal file
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* hoverIntent is similar to jQuery's built-in "hover" function except that
|
||||
* instead of firing the onMouseOver event immediately, hoverIntent checks
|
||||
* to see if the user's mouse has slowed down (beneath the sensitivity
|
||||
* threshold) before firing the onMouseOver event.
|
||||
*
|
||||
* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
|
||||
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
|
||||
*
|
||||
* hoverIntent is currently available for use in all personal or commercial
|
||||
* projects under both MIT and GPL licenses. This means that you can choose
|
||||
* the license that best suits your project, and use it accordingly.
|
||||
*
|
||||
* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
|
||||
* $("ul li").hoverIntent( showNav , hideNav );
|
||||
*
|
||||
* // advanced usage receives configuration object only
|
||||
* $("ul li").hoverIntent({
|
||||
* sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
|
||||
* interval: 100, // number = milliseconds of polling interval
|
||||
* over: showNav, // function = onMouseOver callback (required)
|
||||
* timeout: 0, // number = milliseconds delay before onMouseOut function call
|
||||
* out: hideNav // function = onMouseOut callback (required)
|
||||
* });
|
||||
*
|
||||
* @param f onMouseOver function || An object with configuration options
|
||||
* @param g onMouseOut function || Nothing (use configuration options object)
|
||||
* @author Brian Cherne brian(at)cherne(dot)net
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.hoverIntent = function(f,g) {
|
||||
// default configuration options
|
||||
var cfg = {
|
||||
sensitivity: 7,
|
||||
interval: 100,
|
||||
timeout: 0
|
||||
};
|
||||
// override configuration options with user supplied object
|
||||
cfg = $.extend(cfg, g ? { over: f, out: g } : f );
|
||||
|
||||
// instantiate variables
|
||||
// cX, cY = current X and Y position of mouse, updated by mousemove event
|
||||
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
|
||||
var cX, cY, pX, pY;
|
||||
|
||||
// A private function for getting mouse position
|
||||
var track = function(ev) {
|
||||
cX = ev.pageX;
|
||||
cY = ev.pageY;
|
||||
};
|
||||
|
||||
// A private function for comparing current and previous mouse position
|
||||
var compare = function(ev,ob) {
|
||||
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
||||
// compare mouse positions to see if they've crossed the threshold
|
||||
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
|
||||
$(ob).unbind("mousemove",track);
|
||||
// set hoverIntent state to true (so mouseOut can be called)
|
||||
ob.hoverIntent_s = 1;
|
||||
return cfg.over.apply(ob,[ev]);
|
||||
} else {
|
||||
// set previous coordinates for next time
|
||||
pX = cX; pY = cY;
|
||||
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
|
||||
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
|
||||
}
|
||||
};
|
||||
|
||||
// A private function for delaying the mouseOut function
|
||||
var delay = function(ev,ob) {
|
||||
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
||||
ob.hoverIntent_s = 0;
|
||||
return cfg.out.apply(ob,[ev]);
|
||||
};
|
||||
|
||||
// A private function for handling mouse 'hovering'
|
||||
var handleHover = function(e) {
|
||||
// copy objects to be passed into t (required for event object to be passed in IE)
|
||||
var ev = jQuery.extend({},e);
|
||||
var ob = this;
|
||||
|
||||
// cancel hoverIntent timer if it exists
|
||||
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
|
||||
|
||||
// if e.type == "mouseenter"
|
||||
if (e.type == "mouseenter") {
|
||||
// set "previous" X and Y position based on initial entry point
|
||||
pX = ev.pageX; pY = ev.pageY;
|
||||
// update "current" X and Y position based on mousemove
|
||||
$(ob).bind("mousemove",track);
|
||||
// start polling interval (self-calling timeout) to compare mouse coordinates over time
|
||||
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
|
||||
|
||||
// else e.type == "mouseleave"
|
||||
} else {
|
||||
// unbind expensive mousemove event
|
||||
$(ob).unbind("mousemove",track);
|
||||
// if hoverIntent state is true, then call the mouseOut function after the specified delay
|
||||
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
|
||||
}
|
||||
};
|
||||
|
||||
// bind the function to the two event listeners
|
||||
return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover);
|
||||
};
|
||||
})(jQuery);
|
||||
1
wp-includes/js/hoverIntent.min.js
vendored
Normal file
1
wp-includes/js/hoverIntent.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(a){a.fn.hoverIntent=function(k,j){var l={sensitivity:7,interval:100,timeout:0};l=a.extend(l,j?{over:k,out:j}:k);var n,m,h,d;var e=function(f){n=f.pageX;m=f.pageY};var c=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-n)+Math.abs(d-m))<l.sensitivity){a(f).unbind("mousemove",e);f.hoverIntent_s=1;return l.over.apply(f,[g])}else{h=n;d=m;f.hoverIntent_t=setTimeout(function(){c(g,f)},l.interval)}};var i=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return l.out.apply(f,[g])};var b=function(o){var g=jQuery.extend({},o);var f=this;if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(o.type=="mouseenter"){h=g.pageX;d=g.pageY;a(f).bind("mousemove",e);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){c(g,f)},l.interval)}}else{a(f).unbind("mousemove",e);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){i(g,f)},l.timeout)}}};return this.bind("mouseenter",b).bind("mouseleave",b)}})(jQuery);
|
||||
BIN
wp-includes/js/imgareaselect/border-anim-h.gif
Normal file
BIN
wp-includes/js/imgareaselect/border-anim-h.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 178 B |
BIN
wp-includes/js/imgareaselect/border-anim-v.gif
Normal file
BIN
wp-includes/js/imgareaselect/border-anim-v.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 178 B |
41
wp-includes/js/imgareaselect/imgareaselect.css
Normal file
41
wp-includes/js/imgareaselect/imgareaselect.css
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* imgAreaSelect animated border style
|
||||
*/
|
||||
|
||||
.imgareaselect-border1 {
|
||||
background: url(border-anim-v.gif) repeat-y left top;
|
||||
}
|
||||
|
||||
.imgareaselect-border2 {
|
||||
background: url(border-anim-h.gif) repeat-x left top;
|
||||
}
|
||||
|
||||
.imgareaselect-border3 {
|
||||
background: url(border-anim-v.gif) repeat-y right top;
|
||||
}
|
||||
|
||||
.imgareaselect-border4 {
|
||||
background: url(border-anim-h.gif) repeat-x left bottom;
|
||||
}
|
||||
|
||||
.imgareaselect-border1, .imgareaselect-border2,
|
||||
.imgareaselect-border3, .imgareaselect-border4 {
|
||||
filter: alpha(opacity=50);
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.imgareaselect-handle {
|
||||
background-color: #fff;
|
||||
border: solid 1px #000;
|
||||
filter: alpha(opacity=50);
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.imgareaselect-outer {
|
||||
background-color: #000;
|
||||
filter: alpha(opacity=50);
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.imgareaselect-selection {
|
||||
}
|
||||
1198
wp-includes/js/imgareaselect/jquery.imgareaselect.js
Normal file
1198
wp-includes/js/imgareaselect/jquery.imgareaselect.js
Normal file
File diff suppressed because it is too large
Load Diff
1
wp-includes/js/imgareaselect/jquery.imgareaselect.min.js
vendored
Normal file
1
wp-includes/js/imgareaselect/jquery.imgareaselect.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
wp-includes/js/jcrop/Jcrop.gif
Normal file
BIN
wp-includes/js/jcrop/Jcrop.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 323 B |
28
wp-includes/js/jcrop/jquery.Jcrop.min.css
vendored
Normal file
28
wp-includes/js/jcrop/jquery.Jcrop.min.css
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
/* jquery.Jcrop.min.css v0.9.10 (build:20120429) */
|
||||
.jcrop-holder{direction:ltr;text-align:left;}
|
||||
.jcrop-vline,.jcrop-hline{background:#FFF url(Jcrop.gif) top left repeat;font-size:0;position:absolute;}
|
||||
.jcrop-vline{height:100%;width:1px!important;}
|
||||
.jcrop-hline{height:1px!important;width:100%;}
|
||||
.jcrop-vline.right{right:0;}
|
||||
.jcrop-hline.bottom{bottom:0;}
|
||||
.jcrop-handle{background-color:#333;border:1px #eee solid;font-size:1px;}
|
||||
.jcrop-tracker{-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;height:100%;width:100%;}
|
||||
.jcrop-handle.ord-n{left:50%;margin-left:-4px;margin-top:-4px;top:0;}
|
||||
.jcrop-handle.ord-s{bottom:0;left:50%;margin-bottom:-4px;margin-left:-4px;}
|
||||
.jcrop-handle.ord-e{margin-right:-4px;margin-top:-4px;right:0;top:50%;}
|
||||
.jcrop-handle.ord-w{left:0;margin-left:-4px;margin-top:-4px;top:50%;}
|
||||
.jcrop-handle.ord-nw{left:0;margin-left:-4px;margin-top:-4px;top:0;}
|
||||
.jcrop-handle.ord-ne{margin-right:-4px;margin-top:-4px;right:0;top:0;}
|
||||
.jcrop-handle.ord-se{bottom:0;margin-bottom:-4px;margin-right:-4px;right:0;}
|
||||
.jcrop-handle.ord-sw{bottom:0;left:0;margin-bottom:-4px;margin-left:-4px;}
|
||||
.jcrop-dragbar.ord-n,.jcrop-dragbar.ord-s{height:7px;width:100%;}
|
||||
.jcrop-dragbar.ord-e,.jcrop-dragbar.ord-w{height:100%;width:7px;}
|
||||
.jcrop-dragbar.ord-n{margin-top:-4px;}
|
||||
.jcrop-dragbar.ord-s{bottom:0;margin-bottom:-4px;}
|
||||
.jcrop-dragbar.ord-e{margin-right:-4px;right:0;}
|
||||
.jcrop-dragbar.ord-w{margin-left:-4px;}
|
||||
.jcrop-light .jcrop-vline,.jcrop-light .jcrop-hline{background:#FFF;filter:Alpha(opacity=70)!important;opacity:.70!important;}
|
||||
.jcrop-light .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#000;border-color:#FFF;border-radius:3px;}
|
||||
.jcrop-dark .jcrop-vline,.jcrop-dark .jcrop-hline{background:#000;filter:Alpha(opacity=70)!important;opacity:.7!important;}
|
||||
.jcrop-dark .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#FFF;border-color:#000;border-radius:3px;}
|
||||
.jcrop-holder img,img.jcrop-preview{max-width:none;}
|
||||
22
wp-includes/js/jcrop/jquery.Jcrop.min.js
vendored
Normal file
22
wp-includes/js/jcrop/jquery.Jcrop.min.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* jquery.Jcrop.min.js v0.9.10 (build:20120429)
|
||||
* jQuery Image Cropping Plugin - released under MIT License
|
||||
* Copyright (c) 2008-2012 Tapmodo Interactive LLC
|
||||
* https://github.com/tapmodo/Jcrop
|
||||
*/
|
||||
(function(a){a.Jcrop=function(b,c){function h(a){return a+"px"}function i(a){return d.baseClass+"-"+a}function j(){return a.fx.step.hasOwnProperty("backgroundColor")}function k(b){var c=a(b).offset();return[c.left,c.top]}function l(a){return[a.pageX-e[0],a.pageY-e[1]]}function m(b){typeof b!="object"&&(b={}),d=a.extend(d,b),a.each(["onChange","onSelect","onRelease","onDblClick"],function(a,b){typeof d[b]!="function"&&(d[b]=function(){})})}function n(a,b){e=k(E),bd.setCursor(a==="move"?a:a+"-resize");if(a==="move")return bd.activateHandlers(p(b),u);var c=ba.getFixed(),d=q(a),f=ba.getCorner(q(d));ba.setPressed(ba.getCorner(d)),ba.setCurrent(f),bd.activateHandlers(o(a,c),u)}function o(a,b){return function(c){if(!d.aspectRatio)switch(a){case"e":c[1]=b.y2;break;case"w":c[1]=b.y2;break;case"n":c[0]=b.x2;break;case"s":c[0]=b.x2}else switch(a){case"e":c[1]=b.y+1;break;case"w":c[1]=b.y+1;break;case"n":c[0]=b.x+1;break;case"s":c[0]=b.x+1}ba.setCurrent(c),bc.update()}}function p(a){var b=a;return be.watchKeys(),function(
|
||||
a){ba.moveOffset([a[0]-b[0],a[1]-b[1]]),b=a,bc.update()}}function q(a){switch(a){case"n":return"sw";case"s":return"nw";case"e":return"nw";case"w":return"ne";case"ne":return"sw";case"nw":return"se";case"se":return"nw";case"sw":return"ne"}}function r(a){return function(b){return d.disabled?!1:a==="move"&&!d.allowMove?!1:(e=k(E),X=!0,n(a,l(b)),b.stopPropagation(),b.preventDefault(),!1)}}function s(a,b,c){var d=a.width(),e=a.height();d>b&&b>0&&(d=b,e=b/a.width()*a.height()),e>c&&c>0&&(e=c,d=c/a.height()*a.width()),U=a.width()/d,V=a.height()/e,a.width(d).height(e)}function t(a){return{x:a.x*U,y:a.y*V,x2:a.x2*U,y2:a.y2*V,w:a.w*U,h:a.h*V}}function u(a){var b=ba.getFixed();b.w>d.minSelect[0]&&b.h>d.minSelect[1]?(bc.enableHandles(),bc.done()):bc.release(),bd.setCursor(d.allowSelect?"crosshair":"default")}function v(a){if(d.disabled)return!1;if(!d.allowSelect)return!1;X=!0,e=k(E),bc.disableHandles(),bd.setCursor("crosshair");var b=l(a);return ba.setPressed(b),bc.update(),bd.activateHandlers(w,u),be.watchKeys(),a.stopPropagation
|
||||
(),a.preventDefault(),!1}function w(a){ba.setCurrent(a),bc.update()}function z(){var b=a("<div></div>").addClass(i("tracker"));return a.browser.msie&&b.css({opacity:0,backgroundColor:"white"}),b}function bf(a){H.removeClass().addClass(i("holder")).addClass(a)}function bg(a,b){function t(){window.setTimeout(u,l)}var c=a[0]/U,e=a[1]/V,f=a[2]/U,g=a[3]/V;if(Y)return;var h=ba.flipCoords(c,e,f,g),i=ba.getFixed(),j=[i.x,i.y,i.x2,i.y2],k=j,l=d.animationDelay,m=h[0]-j[0],n=h[1]-j[1],o=h[2]-j[2],p=h[3]-j[3],q=0,r=d.swingSpeed;x=k[0],y=k[1],f=k[2],g=k[3],bc.animMode(!0);var s,u=function(){return function(){q+=(100-q)/r,k[0]=x+q/100*m,k[1]=y+q/100*n,k[2]=f+q/100*o,k[3]=g+q/100*p,q>=99.8&&(q=100),q<100?(bi(k),t()):(bc.done(),typeof b=="function"&&b.call(bt))}}();t()}function bh(a){bi([a[0]/U,a[1]/V,a[2]/U,a[3]/V]),d.onSelect.call(bt,t(ba.getFixed())),bc.enableHandles()}function bi(a){ba.setPressed([a[0],a[1]]),ba.setCurrent([a[2],a[3]]),bc.update()}function bj(){return t(ba.getFixed())}function bk(){return ba.getFixed()}function bl
|
||||
(a){m(a),bs()}function bm(){d.disabled=!0,bc.disableHandles(),bc.setCursor("default"),bd.setCursor("default")}function bn(){d.disabled=!1,bs()}function bo(){bc.done(),bd.activateHandlers(null,null)}function bp(){H.remove(),B.show(),a(b).removeData("Jcrop")}function bq(a,b){bc.release(),bm();var c=new Image;c.onload=function(){var e=c.width,f=c.height,g=d.boxWidth,h=d.boxHeight;E.width(e).height(f),E.attr("src",a),I.attr("src",a),s(E,g,h),F=E.width(),G=E.height(),I.width(F).height(G),N.width(F+M*2).height(G+M*2),H.width(F).height(G),bb.resize(F,G),bn(),typeof b=="function"&&b.call(bt)},c.src=a}function br(a,b,c){var e=b||d.bgColor;d.bgFade&&j()&&d.fadeTime&&!c?a.animate({backgroundColor:e},{queue:!1,duration:d.fadeTime}):a.css("backgroundColor",e)}function bs(a){d.allowResize?a?bc.enableOnly():bc.enableHandles():bc.disableHandles(),bd.setCursor(d.allowSelect?"crosshair":"default"),bc.setCursor(d.allowMove?"move":"default"),d.hasOwnProperty("trueSize")&&(U=d.trueSize[0]/F,V=d.trueSize[1]/G),d.hasOwnProperty("setSelect"
|
||||
)&&(bh(d.setSelect),bc.done(),delete d.setSelect),bb.refresh(),d.bgColor!=O&&(br(d.shade?bb.getShades():H,d.shade?d.shadeColor||d.bgColor:d.bgColor),O=d.bgColor),P!=d.bgOpacity&&(P=d.bgOpacity,d.shade?bb.refresh():bc.setBgOpacity(P)),Q=d.maxSize[0]||0,R=d.maxSize[1]||0,S=d.minSize[0]||0,T=d.minSize[1]||0,d.hasOwnProperty("outerImage")&&(E.attr("src",d.outerImage),delete d.outerImage),bc.refresh()}var d=a.extend({},a.Jcrop.defaults),e,f,g=!1;a.browser.msie&&a.browser.version.split(".")[0]==="6"&&(g=!0),typeof b!="object"&&(b=a(b)[0]),typeof c!="object"&&(c={}),m(c);var A={border:"none",visibility:"visible",margin:0,padding:0,position:"absolute",top:0,left:0},B=a(b),C=!0;if(b.tagName=="IMG"){if(B[0].width!=0&&B[0].height!=0)B.width(B[0].width),B.height(B[0].height);else{var D=new Image;D.src=B[0].src,B.width(D.width),B.height(D.height)}var E=B.clone().removeAttr("id").css(A).show();E.width(B.width()),E.height(B.height()),B.after(E).hide()}else E=B.css(A).show(),C=!1,d.shade===null&&(d.shade=!0);s(E,d.boxWidth,d.
|
||||
boxHeight);var F=E.width(),G=E.height(),H=a("<div />").width(F).height(G).addClass(i("holder")).css({position:"relative",backgroundColor:d.bgColor}).insertAfter(B).append(E);d.addClass&&H.addClass(d.addClass);var I=a("<div />"),J=a("<div />").width("100%").height("100%").css({zIndex:310,position:"absolute",overflow:"hidden"}),K=a("<div />").width("100%").height("100%").css("zIndex",320),L=a("<div />").css({position:"absolute",zIndex:600}).dblclick(function(){var a=ba.getFixed();d.onDblClick.call(bt,a)}).insertBefore(E).append(J,K);C&&(I=a("<img />").attr("src",E.attr("src")).css(A).width(F).height(G),J.append(I)),g&&L.css({overflowY:"hidden"});var M=d.boundary,N=z().width(F+M*2).height(G+M*2).css({position:"absolute",top:h(-M),left:h(-M),zIndex:290}).mousedown(v),O=d.bgColor,P=d.bgOpacity,Q,R,S,T,U,V,W=!0,X,Y,Z;e=k(E);var _=function(){function a(){var a={},b=["touchstart","touchmove","touchend"],c=document.createElement("div"),d;try{for(d=0;d<b.length;d++){var e=b[d];e="on"+e;var f=e in c;f||(c.setAttribute(e,"return;"
|
||||
),f=typeof c[e]=="function"),a[b[d]]=f}return a.touchstart&&a.touchend&&a.touchmove}catch(g){return!1}}function b(){return d.touchSupport===!0||d.touchSupport===!1?d.touchSupport:a()}return{createDragger:function(a){return function(b){return b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,d.disabled?!1:a==="move"&&!d.allowMove?!1:(X=!0,n(a,l(b)),b.stopPropagation(),b.preventDefault(),!1)}},newSelection:function(a){return a.pageX=a.originalEvent.changedTouches[0].pageX,a.pageY=a.originalEvent.changedTouches[0].pageY,v(a)},isSupported:a,support:b()}}(),ba=function(){function h(d){d=n(d),c=a=d[0],e=b=d[1]}function i(a){a=n(a),f=a[0]-c,g=a[1]-e,c=a[0],e=a[1]}function j(){return[f,g]}function k(d){var f=d[0],g=d[1];0>a+f&&(f-=f+a),0>b+g&&(g-=g+b),G<e+g&&(g+=G-(e+g)),F<c+f&&(f+=F-(c+f)),a+=f,c+=f,b+=g,e+=g}function l(a){var b=m();switch(a){case"ne":return[b.x2,b.y];case"nw":return[b.x,b.y];case"se":return[b.x2,b.y2];case"sw":return[b.x,b.y2]}}function m(){if(!d.aspectRatio
|
||||
)return p();var f=d.aspectRatio,g=d.minSize[0]/U,h=d.maxSize[0]/U,i=d.maxSize[1]/V,j=c-a,k=e-b,l=Math.abs(j),m=Math.abs(k),n=l/m,r,s,t,u;return h===0&&(h=F*10),i===0&&(i=G*10),n<f?(s=e,t=m*f,r=j<0?a-t:t+a,r<0?(r=0,u=Math.abs((r-a)/f),s=k<0?b-u:u+b):r>F&&(r=F,u=Math.abs((r-a)/f),s=k<0?b-u:u+b)):(r=c,u=l/f,s=k<0?b-u:b+u,s<0?(s=0,t=Math.abs((s-b)*f),r=j<0?a-t:t+a):s>G&&(s=G,t=Math.abs(s-b)*f,r=j<0?a-t:t+a)),r>a?(r-a<g?r=a+g:r-a>h&&(r=a+h),s>b?s=b+(r-a)/f:s=b-(r-a)/f):r<a&&(a-r<g?r=a-g:a-r>h&&(r=a-h),s>b?s=b+(a-r)/f:s=b-(a-r)/f),r<0?(a-=r,r=0):r>F&&(a-=r-F,r=F),s<0?(b-=s,s=0):s>G&&(b-=s-G,s=G),q(o(a,b,r,s))}function n(a){return a[0]<0&&(a[0]=0),a[1]<0&&(a[1]=0),a[0]>F&&(a[0]=F),a[1]>G&&(a[1]=G),[a[0],a[1]]}function o(a,b,c,d){var e=a,f=c,g=b,h=d;return c<a&&(e=c,f=a),d<b&&(g=d,h=b),[e,g,f,h]}function p(){var d=c-a,f=e-b,g;return Q&&Math.abs(d)>Q&&(c=d>0?a+Q:a-Q),R&&Math.abs(f)>R&&(e=f>0?b+R:b-R),T/V&&Math.abs(f)<T/V&&(e=f>0?b+T/V:b-T/V),S/U&&Math.abs(d)<S/U&&(c=d>0?a+S/U:a-S/U),a<0&&(c-=a,a-=a),b<0&&(e-=b,b-=b),c<0&&
|
||||
(a-=c,c-=c),e<0&&(b-=e,e-=e),c>F&&(g=c-F,a-=g,c-=g),e>G&&(g=e-G,b-=g,e-=g),a>F&&(g=a-G,e-=g,b-=g),b>G&&(g=b-G,e-=g,b-=g),q(o(a,b,c,e))}function q(a){return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]}}var a=0,b=0,c=0,e=0,f,g;return{flipCoords:o,setPressed:h,setCurrent:i,getOffset:j,moveOffset:k,getCorner:l,getFixed:m}}(),bb=function(){function f(a,b){e.left.css({height:h(b)}),e.right.css({height:h(b)})}function g(){return i(ba.getFixed())}function i(a){e.top.css({left:h(a.x),width:h(a.w),height:h(a.y)}),e.bottom.css({top:h(a.y2),left:h(a.x),width:h(a.w),height:h(G-a.y2)}),e.right.css({left:h(a.x2),width:h(F-a.x2)}),e.left.css({width:h(a.x)})}function j(){return a("<div />").css({position:"absolute",backgroundColor:d.shadeColor||d.bgColor}).appendTo(c)}function k(){b||(b=!0,c.insertBefore(E),g(),bc.setBgOpacity(1,0,1),I.hide(),l(d.shadeColor||d.bgColor,1),bc.isAwake()?n(d.bgOpacity,1):n(1,1))}function l(a,b){br(p(),a,b)}function m(){b&&(c.remove(),I.show(),b=!1,bc.isAwake()?bc.setBgOpacity(d.bgOpacity
|
||||
,1,1):(bc.setBgOpacity(1,1,1),bc.disableHandles()),br(H,0,1))}function n(a,e){b&&(d.bgFade&&!e?c.animate({opacity:1-a},{queue:!1,duration:d.fadeTime}):c.css({opacity:1-a}))}function o(){d.shade?k():m(),bc.isAwake()&&n(d.bgOpacity)}function p(){return c.children()}var b=!1,c=a("<div />").css({position:"absolute",zIndex:240,opacity:0}),e={top:j(),left:j().height(G),right:j().height(G),bottom:j()};return{update:g,updateRaw:i,getShades:p,setBgColor:l,enable:k,disable:m,resize:f,refresh:o,opacity:n}}(),bc=function(){function k(b){var c=a("<div />").css({position:"absolute",opacity:d.borderOpacity}).addClass(i(b));return J.append(c),c}function l(b,c){var d=a("<div />").mousedown(r(b)).css({cursor:b+"-resize",position:"absolute",zIndex:c}).addClass("ord-"+b);return _.support&&d.bind("touchstart.jcrop",_.createDragger(b)),K.append(d),d}function m(a){var b=d.handleSize;return l(a,c++).css({opacity:d.handleOpacity}).width(b).height(b).addClass(i("handle"))}function n(a){return l(a,c++).addClass("jcrop-dragbar")}function o
|
||||
(a){var b;for(b=0;b<a.length;b++)g[a[b]]=n(a[b])}function p(a){var b,c;for(c=0;c<a.length;c++){switch(a[c]){case"n":b="hline";break;case"s":b="hline bottom";break;case"e":b="vline right";break;case"w":b="vline"}e[a[c]]=k(b)}}function q(a){var b;for(b=0;b<a.length;b++)f[a[b]]=m(a[b])}function s(a,b){d.shade||I.css({top:h(-b),left:h(-a)}),L.css({top:h(b),left:h(a)})}function u(a,b){L.width(a).height(b)}function v(){var a=ba.getFixed();ba.setPressed([a.x,a.y]),ba.setCurrent([a.x2,a.y2]),w()}function w(a){if(b)return x(a)}function x(a){var c=ba.getFixed();u(c.w,c.h),s(c.x,c.y),d.shade&&bb.updateRaw(c),b||A(),a?d.onSelect.call(bt,t(c)):d.onChange.call(bt,t(c))}function y(a,c,e){if(!b&&!c)return;d.bgFade&&!e?E.animate({opacity:a},{queue:!1,duration:d.fadeTime}):E.css("opacity",a)}function A(){L.show(),d.shade?bb.opacity(P):y(P,!0),b=!0}function B(){F(),L.hide(),d.shade?bb.opacity(1):y(1),b=!1,d.onRelease.call(bt)}function C(){j&&K.show()}function D(){j=!0;if(d.allowResize)return K.show(),!0}function F(){j=!1,K.hide(
|
||||
)}function G(a){Y===a?F():D()}function H(){G(!1),v()}var b,c=370,e={},f={},g={},j=!1;d.dragEdges&&a.isArray(d.createDragbars)&&o(d.createDragbars),a.isArray(d.createHandles)&&q(d.createHandles),d.drawBorders&&a.isArray(d.createBorders)&&p(d.createBorders),a(document).bind("touchstart.jcrop-ios",function(b){a(b.currentTarget).hasClass("jcrop-tracker")&&b.stopPropagation()});var M=z().mousedown(r("move")).css({cursor:"move",position:"absolute",zIndex:360});return _.support&&M.bind("touchstart.jcrop",_.createDragger("move")),J.append(M),F(),{updateVisible:w,update:x,release:B,refresh:v,isAwake:function(){return b},setCursor:function(a){M.css("cursor",a)},enableHandles:D,enableOnly:function(){j=!0},showHandles:C,disableHandles:F,animMode:G,setBgOpacity:y,done:H}}(),bd=function(){function f(){N.css({zIndex:450}),_.support&&a(document).bind("touchmove.jcrop",k).bind("touchend.jcrop",m),e&&a(document).bind("mousemove.jcrop",h).bind("mouseup.jcrop",i)}function g(){N.css({zIndex:290}),a(document).unbind(".jcrop")}function h
|
||||
(a){return b(l(a)),!1}function i(a){return a.preventDefault(),a.stopPropagation(),X&&(X=!1,c(l(a)),bc.isAwake()&&d.onSelect.call(bt,t(ba.getFixed())),g(),b=function(){},c=function(){}),!1}function j(a,d){return X=!0,b=a,c=d,f(),!1}function k(a){return a.pageX=a.originalEvent.changedTouches[0].pageX,a.pageY=a.originalEvent.changedTouches[0].pageY,h(a)}function m(a){return a.pageX=a.originalEvent.changedTouches[0].pageX,a.pageY=a.originalEvent.changedTouches[0].pageY,i(a)}function n(a){N.css("cursor",a)}var b=function(){},c=function(){},e=d.trackDocument;return e||N.mousemove(h).mouseup(i).mouseout(i),E.before(N),{activateHandlers:j,setCursor:n}}(),be=function(){function e(){d.keySupport&&(b.show(),b.focus())}function f(a){b.hide()}function h(a,b,c){d.allowMove&&(ba.moveOffset([b,c]),bc.updateVisible(!0)),a.preventDefault(),a.stopPropagation()}function i(a){if(a.ctrlKey||a.metaKey)return!0;Z=a.shiftKey?!0:!1;var b=Z?10:1;switch(a.keyCode){case 37:h(a,-b,0);break;case 39:h(a,b,0);break;case 38:h(a,0,-b);break;case 40
|
||||
:h(a,0,b);break;case 27:d.allowSelect&&bc.release();break;case 9:return!0}return!1}var b=a('<input type="radio" />').css({position:"fixed",left:"-120px",width:"12px"}),c=a("<div />").css({position:"absolute",overflow:"hidden"}).append(b);return d.keySupport&&(b.keydown(i).blur(f),g||!d.fixedSupport?(b.css({position:"absolute",left:"-20px"}),c.append(b).insertBefore(E)):b.insertBefore(E)),{watchKeys:e}}();_.support&&N.bind("touchstart.jcrop",_.newSelection),K.hide(),bs(!0);var bt={setImage:bq,animateTo:bg,setSelect:bh,setOptions:bl,tellSelect:bj,tellScaled:bk,setClass:bf,disable:bm,enable:bn,cancel:bo,release:bc.release,destroy:bp,focus:be.watchKeys,getBounds:function(){return[F*U,G*V]},getWidgetSize:function(){return[F,G]},getScaleFactor:function(){return[U,V]},getOptions:function(){return d},ui:{holder:H,selection:L}};return a.browser.msie&&H.bind("selectstart",function(){return!1}),B.data("Jcrop",bt),bt},a.fn.Jcrop=function(b,c){var d;return this.each(function(){if(a(this).data("Jcrop")){if(b==="api")return a
|
||||
(this).data("Jcrop");a(this).data("Jcrop").setOptions(b)}else this.tagName=="IMG"?a.Jcrop.Loader(this,function(){a(this).css({display:"block",visibility:"hidden"}),d=a.Jcrop(this,b),a.isFunction(c)&&c.call(d)}):(a(this).css({display:"block",visibility:"hidden"}),d=a.Jcrop(this,b),a.isFunction(c)&&c.call(d))}),this},a.Jcrop.Loader=function(b,c,d){function g(){f.complete?(e.unbind(".jcloader"),a.isFunction(c)&&c.call(f)):window.setTimeout(g,50)}var e=a(b),f=e[0];e.bind("load.jcloader",g).bind("error.jcloader",function(b){e.unbind(".jcloader"),a.isFunction(d)&&d.call(f)}),f.complete&&a.isFunction(c)&&(e.unbind(".jcloader"),c.call(f))},a.Jcrop.defaults={allowSelect:!0,allowMove:!0,allowResize:!0,trackDocument:!0,baseClass:"jcrop",addClass:null,bgColor:"black",bgOpacity:.6,bgFade:!1,borderOpacity:.4,handleOpacity:.5,handleSize:7,aspectRatio:0,keySupport:!0,createHandles:["n","s","e","w","nw","ne","se","sw"],createDragbars:["n","s","e","w"],createBorders:["n","s","e","w"],drawBorders:!0,dragEdges:!0,fixedSupport:!0,
|
||||
touchSupport:null,shade:null,boxWidth:0,boxHeight:0,boundary:2,fadeTime:400,animationDelay:20,swingSpeed:3,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){},onDblClick:function(){},onRelease:function(){}}})(jQuery);
|
||||
2
wp-includes/js/jquery/jquery.color.min.js
vendored
Normal file
2
wp-includes/js/jquery/jquery.color.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
825
wp-includes/js/jquery/jquery.form.js
Normal file
825
wp-includes/js/jquery/jquery.form.js
Normal file
@@ -0,0 +1,825 @@
|
||||
/*!
|
||||
* jQuery Form Plugin
|
||||
* version: 2.73 (03-MAY-2011)
|
||||
* @requires jQuery v1.3.2 or later
|
||||
*
|
||||
* Examples and documentation at: http://malsup.com/jquery/form/
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
;(function($) {
|
||||
|
||||
/*
|
||||
Usage Note:
|
||||
-----------
|
||||
Do not use both ajaxSubmit and ajaxForm on the same form. These
|
||||
functions are intended to be exclusive. Use ajaxSubmit if you want
|
||||
to bind your own submit handler to the form. For example,
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#myForm').bind('submit', function(e) {
|
||||
e.preventDefault(); // <-- important
|
||||
$(this).ajaxSubmit({
|
||||
target: '#output'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Use ajaxForm when you want the plugin to manage all the event binding
|
||||
for you. For example,
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#myForm').ajaxForm({
|
||||
target: '#output'
|
||||
});
|
||||
});
|
||||
|
||||
When using ajaxForm, the ajaxSubmit function will be invoked for you
|
||||
at the appropriate time.
|
||||
*/
|
||||
|
||||
/**
|
||||
* ajaxSubmit() provides a mechanism for immediately submitting
|
||||
* an HTML form using AJAX.
|
||||
*/
|
||||
$.fn.ajaxSubmit = function(options) {
|
||||
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
|
||||
if (!this.length) {
|
||||
log('ajaxSubmit: skipping submit process - no element selected');
|
||||
return this;
|
||||
}
|
||||
|
||||
if (typeof options == 'function') {
|
||||
options = { success: options };
|
||||
}
|
||||
|
||||
var action = this.attr('action');
|
||||
var url = (typeof action === 'string') ? $.trim(action) : '';
|
||||
if (url) {
|
||||
// clean url (don't include hash vaue)
|
||||
url = (url.match(/^([^#]+)/)||[])[1];
|
||||
}
|
||||
url = url || window.location.href || '';
|
||||
|
||||
options = $.extend(true, {
|
||||
url: url,
|
||||
success: $.ajaxSettings.success,
|
||||
type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57)
|
||||
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
|
||||
}, options);
|
||||
|
||||
// hook for manipulating the form data before it is extracted;
|
||||
// convenient for use with rich editors like tinyMCE or FCKEditor
|
||||
var veto = {};
|
||||
this.trigger('form-pre-serialize', [this, options, veto]);
|
||||
if (veto.veto) {
|
||||
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
|
||||
return this;
|
||||
}
|
||||
|
||||
// provide opportunity to alter form data before it is serialized
|
||||
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
|
||||
log('ajaxSubmit: submit aborted via beforeSerialize callback');
|
||||
return this;
|
||||
}
|
||||
|
||||
var n,v,a = this.formToArray(options.semantic);
|
||||
if (options.data) {
|
||||
options.extraData = options.data;
|
||||
for (n in options.data) {
|
||||
if(options.data[n] instanceof Array) {
|
||||
for (var k in options.data[n]) {
|
||||
a.push( { name: n, value: options.data[n][k] } );
|
||||
}
|
||||
}
|
||||
else {
|
||||
v = options.data[n];
|
||||
v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
|
||||
a.push( { name: n, value: v } );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// give pre-submit callback an opportunity to abort the submit
|
||||
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
|
||||
log('ajaxSubmit: submit aborted via beforeSubmit callback');
|
||||
return this;
|
||||
}
|
||||
|
||||
// fire vetoable 'validate' event
|
||||
this.trigger('form-submit-validate', [a, this, options, veto]);
|
||||
if (veto.veto) {
|
||||
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
|
||||
return this;
|
||||
}
|
||||
|
||||
var q = $.param(a);
|
||||
|
||||
if (options.type.toUpperCase() == 'GET') {
|
||||
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
||||
options.data = null; // data is null for 'get'
|
||||
}
|
||||
else {
|
||||
options.data = q; // data is the query string for 'post'
|
||||
}
|
||||
|
||||
var $form = this, callbacks = [];
|
||||
if (options.resetForm) {
|
||||
callbacks.push(function() { $form.resetForm(); });
|
||||
}
|
||||
if (options.clearForm) {
|
||||
callbacks.push(function() { $form.clearForm(); });
|
||||
}
|
||||
|
||||
// perform a load on the target only if dataType is not provided
|
||||
if (!options.dataType && options.target) {
|
||||
var oldSuccess = options.success || function(){};
|
||||
callbacks.push(function(data) {
|
||||
var fn = options.replaceTarget ? 'replaceWith' : 'html';
|
||||
$(options.target)[fn](data).each(oldSuccess, arguments);
|
||||
});
|
||||
}
|
||||
else if (options.success) {
|
||||
callbacks.push(options.success);
|
||||
}
|
||||
|
||||
options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
|
||||
var context = options.context || options; // jQuery 1.4+ supports scope context
|
||||
for (var i=0, max=callbacks.length; i < max; i++) {
|
||||
callbacks[i].apply(context, [data, status, xhr || $form, $form]);
|
||||
}
|
||||
};
|
||||
|
||||
// are there files to upload?
|
||||
var fileInputs = $('input:file', this).length > 0;
|
||||
var mp = 'multipart/form-data';
|
||||
var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
|
||||
|
||||
// options.iframe allows user to force iframe mode
|
||||
// 06-NOV-09: now defaulting to iframe mode if file input is detected
|
||||
if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
|
||||
// hack to fix Safari hang (thanks to Tim Molendijk for this)
|
||||
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
|
||||
if (options.closeKeepAlive) {
|
||||
$.get(options.closeKeepAlive, fileUpload);
|
||||
}
|
||||
else {
|
||||
fileUpload();
|
||||
}
|
||||
}
|
||||
else {
|
||||
$.ajax(options);
|
||||
}
|
||||
|
||||
// fire 'notify' event
|
||||
this.trigger('form-submit-notify', [this, options]);
|
||||
return this;
|
||||
|
||||
|
||||
// private function for handling file uploads (hat tip to YAHOO!)
|
||||
function fileUpload() {
|
||||
var form = $form[0];
|
||||
|
||||
if ($(':input[name=submit],:input[id=submit]', form).length) {
|
||||
// if there is an input with a name or id of 'submit' then we won't be
|
||||
// able to invoke the submit fn on the form (at least not x-browser)
|
||||
alert('Error: Form elements must not have name or id of "submit".');
|
||||
return;
|
||||
}
|
||||
|
||||
var s = $.extend(true, {}, $.ajaxSettings, options);
|
||||
s.context = s.context || s;
|
||||
var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
|
||||
var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ s.iframeSrc +'" />');
|
||||
var io = $io[0];
|
||||
|
||||
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
|
||||
|
||||
var xhr = { // mock object
|
||||
aborted: 0,
|
||||
responseText: null,
|
||||
responseXML: null,
|
||||
status: 0,
|
||||
statusText: 'n/a',
|
||||
getAllResponseHeaders: function() {},
|
||||
getResponseHeader: function() {},
|
||||
setRequestHeader: function() {},
|
||||
abort: function(status) {
|
||||
var e = (status === 'timeout' ? 'timeout' : 'aborted');
|
||||
log('aborting upload... ' + e);
|
||||
this.aborted = 1;
|
||||
$io.attr('src', s.iframeSrc); // abort op in progress
|
||||
xhr.error = e;
|
||||
s.error && s.error.call(s.context, xhr, e, e);
|
||||
g && $.event.trigger("ajaxError", [xhr, s, e]);
|
||||
s.complete && s.complete.call(s.context, xhr, e);
|
||||
}
|
||||
};
|
||||
|
||||
var g = s.global;
|
||||
// trigger ajax global events so that activity/block indicators work like normal
|
||||
if (g && ! $.active++) {
|
||||
$.event.trigger("ajaxStart");
|
||||
}
|
||||
if (g) {
|
||||
$.event.trigger("ajaxSend", [xhr, s]);
|
||||
}
|
||||
|
||||
if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
|
||||
if (s.global) {
|
||||
$.active--;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (xhr.aborted) {
|
||||
return;
|
||||
}
|
||||
|
||||
var timedOut = 0, timeoutHandle;
|
||||
|
||||
// add submitting element to data if we know it
|
||||
var sub = form.clk;
|
||||
if (sub) {
|
||||
var n = sub.name;
|
||||
if (n && !sub.disabled) {
|
||||
s.extraData = s.extraData || {};
|
||||
s.extraData[n] = sub.value;
|
||||
if (sub.type == "image") {
|
||||
s.extraData[n+'.x'] = form.clk_x;
|
||||
s.extraData[n+'.y'] = form.clk_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// take a breath so that pending repaints get some cpu time before the upload starts
|
||||
function doSubmit() {
|
||||
// make sure form attrs are set
|
||||
var t = $form.attr('target'), a = $form.attr('action');
|
||||
|
||||
// update form attrs in IE friendly way
|
||||
form.setAttribute('target',id);
|
||||
if (form.getAttribute('method') != 'POST') {
|
||||
form.setAttribute('method', 'POST');
|
||||
}
|
||||
if (form.getAttribute('action') != s.url) {
|
||||
form.setAttribute('action', s.url);
|
||||
}
|
||||
|
||||
// ie borks in some cases when setting encoding
|
||||
if (! s.skipEncodingOverride) {
|
||||
$form.attr({
|
||||
encoding: 'multipart/form-data',
|
||||
enctype: 'multipart/form-data'
|
||||
});
|
||||
}
|
||||
|
||||
// support timout
|
||||
if (s.timeout) {
|
||||
timeoutHandle = setTimeout(function() { timedOut = true; cb(true); }, s.timeout);
|
||||
}
|
||||
|
||||
// add "extra" data to form if provided in options
|
||||
var extraInputs = [];
|
||||
try {
|
||||
if (s.extraData) {
|
||||
for (var n in s.extraData) {
|
||||
extraInputs.push(
|
||||
$('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />')
|
||||
.appendTo(form)[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// add iframe to doc and submit the form
|
||||
$io.appendTo('body');
|
||||
io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
|
||||
form.submit();
|
||||
}
|
||||
finally {
|
||||
// reset attrs and remove "extra" input elements
|
||||
form.setAttribute('action',a);
|
||||
if(t) {
|
||||
form.setAttribute('target', t);
|
||||
} else {
|
||||
$form.removeAttr('target');
|
||||
}
|
||||
$(extraInputs).remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (s.forceSync) {
|
||||
doSubmit();
|
||||
}
|
||||
else {
|
||||
setTimeout(doSubmit, 10); // this lets dom updates render
|
||||
}
|
||||
|
||||
var data, doc, domCheckCount = 50, callbackProcessed;
|
||||
|
||||
function cb(e) {
|
||||
if (xhr.aborted || callbackProcessed) {
|
||||
return;
|
||||
}
|
||||
if (e === true && xhr) {
|
||||
xhr.abort('timeout');
|
||||
return;
|
||||
}
|
||||
|
||||
var doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
|
||||
if (!doc || doc.location.href == s.iframeSrc) {
|
||||
// response not received yet
|
||||
if (!timedOut)
|
||||
return;
|
||||
}
|
||||
io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
|
||||
|
||||
var ok = true;
|
||||
try {
|
||||
if (timedOut) {
|
||||
throw 'timeout';
|
||||
}
|
||||
|
||||
var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
|
||||
log('isXml='+isXml);
|
||||
if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
|
||||
if (--domCheckCount) {
|
||||
// in some browsers (Opera) the iframe DOM is not always traversable when
|
||||
// the onload callback fires, so we loop a bit to accommodate
|
||||
log('requeing onLoad callback, DOM not available');
|
||||
setTimeout(cb, 250);
|
||||
return;
|
||||
}
|
||||
// let this fall through because server response could be an empty document
|
||||
//log('Could not access iframe DOM after mutiple tries.');
|
||||
//throw 'DOMException: not available';
|
||||
}
|
||||
|
||||
//log('response detected');
|
||||
xhr.responseText = doc.body ? doc.body.innerHTML : doc.documentElement ? doc.documentElement.innerHTML : null;
|
||||
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
||||
if (isXml)
|
||||
s.dataType = 'xml';
|
||||
xhr.getResponseHeader = function(header){
|
||||
var headers = {'content-type': s.dataType};
|
||||
return headers[header];
|
||||
};
|
||||
|
||||
var scr = /(json|script|text)/.test(s.dataType);
|
||||
if (scr || s.textarea) {
|
||||
// see if user embedded response in textarea
|
||||
var ta = doc.getElementsByTagName('textarea')[0];
|
||||
if (ta) {
|
||||
xhr.responseText = ta.value;
|
||||
}
|
||||
else if (scr) {
|
||||
// account for browsers injecting pre around json response
|
||||
var pre = doc.getElementsByTagName('pre')[0];
|
||||
var b = doc.getElementsByTagName('body')[0];
|
||||
if (pre) {
|
||||
xhr.responseText = pre.textContent;
|
||||
}
|
||||
else if (b) {
|
||||
xhr.responseText = b.innerHTML;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
|
||||
xhr.responseXML = toXml(xhr.responseText);
|
||||
}
|
||||
|
||||
data = httpData(xhr, s.dataType, s);
|
||||
}
|
||||
catch(e){
|
||||
log('error caught:',e);
|
||||
ok = false;
|
||||
xhr.error = e;
|
||||
s.error && s.error.call(s.context, xhr, 'error', e);
|
||||
g && $.event.trigger("ajaxError", [xhr, s, e]);
|
||||
}
|
||||
|
||||
if (xhr.aborted) {
|
||||
log('upload aborted');
|
||||
ok = false;
|
||||
}
|
||||
|
||||
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
|
||||
if (ok) {
|
||||
s.success && s.success.call(s.context, data, 'success', xhr);
|
||||
g && $.event.trigger("ajaxSuccess", [xhr, s]);
|
||||
}
|
||||
|
||||
g && $.event.trigger("ajaxComplete", [xhr, s]);
|
||||
|
||||
if (g && ! --$.active) {
|
||||
$.event.trigger("ajaxStop");
|
||||
}
|
||||
|
||||
s.complete && s.complete.call(s.context, xhr, ok ? 'success' : 'error');
|
||||
|
||||
callbackProcessed = true;
|
||||
if (s.timeout)
|
||||
clearTimeout(timeoutHandle);
|
||||
|
||||
// clean up
|
||||
setTimeout(function() {
|
||||
$io.removeData('form-plugin-onload');
|
||||
$io.remove();
|
||||
xhr.responseXML = null;
|
||||
}, 100);
|
||||
}
|
||||
|
||||
var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
|
||||
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.nodeName != 'parsererror') ? doc : null;
|
||||
};
|
||||
var parseJSON = $.parseJSON || function(s) {
|
||||
return window['eval']('(' + s + ')');
|
||||
};
|
||||
|
||||
var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
|
||||
var ct = xhr.getResponseHeader('content-type') || '',
|
||||
xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
|
||||
data = xml ? xhr.responseXML : xhr.responseText;
|
||||
|
||||
if (xml && data.documentElement.nodeName === 'parsererror') {
|
||||
$.error && $.error('parsererror');
|
||||
}
|
||||
if (s && s.dataFilter) {
|
||||
data = s.dataFilter(data, type);
|
||||
}
|
||||
if (typeof data === 'string') {
|
||||
if (type === 'json' || !type && ct.indexOf('json') >= 0) {
|
||||
data = parseJSON(data);
|
||||
} else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
|
||||
$.globalEval(data);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* ajaxForm() provides a mechanism for fully automating form submission.
|
||||
*
|
||||
* The advantages of using this method instead of ajaxSubmit() are:
|
||||
*
|
||||
* 1: This method will include coordinates for <input type="image" /> elements (if the element
|
||||
* is used to submit the form).
|
||||
* 2. This method will include the submit element's name/value data (for the element that was
|
||||
* used to submit the form).
|
||||
* 3. This method binds the submit() method to the form for you.
|
||||
*
|
||||
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
|
||||
* passes the options argument along after properly binding events for submit elements and
|
||||
* the form itself.
|
||||
*/
|
||||
$.fn.ajaxForm = function(options) {
|
||||
// in jQuery 1.3+ we can fix mistakes with the ready state
|
||||
if (this.length === 0) {
|
||||
var o = { s: this.selector, c: this.context };
|
||||
if (!$.isReady && o.s) {
|
||||
log('DOM not ready, queuing ajaxForm');
|
||||
$(function() {
|
||||
$(o.s,o.c).ajaxForm(options);
|
||||
});
|
||||
return this;
|
||||
}
|
||||
// is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
|
||||
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
|
||||
return this;
|
||||
}
|
||||
|
||||
return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
|
||||
if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
|
||||
e.preventDefault();
|
||||
$(this).ajaxSubmit(options);
|
||||
}
|
||||
}).bind('click.form-plugin', function(e) {
|
||||
var target = e.target;
|
||||
var $el = $(target);
|
||||
if (!($el.is(":submit,input:image"))) {
|
||||
// is this a child element of the submit el? (ex: a span within a button)
|
||||
var t = $el.closest(':submit');
|
||||
if (t.length == 0) {
|
||||
return;
|
||||
}
|
||||
target = t[0];
|
||||
}
|
||||
var form = this;
|
||||
form.clk = target;
|
||||
if (target.type == 'image') {
|
||||
if (e.offsetX != undefined) {
|
||||
form.clk_x = e.offsetX;
|
||||
form.clk_y = e.offsetY;
|
||||
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
|
||||
var offset = $el.offset();
|
||||
form.clk_x = e.pageX - offset.left;
|
||||
form.clk_y = e.pageY - offset.top;
|
||||
} else {
|
||||
form.clk_x = e.pageX - target.offsetLeft;
|
||||
form.clk_y = e.pageY - target.offsetTop;
|
||||
}
|
||||
}
|
||||
// clear form vars
|
||||
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
|
||||
});
|
||||
};
|
||||
|
||||
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
|
||||
$.fn.ajaxFormUnbind = function() {
|
||||
return this.unbind('submit.form-plugin click.form-plugin');
|
||||
};
|
||||
|
||||
/**
|
||||
* formToArray() gathers form element data into an array of objects that can
|
||||
* be passed to any of the following ajax functions: $.get, $.post, or load.
|
||||
* Each object in the array has both a 'name' and 'value' property. An example of
|
||||
* an array for a simple login form might be:
|
||||
*
|
||||
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
||||
*
|
||||
* It is this array that is passed to pre-submit callback functions provided to the
|
||||
* ajaxSubmit() and ajaxForm() methods.
|
||||
*/
|
||||
$.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;
|
||||
}
|
||||
|
||||
var i,j,n,v,el,max,jmax;
|
||||
for(i=0, max=els.length; i < max; i++) {
|
||||
el = els[i];
|
||||
n = el.name;
|
||||
if (!n) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (semantic && form.clk && el.type == "image") {
|
||||
// handle image inputs on the fly when semantic == true
|
||||
if(!el.disabled && form.clk == el) {
|
||||
a.push({name: n, value: $(el).val()});
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
v = $.fieldValue(el, true);
|
||||
if (v && v.constructor == Array) {
|
||||
for(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) {
|
||||
// input type=='image' are not found in elements array! handle it here
|
||||
var $input = $(form.clk), input = $input[0];
|
||||
n = input.name;
|
||||
if (n && !input.disabled && input.type == 'image') {
|
||||
a.push({name: n, value: $input.val()});
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
}
|
||||
}
|
||||
return a;
|
||||
};
|
||||
|
||||
/**
|
||||
* Serializes form data into a 'submittable' string. This method will return a string
|
||||
* in the format: name1=value1&name2=value2
|
||||
*/
|
||||
$.fn.formSerialize = function(semantic) {
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(this.formToArray(semantic));
|
||||
};
|
||||
|
||||
/**
|
||||
* Serializes all field elements in the jQuery object into a query string.
|
||||
* This method will return a string in the format: name1=value1&name2=value2
|
||||
*/
|
||||
$.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});
|
||||
}
|
||||
});
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(a);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value(s) of the element in the matched set. For example, consider the following form:
|
||||
*
|
||||
* <form><fieldset>
|
||||
* <input name="A" type="text" />
|
||||
* <input name="A" type="text" />
|
||||
* <input name="B" type="checkbox" value="B1" />
|
||||
* <input name="B" type="checkbox" value="B2"/>
|
||||
* <input name="C" type="radio" value="C1" />
|
||||
* <input name="C" type="radio" value="C2" />
|
||||
* </fieldset></form>
|
||||
*
|
||||
* var v = $(':text').fieldValue();
|
||||
* // if no values are entered into the text inputs
|
||||
* v == ['','']
|
||||
* // if values entered into the text inputs are 'foo' and 'bar'
|
||||
* v == ['foo','bar']
|
||||
*
|
||||
* var v = $(':checkbox').fieldValue();
|
||||
* // if neither checkbox is checked
|
||||
* v === undefined
|
||||
* // if both checkboxes are checked
|
||||
* v == ['B1', 'B2']
|
||||
*
|
||||
* var v = $(':radio').fieldValue();
|
||||
* // if neither radio is checked
|
||||
* v === undefined
|
||||
* // if first radio is checked
|
||||
* v == ['C1']
|
||||
*
|
||||
* The successful argument controls whether or not the field element must be 'successful'
|
||||
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
||||
* The default value of the successful argument is true. If this value is false the value(s)
|
||||
* for each element is returned.
|
||||
*
|
||||
* Note: This method *always* returns an array. If no valid value can be determined the
|
||||
* array will be empty, otherwise it will contain one or more values.
|
||||
*/
|
||||
$.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;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value of the field element.
|
||||
*/
|
||||
$.fieldValue = function(el, successful) {
|
||||
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
|
||||
if (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 = op.value;
|
||||
if (!v) { // extra pain for IE...
|
||||
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
|
||||
}
|
||||
if (one) {
|
||||
return v;
|
||||
}
|
||||
a.push(v);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return $(el).val();
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the form data. Takes the following actions on the form's input fields:
|
||||
* - input text fields will have their 'value' property set to the empty string
|
||||
* - select elements will have their 'selectedIndex' property set to -1
|
||||
* - checkbox and radio inputs will have their 'checked' property set to false
|
||||
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
||||
* - button elements will *not* be effected
|
||||
*/
|
||||
$.fn.clearForm = function() {
|
||||
return this.each(function() {
|
||||
$('input,select,textarea', this).clearFields();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the selected form elements.
|
||||
*/
|
||||
$.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;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Resets the form data. Causes all form elements to be reset to their original value.
|
||||
*/
|
||||
$.fn.resetForm = function() {
|
||||
return this.each(function() {
|
||||
// guard against an input with the name of 'reset'
|
||||
// note that IE reports the reset function as an 'object'
|
||||
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
|
||||
this.reset();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Enables or disables any matching elements.
|
||||
*/
|
||||
$.fn.enable = function(b) {
|
||||
if (b === undefined) {
|
||||
b = true;
|
||||
}
|
||||
return this.each(function() {
|
||||
this.disabled = !b;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks/unchecks any matching checkboxes or radio buttons and
|
||||
* selects/deselects and matching option elements.
|
||||
*/
|
||||
$.fn.selected = 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') {
|
||||
// deselect all other options
|
||||
$sel.find('option').selected(false);
|
||||
}
|
||||
this.selected = select;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// helper fn for console logging
|
||||
// set $.fn.ajaxSubmit.debug to true to enable debug logging
|
||||
function log() {
|
||||
if ($.fn.ajaxSubmit.debug) {
|
||||
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
|
||||
if (window.console && window.console.log) {
|
||||
window.console.log(msg);
|
||||
}
|
||||
else if (window.opera && window.opera.postError) {
|
||||
window.opera.postError(msg);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
11
wp-includes/js/jquery/jquery.form.min.js
vendored
Normal file
11
wp-includes/js/jquery/jquery.form.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
131
wp-includes/js/jquery/jquery.hotkeys.js
Normal file
131
wp-includes/js/jquery/jquery.hotkeys.js
Normal file
@@ -0,0 +1,131 @@
|
||||
/******************************************************************************************************************************
|
||||
|
||||
* @ Original idea by by Binny V A, Original version: 2.00.A
|
||||
* @ http://www.openjs.com/scripts/events/keyboard_shortcuts/
|
||||
* @ Original License : BSD
|
||||
|
||||
* @ jQuery Plugin by Tzury Bar Yochay
|
||||
mail: tzury.by@gmail.com
|
||||
blog: evalinux.wordpress.com
|
||||
face: facebook.com/profile.php?id=513676303
|
||||
|
||||
(c) Copyrights 2007
|
||||
|
||||
* @ jQuery Plugin version Beta (0.0.2)
|
||||
* @ License: jQuery-License.
|
||||
|
||||
TODO:
|
||||
add queue support (as in gmail) e.g. 'x' then 'y', etc.
|
||||
add mouse + mouse wheel events.
|
||||
|
||||
USAGE:
|
||||
$.hotkeys.add('Ctrl+c', function(){ alert('copy anyone?');});
|
||||
$.hotkeys.add('Ctrl+c', {target:'div#editor', type:'keyup', propagate: true},function(){ alert('copy anyone?');});>
|
||||
$.hotkeys.remove('Ctrl+c');
|
||||
$.hotkeys.remove('Ctrl+c', {target:'div#editor', type:'keypress'});
|
||||
|
||||
******************************************************************************************************************************/
|
||||
(function (jQuery){
|
||||
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(combi, options, callback) {
|
||||
if (jQuery.isFunction(options)){
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
var opt = {},
|
||||
defaults = {type: 'keydown', propagate: false, disableInInput: false, target: jQuery('html')[0]},
|
||||
that = this;
|
||||
opt = jQuery.extend( opt , defaults, options || {} );
|
||||
combi = combi.toLowerCase();
|
||||
|
||||
// inspect if keystroke matches
|
||||
var inspector = function(event) {
|
||||
// WP: not needed with newer jQuery
|
||||
// event = jQuery.event.fix(event); // jQuery event normalization.
|
||||
var element = event.target;
|
||||
// @ TextNode -> nodeType == 3
|
||||
// WP: not needed with newer jQuery
|
||||
// element = (element.nodeType==3) ? element.parentNode : element;
|
||||
|
||||
if(opt['disableInInput']) { // Disable shortcut keys in Input, Textarea fields
|
||||
var target = jQuery(element);
|
||||
if( target.is("input") || target.is("textarea")){
|
||||
return;
|
||||
}
|
||||
}
|
||||
var code = event.which,
|
||||
type = event.type,
|
||||
character = String.fromCharCode(code).toLowerCase(),
|
||||
special = that.special_keys[code],
|
||||
shift = event.shiftKey,
|
||||
ctrl = event.ctrlKey,
|
||||
alt= event.altKey,
|
||||
meta = event.metaKey,
|
||||
propagate = true, // default behaivour
|
||||
mapPoint = null;
|
||||
|
||||
// in opera + safari, the event.target is unpredictable.
|
||||
// for example: 'keydown' might be associated with HtmlBodyElement
|
||||
// or the element where you last clicked with your mouse.
|
||||
// WP: needed for all browsers
|
||||
// if (jQuery.browser.opera || jQuery.browser.safari){
|
||||
while (!that.all[element] && element.parentNode){
|
||||
element = element.parentNode;
|
||||
}
|
||||
// }
|
||||
var cbMap = that.all[element].events[type].callbackMap;
|
||||
if(!shift && !ctrl && !alt && !meta) { // No Modifiers
|
||||
mapPoint = cbMap[special] || cbMap[character]
|
||||
}
|
||||
// deals with combinaitons (alt|ctrl|shift+anything)
|
||||
else{
|
||||
var modif = '';
|
||||
if(alt) modif +='alt+';
|
||||
if(ctrl) modif+= 'ctrl+';
|
||||
if(shift) modif += 'shift+';
|
||||
if(meta) modif += 'meta+';
|
||||
// modifiers + special keys or modifiers + characters or modifiers + shift characters
|
||||
mapPoint = cbMap[modif+special] || cbMap[modif+character] || cbMap[modif+that.shift_nums[character]]
|
||||
}
|
||||
if (mapPoint){
|
||||
mapPoint.cb(event);
|
||||
if(!mapPoint.propagate) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
// first hook for this element
|
||||
if (!this.all[opt.target]){
|
||||
this.all[opt.target] = {events:{}};
|
||||
}
|
||||
if (!this.all[opt.target].events[opt.type]){
|
||||
this.all[opt.target].events[opt.type] = {callbackMap: {}}
|
||||
jQuery.event.add(opt.target, opt.type, inspector);
|
||||
}
|
||||
this.all[opt.target].events[opt.type].callbackMap[combi] = {cb: callback, propagate:opt.propagate};
|
||||
return jQuery;
|
||||
};
|
||||
this.remove = function(exp, opt) {
|
||||
opt = opt || {};
|
||||
target = opt.target || jQuery('html')[0];
|
||||
type = opt.type || 'keydown';
|
||||
exp = exp.toLowerCase();
|
||||
delete this.all[target].events[type].callbackMap[exp]
|
||||
return jQuery;
|
||||
};
|
||||
jQuery.hotkeys = this;
|
||||
return jQuery;
|
||||
})(jQuery);
|
||||
1
wp-includes/js/jquery/jquery.hotkeys.min.js
vendored
Normal file
1
wp-includes/js/jquery/jquery.hotkeys.min.js
vendored
Normal file
@@ -0,0 +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){var o=j.target;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;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);
|
||||
3
wp-includes/js/jquery/jquery.js
vendored
Normal file
3
wp-includes/js/jquery/jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10
wp-includes/js/jquery/jquery.masonry.min.js
vendored
Normal file
10
wp-includes/js/jquery/jquery.masonry.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
11
wp-includes/js/jquery/jquery.query.js
Normal file
11
wp-includes/js/jquery/jquery.query.js
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* jQuery.query - Query String Modification and Creation for jQuery
|
||||
* Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
|
||||
* Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
|
||||
* Date: 2009/8/13
|
||||
*
|
||||
* @author Blair Mitchelmore
|
||||
* @version 2.1.7
|
||||
*
|
||||
**/
|
||||
new function(e){var d=e.separator||"&";var c=e.spaces===false?false:true;var a=e.suffix===false?"":"[]";var g=e.prefix===false?false:true;var b=g?e.hash===true?"#":"?":"";var f=e.numbers===false?false:true;jQuery.query=new function(){var h=function(m,l){return m!=undefined&&m!==null&&(!!l?m.constructor==l:true)};var i=function(r){var l,q=/\[([^[]*)\]/g,n=/^([^[]+)(\[.*\])?$/.exec(r),o=n[1],p=[];while(l=q.exec(n[2])){p.push(l[1])}return[o,p]};var k=function(s,r,q){var t,p=r.shift();if(typeof s!="object"){s=null}if(p===""){if(!s){s=[]}if(h(s,Array)){s.push(r.length==0?q:k(null,r.slice(0),q))}else{if(h(s,Object)){var n=0;while(s[n++]!=null){}s[--n]=r.length==0?q:k(s[n],r.slice(0),q)}else{s=[];s.push(r.length==0?q:k(null,r.slice(0),q))}}}else{if(p&&p.match(/^\s*[0-9]+\s*$/)){var m=parseInt(p,10);if(!s){s=[]}s[m]=r.length==0?q:k(s[m],r.slice(0),q)}else{if(p){var m=p.replace(/^\s*|\s*$/g,"");if(!s){s={}}if(h(s,Array)){var l={};for(var n=0;n<s.length;++n){l[n]=s[n]}s=l}s[m]=r.length==0?q:k(s[m],r.slice(0),q)}else{return q}}}return s};var j=function(l){var m=this;m.keys={};if(l.queryObject){jQuery.each(l.get(),function(n,o){m.SET(n,o)})}else{jQuery.each(arguments,function(){var n=""+this;n=n.replace(/^[?#]/,"");n=n.replace(/[;&]$/,"");if(c){n=n.replace(/[+]/g," ")}jQuery.each(n.split(/[&;]/),function(){var o=decodeURIComponent(this.split("=")[0]||"");var p=decodeURIComponent(this.split("=")[1]||"");if(!o){return}if(f){if(/^[+-]?[0-9]+\.[0-9]*$/.test(p)){p=parseFloat(p)}else{if(/^[+-]?[0-9]+$/.test(p)){p=parseInt(p,10)}}}p=(!p&&p!==0)?true:p;if(p!==false&&p!==true&&typeof p!="number"){p=p}m.SET(o,p)})})}return m};j.prototype={queryObject:true,has:function(l,m){var n=this.get(l);return h(n,m)},GET:function(m){if(!h(m)){return this.keys}var l=i(m),n=l[0],p=l[1];var o=this.keys[n];while(o!=null&&p.length!=0){o=o[p.shift()]}return typeof o=="number"?o:o||""},get:function(l){var m=this.GET(l);if(h(m,Object)){return jQuery.extend(true,{},m)}else{if(h(m,Array)){return m.slice(0)}}return m},SET:function(m,r){var o=!h(r)?null:r;var l=i(m),n=l[0],q=l[1];var p=this.keys[n];this.keys[n]=k(p,q.slice(0),o);return this},set:function(l,m){return this.copy().SET(l,m)},REMOVE:function(l){return this.SET(l,null).COMPACT()},remove:function(l){return this.copy().REMOVE(l)},EMPTY:function(){var l=this;jQuery.each(l.keys,function(m,n){delete l.keys[m]});return l},load:function(l){var n=l.replace(/^.*?[#](.+?)(?:\?.+)?$/,"$1");var m=l.replace(/^.*?[?](.+?)(?:#.+)?$/,"$1");return new j(l.length==m.length?"":m,l.length==n.length?"":n)},empty:function(){return this.copy().EMPTY()},copy:function(){return new j(this)},COMPACT:function(){function l(o){var n=typeof o=="object"?h(o,Array)?[]:{}:o;if(typeof o=="object"){function m(r,p,q){if(h(r,Array)){r.push(q)}else{r[p]=q}}jQuery.each(o,function(p,q){if(!h(q)){return true}m(n,p,l(q))})}return n}this.keys=l(this.keys);return this},compact:function(){return this.copy().COMPACT()},toString:function(){var n=0,r=[],q=[],m=this;var o=function(s){s=s+"";if(c){s=s.replace(/ /g,"+")}return encodeURIComponent(s)};var l=function(s,t,u){if(!h(u)||u===false){return}var v=[o(t)];if(u!==true){v.push("=");v.push(o(u))}s.push(v.join(""))};var p=function(t,s){var u=function(v){return !s||s==""?[v].join(""):[s,"[",v,"]"].join("")};jQuery.each(t,function(v,w){if(typeof w=="object"){p(w,u(v))}else{l(q,u(v),w)}})};p(this.keys);if(q.length>0){r.push(b)}r.push(q.join(d));return r.join("")}};return new j(location.search,location.hash)}}(jQuery.query||{});
|
||||
36
wp-includes/js/jquery/jquery.schedule.js
Normal file
36
wp-includes/js/jquery/jquery.schedule.js
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
(function($){$.scheduler=function(){this.bucket={};return;};$.scheduler.prototype={schedule:function(){var ctx={"id":null,"time":1000,"repeat":false,"protect":false,"obj":null,"func":function(){},"args":[]};function _isfn(fn){return(!!fn&&typeof fn!="string"&&typeof fn[0]=="undefined"&&RegExp("function","i").test(fn+""));};var i=0;var override=false;if(typeof arguments[i]=="object"&&arguments.length>1){override=true;i++;}
|
||||
if(typeof arguments[i]=="object"){for(var option in arguments[i])
|
||||
if(typeof ctx[option]!="undefined")
|
||||
ctx[option]=arguments[i][option];i++;}
|
||||
if(typeof arguments[i]=="number"||(typeof arguments[i]=="string"&&arguments[i].match(RegExp("^[0-9]+[smhdw]$"))))
|
||||
ctx["time"]=arguments[i++];if(typeof arguments[i]=="boolean")
|
||||
ctx["repeat"]=arguments[i++];if(typeof arguments[i]=="boolean")
|
||||
ctx["protect"]=arguments[i++];if(typeof arguments[i]=="object"&&typeof arguments[i+1]=="string"&&_isfn(arguments[i][arguments[i+1]])){ctx["obj"]=arguments[i++];ctx["func"]=arguments[i++];}
|
||||
else if(typeof arguments[i]!="undefined"&&(_isfn(arguments[i])||typeof arguments[i]=="string"))
|
||||
ctx["func"]=arguments[i++];while(typeof arguments[i]!="undefined")
|
||||
ctx["args"].push(arguments[i++]);if(override){if(typeof arguments[1]=="object"){for(var option in arguments[0])
|
||||
if(typeof ctx[option]!="undefined"&&typeof arguments[1][option]=="undefined")
|
||||
ctx[option]=arguments[0][option];}
|
||||
else{for(var option in arguments[0])
|
||||
if(typeof ctx[option]!="undefined")
|
||||
ctx[option]=arguments[0][option];}
|
||||
i++;}
|
||||
ctx["_scheduler"]=this;ctx["_handle"]=null;var match=String(ctx["time"]).match(RegExp("^([0-9]+)([smhdw])$"));if(match&&match[0]!="undefined"&&match[1]!="undefined")
|
||||
ctx["time"]=String(parseInt(match[1])*{s:1000,m:1000*60,h:1000*60*60,d:1000*60*60*24,w:1000*60*60*24*7}[match[2]]);if(ctx["id"]==null)
|
||||
ctx["id"]=(String(ctx["repeat"])+":"
|
||||
+String(ctx["protect"])+":"
|
||||
+String(ctx["time"])+":"
|
||||
+String(ctx["obj"])+":"
|
||||
+String(ctx["func"])+":"
|
||||
+String(ctx["args"]));if(ctx["protect"])
|
||||
if(typeof this.bucket[ctx["id"]]!="undefined")
|
||||
return this.bucket[ctx["id"]];if(!_isfn(ctx["func"])){if(ctx["obj"]!=null&&typeof ctx["obj"]=="object"&&typeof ctx["func"]=="string"&&_isfn(ctx["obj"][ctx["func"]]))
|
||||
ctx["func"]=ctx["obj"][ctx["func"]];else
|
||||
ctx["func"]=eval("function () { "+ctx["func"]+" }");}
|
||||
ctx["_handle"]=this._schedule(ctx);this.bucket[ctx["id"]]=ctx;return ctx;},reschedule:function(ctx){if(typeof ctx=="string")
|
||||
ctx=this.bucket[ctx];ctx["_handle"]=this._schedule(ctx);return ctx;},_schedule:function(ctx){var trampoline=function(){var obj=(ctx["obj"]!=null?ctx["obj"]:ctx);(ctx["func"]).apply(obj,ctx["args"]);if(typeof(ctx["_scheduler"]).bucket[ctx["id"]]!="undefined"&&ctx["repeat"])
|
||||
(ctx["_scheduler"])._schedule(ctx);else
|
||||
delete(ctx["_scheduler"]).bucket[ctx["id"]];};return setTimeout(trampoline,ctx["time"]);},cancel:function(ctx){if(typeof ctx=="string")
|
||||
ctx=this.bucket[ctx];if(typeof ctx=="object"){clearTimeout(ctx["_handle"]);delete this.bucket[ctx["id"]];}}};$.extend({scheduler$:new $.scheduler(),schedule:function(){return $.scheduler$.schedule.apply($.scheduler$,arguments)},reschedule:function(){return $.scheduler$.reschedule.apply($.scheduler$,arguments)},cancel:function(){return $.scheduler$.cancel.apply($.scheduler$,arguments)}});$.fn.extend({schedule:function(){var a=[{}];for(var i=0;i<arguments.length;i++)
|
||||
a.push(arguments[i]);return this.each(function(){a[0]={"id":this,"obj":this};return $.schedule.apply($,a);});}});})(jQuery);
|
||||
31
wp-includes/js/jquery/jquery.serialize-object.js
Normal file
31
wp-includes/js/jquery/jquery.serialize-object.js
Normal file
@@ -0,0 +1,31 @@
|
||||
/*!
|
||||
* jQuery serializeObject - v0.2 - 1/20/2010
|
||||
* http://benalman.com/projects/jquery-misc-plugins/
|
||||
*
|
||||
* Copyright (c) 2010 "Cowboy" Ben Alman
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://benalman.com/about/license/
|
||||
*/
|
||||
|
||||
// Whereas .serializeArray() serializes a form into an array, .serializeObject()
|
||||
// serializes a form into an (arguably more useful) object.
|
||||
|
||||
(function($,undefined){
|
||||
'$:nomunge'; // Used by YUI compressor.
|
||||
|
||||
$.fn.serializeObject = function(){
|
||||
var obj = {};
|
||||
|
||||
$.each( this.serializeArray(), function(i,o){
|
||||
var n = o.name,
|
||||
v = o.value;
|
||||
|
||||
obj[n] = obj[n] === undefined ? v
|
||||
: $.isArray( obj[n] ) ? obj[n].concat( v )
|
||||
: [ obj[n], v ];
|
||||
});
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
99
wp-includes/js/jquery/jquery.table-hotkeys.js
Normal file
99
wp-includes/js/jquery/jquery.table-hotkeys.js
Normal file
@@ -0,0 +1,99 @@
|
||||
(function($){
|
||||
$.fn.filter_visible = function(depth) {
|
||||
depth = depth || 3;
|
||||
var is_visible = function() {
|
||||
var p = $(this), i;
|
||||
for(i=0; i<depth-1; ++i) {
|
||||
if (!p.is(':visible')) return false;
|
||||
p = p.parent();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return this.filter(is_visible);
|
||||
};
|
||||
$.table_hotkeys = function(table, keys, opts) {
|
||||
opts = $.extend($.table_hotkeys.defaults, opts);
|
||||
var selected_class, destructive_class, set_current_row, adjacent_row_callback, get_adjacent_row, adjacent_row, prev_row, next_row, check, get_first_row, get_last_row, make_key_callback, first_row;
|
||||
|
||||
selected_class = opts.class_prefix + opts.selected_suffix;
|
||||
destructive_class = opts.class_prefix + opts.destructive_suffix
|
||||
set_current_row = function (tr) {
|
||||
if ($.table_hotkeys.current_row) $.table_hotkeys.current_row.removeClass(selected_class);
|
||||
tr.addClass(selected_class);
|
||||
tr[0].scrollIntoView(false);
|
||||
$.table_hotkeys.current_row = tr;
|
||||
};
|
||||
adjacent_row_callback = function(which) {
|
||||
if (!adjacent_row(which) && $.isFunction(opts[which+'_page_link_cb'])) {
|
||||
opts[which+'_page_link_cb']();
|
||||
}
|
||||
};
|
||||
get_adjacent_row = function(which) {
|
||||
var first_row, method;
|
||||
|
||||
if (!$.table_hotkeys.current_row) {
|
||||
first_row = get_first_row();
|
||||
$.table_hotkeys.current_row = first_row;
|
||||
return first_row[0];
|
||||
}
|
||||
method = 'prev' == which? $.fn.prevAll : $.fn.nextAll;
|
||||
return method.call($.table_hotkeys.current_row, opts.cycle_expr).filter_visible()[0];
|
||||
};
|
||||
adjacent_row = function(which) {
|
||||
var adj = get_adjacent_row(which);
|
||||
if (!adj) return false;
|
||||
set_current_row($(adj));
|
||||
return true;
|
||||
};
|
||||
prev_row = function() { return adjacent_row('prev'); };
|
||||
next_row = function() { return adjacent_row('next'); };
|
||||
check = function() {
|
||||
$(opts.checkbox_expr, $.table_hotkeys.current_row).each(function() {
|
||||
this.checked = !this.checked;
|
||||
});
|
||||
};
|
||||
get_first_row = function() {
|
||||
return $(opts.cycle_expr, table).filter_visible().eq(opts.start_row_index);
|
||||
};
|
||||
get_last_row = function() {
|
||||
var rows = $(opts.cycle_expr, table).filter_visible();
|
||||
return rows.eq(rows.length-1);
|
||||
};
|
||||
make_key_callback = function(expr) {
|
||||
return function() {
|
||||
if ( null == $.table_hotkeys.current_row ) return false;
|
||||
var clickable = $(expr, $.table_hotkeys.current_row);
|
||||
if (!clickable.length) return false;
|
||||
if (clickable.is('.'+destructive_class)) next_row() || prev_row();
|
||||
clickable.click();
|
||||
}
|
||||
};
|
||||
first_row = get_first_row();
|
||||
if (!first_row.length) return;
|
||||
if (opts.highlight_first)
|
||||
set_current_row(first_row);
|
||||
else if (opts.highlight_last)
|
||||
set_current_row(get_last_row());
|
||||
$.hotkeys.add(opts.prev_key, opts.hotkeys_opts, function() {return adjacent_row_callback('prev')});
|
||||
$.hotkeys.add(opts.next_key, opts.hotkeys_opts, function() {return adjacent_row_callback('next')});
|
||||
$.hotkeys.add(opts.mark_key, opts.hotkeys_opts, check);
|
||||
$.each(keys, function() {
|
||||
var callback, key;
|
||||
|
||||
if ($.isFunction(this[1])) {
|
||||
callback = this[1];
|
||||
key = this[0];
|
||||
$.hotkeys.add(key, opts.hotkeys_opts, function(event) { return callback(event, $.table_hotkeys.current_row); });
|
||||
} else {
|
||||
key = this;
|
||||
$.hotkeys.add(key, opts.hotkeys_opts, make_key_callback('.'+opts.class_prefix+key));
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
$.table_hotkeys.current_row = null;
|
||||
$.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);
|
||||
1
wp-includes/js/jquery/jquery.table-hotkeys.min.js
vendored
Normal file
1
wp-includes/js/jquery/jquery.table-hotkeys.min.js
vendored
Normal file
@@ -0,0 +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);
|
||||
11
wp-includes/js/jquery/jquery.ui.touch-punch.js
vendored
Normal file
11
wp-includes/js/jquery/jquery.ui.touch-punch.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Touch Punch 0.2.2
|
||||
*
|
||||
* Copyright 2011, Dave Furfero
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.mouse.js
|
||||
*/
|
||||
(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f)}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown")};c._touchMove=function(f){if(!a){return}this._touchMoved=true;d(f,"mousemove")};c._touchEnd=function(f){if(!a){return}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click")}a=false};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f)}})(jQuery);
|
||||
330
wp-includes/js/jquery/suggest.js
vendored
Normal file
330
wp-includes/js/jquery/suggest.js
vendored
Normal file
@@ -0,0 +1,330 @@
|
||||
/*
|
||||
* jquery.suggest 1.1b - 2007-08-06
|
||||
* Patched by Mark Jaquith with Alexander Dick's "multiple items" patch to allow for auto-suggesting of more than one tag before submitting
|
||||
* See: http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/#comment-7228
|
||||
*
|
||||
* Uses code and techniques from following libraries:
|
||||
* 1. http://www.dyve.net/jquery/?autocomplete
|
||||
* 2. http://dev.jquery.com/browser/trunk/plugins/interface/iautocompleter.js
|
||||
*
|
||||
* All the new stuff written by Peter Vulgaris (www.vulgarisoip.com)
|
||||
* Feel free to do whatever you want with this file
|
||||
*
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
$.suggest = function(input, options) {
|
||||
var $input, $results, timeout, prevLength, cache, cacheSize;
|
||||
|
||||
$input = $(input).attr("autocomplete", "off");
|
||||
$results = $(document.createElement("ul"));
|
||||
|
||||
timeout = false; // hold timeout ID for suggestion results to appear
|
||||
prevLength = 0; // last recorded length of $input.val()
|
||||
cache = []; // cache MRU list
|
||||
cacheSize = 0; // size of cache in chars (bytes?)
|
||||
|
||||
$results.addClass(options.resultsClass).appendTo('body');
|
||||
|
||||
|
||||
resetPosition();
|
||||
$(window)
|
||||
.load(resetPosition) // just in case user is changing size of page while loading
|
||||
.resize(resetPosition);
|
||||
|
||||
$input.blur(function() {
|
||||
setTimeout(function() { $results.hide() }, 200);
|
||||
});
|
||||
|
||||
|
||||
// help IE users if possible
|
||||
if ( $.browser.msie ) {
|
||||
try {
|
||||
$results.bgiframe();
|
||||
} catch(e) { }
|
||||
}
|
||||
|
||||
// I really hate browser detection, but I don't see any other way
|
||||
if ($.browser.mozilla)
|
||||
$input.keypress(processKey); // onkeypress repeats arrow keys in Mozilla/Opera
|
||||
else
|
||||
$input.keydown(processKey); // onkeydown repeats arrow keys in IE/Safari
|
||||
|
||||
|
||||
|
||||
|
||||
function resetPosition() {
|
||||
// requires jquery.dimension plugin
|
||||
var offset = $input.offset();
|
||||
$results.css({
|
||||
top: (offset.top + input.offsetHeight) + 'px',
|
||||
left: offset.left + 'px'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function processKey(e) {
|
||||
|
||||
// handling up/down/escape requires results to be visible
|
||||
// handling enter/tab requires that AND a result to be selected
|
||||
if ((/27$|38$|40$/.test(e.keyCode) && $results.is(':visible')) ||
|
||||
(/^13$|^9$/.test(e.keyCode) && getCurrentResult())) {
|
||||
|
||||
if (e.preventDefault)
|
||||
e.preventDefault();
|
||||
if (e.stopPropagation)
|
||||
e.stopPropagation();
|
||||
|
||||
e.cancelBubble = true;
|
||||
e.returnValue = false;
|
||||
|
||||
switch(e.keyCode) {
|
||||
|
||||
case 38: // up
|
||||
prevResult();
|
||||
break;
|
||||
|
||||
case 40: // down
|
||||
nextResult();
|
||||
break;
|
||||
|
||||
case 9: // tab
|
||||
case 13: // return
|
||||
selectCurrentResult();
|
||||
break;
|
||||
|
||||
case 27: // escape
|
||||
$results.hide();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
} else if ($input.val().length != prevLength) {
|
||||
|
||||
if (timeout)
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(suggest, options.delay);
|
||||
prevLength = $input.val().length;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function suggest() {
|
||||
|
||||
var q = $.trim($input.val()), multipleSepPos, items;
|
||||
|
||||
if ( options.multiple ) {
|
||||
multipleSepPos = q.lastIndexOf(options.multipleSep);
|
||||
if ( multipleSepPos != -1 ) {
|
||||
q = $.trim(q.substr(multipleSepPos + options.multipleSep.length));
|
||||
}
|
||||
}
|
||||
if (q.length >= options.minchars) {
|
||||
|
||||
cached = checkCache(q);
|
||||
|
||||
if (cached) {
|
||||
|
||||
displayItems(cached['items']);
|
||||
|
||||
} else {
|
||||
|
||||
$.get(options.source, {q: q}, function(txt) {
|
||||
|
||||
$results.hide();
|
||||
|
||||
items = parseTxt(txt, q);
|
||||
|
||||
displayItems(items);
|
||||
addToCache(q, items, txt.length);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$results.hide();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function checkCache(q) {
|
||||
var i;
|
||||
for (i = 0; i < cache.length; i++)
|
||||
if (cache[i]['q'] == q) {
|
||||
cache.unshift(cache.splice(i, 1)[0]);
|
||||
return cache[0];
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
function addToCache(q, items, size) {
|
||||
var cached;
|
||||
while (cache.length && (cacheSize + size > options.maxCacheSize)) {
|
||||
cached = cache.pop();
|
||||
cacheSize -= cached['size'];
|
||||
}
|
||||
|
||||
cache.push({
|
||||
q: q,
|
||||
size: size,
|
||||
items: items
|
||||
});
|
||||
|
||||
cacheSize += size;
|
||||
|
||||
}
|
||||
|
||||
function displayItems(items) {
|
||||
var html = '', i;
|
||||
if (!items)
|
||||
return;
|
||||
|
||||
if (!items.length) {
|
||||
$results.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
resetPosition(); // when the form moves after the page has loaded
|
||||
|
||||
for (i = 0; i < items.length; i++)
|
||||
html += '<li>' + items[i] + '</li>';
|
||||
|
||||
$results.html(html).show();
|
||||
|
||||
$results
|
||||
.children('li')
|
||||
.mouseover(function() {
|
||||
$results.children('li').removeClass(options.selectClass);
|
||||
$(this).addClass(options.selectClass);
|
||||
})
|
||||
.click(function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
selectCurrentResult();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function parseTxt(txt, q) {
|
||||
|
||||
var items = [], tokens = txt.split(options.delimiter), i, token;
|
||||
|
||||
// parse returned data for non-empty items
|
||||
for (i = 0; i < tokens.length; i++) {
|
||||
token = $.trim(tokens[i]);
|
||||
if (token) {
|
||||
token = token.replace(
|
||||
new RegExp(q, 'ig'),
|
||||
function(q) { return '<span class="' + options.matchClass + '">' + q + '</span>' }
|
||||
);
|
||||
items[items.length] = token;
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
function getCurrentResult() {
|
||||
var $currentResult;
|
||||
if (!$results.is(':visible'))
|
||||
return false;
|
||||
|
||||
$currentResult = $results.children('li.' + options.selectClass);
|
||||
|
||||
if (!$currentResult.length)
|
||||
$currentResult = false;
|
||||
|
||||
return $currentResult;
|
||||
|
||||
}
|
||||
|
||||
function selectCurrentResult() {
|
||||
|
||||
$currentResult = getCurrentResult();
|
||||
|
||||
if ($currentResult) {
|
||||
if ( options.multiple ) {
|
||||
if ( $input.val().indexOf(options.multipleSep) != -1 ) {
|
||||
$currentVal = $input.val().substr( 0, ( $input.val().lastIndexOf(options.multipleSep) + options.multipleSep.length ) );
|
||||
} else {
|
||||
$currentVal = "";
|
||||
}
|
||||
$input.val( $currentVal + $currentResult.text() + options.multipleSep);
|
||||
$input.focus();
|
||||
} else {
|
||||
$input.val($currentResult.text());
|
||||
}
|
||||
$results.hide();
|
||||
|
||||
if (options.onSelect)
|
||||
options.onSelect.apply($input[0]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function nextResult() {
|
||||
|
||||
$currentResult = getCurrentResult();
|
||||
|
||||
if ($currentResult)
|
||||
$currentResult
|
||||
.removeClass(options.selectClass)
|
||||
.next()
|
||||
.addClass(options.selectClass);
|
||||
else
|
||||
$results.children('li:first-child').addClass(options.selectClass);
|
||||
|
||||
}
|
||||
|
||||
function prevResult() {
|
||||
var $currentResult = getCurrentResult();
|
||||
|
||||
if ($currentResult)
|
||||
$currentResult
|
||||
.removeClass(options.selectClass)
|
||||
.prev()
|
||||
.addClass(options.selectClass);
|
||||
else
|
||||
$results.children('li:last-child').addClass(options.selectClass);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$.fn.suggest = function(source, options) {
|
||||
|
||||
if (!source)
|
||||
return;
|
||||
|
||||
options = options || {};
|
||||
options.multiple = options.multiple || false;
|
||||
options.multipleSep = options.multipleSep || ", ";
|
||||
options.source = source;
|
||||
options.delay = options.delay || 100;
|
||||
options.resultsClass = options.resultsClass || 'ac_results';
|
||||
options.selectClass = options.selectClass || 'ac_over';
|
||||
options.matchClass = options.matchClass || 'ac_match';
|
||||
options.minchars = options.minchars || 2;
|
||||
options.delimiter = options.delimiter || '\n';
|
||||
options.onSelect = options.onSelect || false;
|
||||
options.maxCacheSize = options.maxCacheSize || 65536;
|
||||
|
||||
this.each(function() {
|
||||
new $.suggest(this, options);
|
||||
});
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
1
wp-includes/js/jquery/suggest.min.js
vendored
Normal file
1
wp-includes/js/jquery/suggest.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(a){a.suggest=function(o,g){var c,f,n,d,q,p;c=a(o).attr("autocomplete","off");f=a(document.createElement("ul"));n=false;d=0;q=[];p=0;f.addClass(g.resultsClass).appendTo("body");j();a(window).load(j).resize(j);c.blur(function(){setTimeout(function(){f.hide()},200)});if(a.browser.msie){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 x=a.trim(c.val()),w,e;if(g.multiple){w=x.lastIndexOf(g.multipleSep);if(w!=-1){x=a.trim(x.substr(w+g.multipleSep.length))}}if(x.length>=g.minchars){cached=v(x);if(cached){i(cached.items)}else{a.get(g.source,{q:x},function(y){f.hide();e=b(y,x);i(e);h(x,e,y.length)})}}else{f.hide()}}function v(w){var e;for(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){var x;while(q.length&&(p+w>g.maxCacheSize)){x=q.pop();p-=x.size}q.push({q:y,size:w,items:e});p+=w}function i(e){var x="",w;if(!e){return}if(!e.length){f.hide();return}j();for(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=[],A=e.split(g.delimiter),y,x;for(y=0;y<A.length;y++){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(){var e;if(!f.is(":visible")){return false}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(){var e=u();if(e){e.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);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.accordion.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.accordion.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-includes/js/jquery/ui/jquery.ui.autocomplete.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.autocomplete.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-includes/js/jquery/ui/jquery.ui.button.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.button.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-includes/js/jquery/ui/jquery.ui.core.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.core.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.core.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){function i(t,n){var r,i,o,u=t.nodeName.toLowerCase();return"area"===u?(r=t.parentNode,i=r.name,!t.href||!i||r.nodeName.toLowerCase()!=="map"?!1:(o=e("img[usemap=#"+i+"]")[0],!!o&&s(o))):(/input|select|textarea|button|object/.test(u)?!t.disabled:"a"===u?t.href||n:n)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().andSelf().filter(function(){return e.css(this,"visibility")==="hidden"}).length}var n=0,r=/^ui-id-\d+$/;e.ui=e.ui||{};if(e.ui.version)return;e.extend(e.ui,{version:"1.9.2",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({_focus:e.fn.focus,focus:function(t,n){return typeof t=="number"?this.each(function(){var r=this;setTimeout(function(){e(r).focus(),n&&n.call(r)},t)}):this._focus.apply(this,arguments)},scrollParent:function(){var t;return e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?t=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):t=this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(n){if(n!==t)return this.css("zIndex",n);if(this.length){var r=e(this[0]),i,s;while(r.length&&r[0]!==document){i=r.css("position");if(i==="absolute"||i==="relative"||i==="fixed"){s=parseInt(r.css("zIndex"),10);if(!isNaN(s)&&s!==0)return s}r=r.parent()}}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++n)})},removeUniqueId:function(){return this.each(function(){r.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var n=e.attr(t,"tabindex"),r=isNaN(n);return(r||n>=0)&&i(t,!r)}}),e(function(){var t=document.body,n=t.appendChild(n=document.createElement("div"));n.offsetHeight,e.extend(n.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),e.support.minHeight=n.offsetHeight===100,e.support.selectstart="onselectstart"in n,t.removeChild(n).style.display="none"}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(n,r){function u(t,n,r,s){return e.each(i,function(){n-=parseFloat(e.css(t,"padding"+this))||0,r&&(n-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(n-=parseFloat(e.css(t,"margin"+this))||0)}),n}var i=r==="Width"?["Left","Right"]:["Top","Bottom"],s=r.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+r]=function(n){return n===t?o["inner"+r].call(this):this.each(function(){e(this).css(s,u(this,n)+"px")})},e.fn["outer"+r]=function(t,n){return typeof t!="number"?o["outer"+r].call(this,t):this.each(function(){e(this).css(s,u(this,t,!0,n)+"px")})}}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(n){return arguments.length?t.call(this,e.camelCase(n)):t.call(this)}}(e.fn.removeData)),function(){var t=/msie ([\w.]+)/.exec(navigator.userAgent.toLowerCase())||[];e.ui.ie=t.length?!0:!1,e.ui.ie6=parseFloat(t[1],10)===6}(),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n){var r,i=e.plugins[t];if(!i||!e.element[0].parentNode||e.element[0].parentNode.nodeType===11)return;for(r=0;r<i.length;r++)e.options[i[r][0]]&&i[r][1].apply(e.element,n)}},contains:e.contains,hasScroll:function(t,n){if(e(t).css("overflow")==="hidden")return!1;var r=n&&n==="left"?"scrollLeft":"scrollTop",i=!1;return t[r]>0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},isOverAxis:function(e,t,n){return e>t&&e<t+n},isOver:function(t,n,r,i,s,o){return e.ui.isOverAxis(t,r,s)&&e.ui.isOverAxis(n,i,o)}})})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.datepicker.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.datepicker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-includes/js/jquery/ui/jquery.ui.dialog.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.dialog.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-includes/js/jquery/ui/jquery.ui.draggable.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.draggable.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-includes/js/jquery/ui/jquery.ui.droppable.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.droppable.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-includes/js/jquery/ui/jquery.ui.effect-blind.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.effect-blind.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.effect-blind.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){var n=/up|down|vertical/,r=/up|left|vertical|horizontal/;e.effects.effect.blind=function(t,i){var s=e(this),o=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(s,t.mode||"hide"),a=t.direction||"up",f=n.test(a),l=f?"height":"width",c=f?"top":"left",h=r.test(a),p={},d=u==="show",v,m,g;s.parent().is(".ui-effects-wrapper")?e.effects.save(s.parent(),o):e.effects.save(s,o),s.show(),v=e.effects.createWrapper(s).css({overflow:"hidden"}),m=v[l](),g=parseFloat(v.css(c))||0,p[l]=d?m:0,h||(s.css(f?"bottom":"right",0).css(f?"top":"left","auto").css({position:"absolute"}),p[c]=d?g:m+g),d&&(v.css(l,0),h||v.css(c,g+m)),v.animate(p,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){u==="hide"&&s.hide(),e.effects.restore(s,o),e.effects.removeWrapper(s),i()}})}})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.effect-bounce.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.effect-bounce.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.effect-bounce.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){e.effects.effect.bounce=function(t,n){var r=e(this),i=["position","top","bottom","left","right","height","width"],s=e.effects.setMode(r,t.mode||"effect"),o=s==="hide",u=s==="show",a=t.direction||"up",f=t.distance,l=t.times||5,c=l*2+(u||o?1:0),h=t.duration/c,p=t.easing,d=a==="up"||a==="down"?"top":"left",v=a==="up"||a==="left",m,g,y,b=r.queue(),w=b.length;(u||o)&&i.push("opacity"),e.effects.save(r,i),r.show(),e.effects.createWrapper(r),f||(f=r[d==="top"?"outerHeight":"outerWidth"]()/3),u&&(y={opacity:1},y[d]=0,r.css("opacity",0).css(d,v?-f*2:f*2).animate(y,h,p)),o&&(f/=Math.pow(2,l-1)),y={},y[d]=0;for(m=0;m<l;m++)g={},g[d]=(v?"-=":"+=")+f,r.animate(g,h,p).animate(y,h,p),f=o?f*2:f/2;o&&(g={opacity:0},g[d]=(v?"-=":"+=")+f,r.animate(g,h,p)),r.queue(function(){o&&r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()}),w>1&&b.splice.apply(b,[1,0].concat(b.splice(w,c+1))),r.dequeue()}})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.effect-clip.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.effect-clip.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.effect-clip.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){e.effects.effect.clip=function(t,n){var r=e(this),i=["position","top","bottom","left","right","height","width"],s=e.effects.setMode(r,t.mode||"hide"),o=s==="show",u=t.direction||"vertical",a=u==="vertical",f=a?"height":"width",l=a?"top":"left",c={},h,p,d;e.effects.save(r,i),r.show(),h=e.effects.createWrapper(r).css({overflow:"hidden"}),p=r[0].tagName==="IMG"?h:r,d=p[f](),o&&(p.css(f,0),p.css(l,d/2)),c[f]=o?d:0,c[l]=o?0:d/2,p.animate(c,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){o||r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()}})}})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.effect-drop.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.effect-drop.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.effect-drop.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){e.effects.effect.drop=function(t,n){var r=e(this),i=["position","top","bottom","left","right","opacity","height","width"],s=e.effects.setMode(r,t.mode||"hide"),o=s==="show",u=t.direction||"left",a=u==="up"||u==="down"?"top":"left",f=u==="up"||u==="left"?"pos":"neg",l={opacity:o?1:0},c;e.effects.save(r,i),r.show(),e.effects.createWrapper(r),c=t.distance||r[a==="top"?"outerHeight":"outerWidth"](!0)/2,o&&r.css("opacity",0).css(a,f==="pos"?-c:c),l[a]=(o?f==="pos"?"+=":"-=":f==="pos"?"-=":"+=")+c,r.animate(l,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){s==="hide"&&r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()}})}})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.effect-explode.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.effect-explode.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.effect-explode.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){e.effects.effect.explode=function(t,n){function y(){c.push(this),c.length===r*i&&b()}function b(){s.css({visibility:"visible"}),e(c).remove(),u||s.hide(),n()}var r=t.pieces?Math.round(Math.sqrt(t.pieces)):3,i=r,s=e(this),o=e.effects.setMode(s,t.mode||"hide"),u=o==="show",a=s.show().css("visibility","hidden").offset(),f=Math.ceil(s.outerWidth()/i),l=Math.ceil(s.outerHeight()/r),c=[],h,p,d,v,m,g;for(h=0;h<r;h++){v=a.top+h*l,g=h-(r-1)/2;for(p=0;p<i;p++)d=a.left+p*f,m=p-(i-1)/2,s.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-p*f,top:-h*l}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:f,height:l,left:d+(u?m*f:0),top:v+(u?g*l:0),opacity:u?0:1}).animate({left:d+(u?0:m*f),top:v+(u?0:g*l),opacity:u?1:0},t.duration||500,t.easing,y)}}})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.effect-fade.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.effect-fade.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.effect-fade.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){e.effects.effect.fade=function(t,n){var r=e(this),i=e.effects.setMode(r,t.mode||"toggle");r.animate({opacity:i},{queue:!1,duration:t.duration,easing:t.easing,complete:n})}})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.effect-fold.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.effect-fold.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.effect-fold.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){e.effects.effect.fold=function(t,n){var r=e(this),i=["position","top","bottom","left","right","height","width"],s=e.effects.setMode(r,t.mode||"hide"),o=s==="show",u=s==="hide",a=t.size||15,f=/([0-9]+)%/.exec(a),l=!!t.horizFirst,c=o!==l,h=c?["width","height"]:["height","width"],p=t.duration/2,d,v,m={},g={};e.effects.save(r,i),r.show(),d=e.effects.createWrapper(r).css({overflow:"hidden"}),v=c?[d.width(),d.height()]:[d.height(),d.width()],f&&(a=parseInt(f[1],10)/100*v[u?0:1]),o&&d.css(l?{height:0,width:a}:{height:a,width:0}),m[h[0]]=o?v[0]:a,g[h[1]]=o?v[1]:0,d.animate(m,p,t.easing).animate(g,p,t.easing,function(){u&&r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()})}})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.effect-highlight.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.effect-highlight.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.effect-highlight.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){e.effects.effect.highlight=function(t,n){var r=e(this),i=["backgroundImage","backgroundColor","opacity"],s=e.effects.setMode(r,t.mode||"show"),o={backgroundColor:r.css("backgroundColor")};s==="hide"&&(o.opacity=0),e.effects.save(r,i),r.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){s==="hide"&&r.hide(),e.effects.restore(r,i),n()}})}})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.effect-pulsate.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.effect-pulsate.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.effect-pulsate.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){e.effects.effect.pulsate=function(t,n){var r=e(this),i=e.effects.setMode(r,t.mode||"show"),s=i==="show",o=i==="hide",u=s||i==="hide",a=(t.times||5)*2+(u?1:0),f=t.duration/a,l=0,c=r.queue(),h=c.length,p;if(s||!r.is(":visible"))r.css("opacity",0).show(),l=1;for(p=1;p<a;p++)r.animate({opacity:l},f,t.easing),l=1-l;r.animate({opacity:l},f,t.easing),r.queue(function(){o&&r.hide(),n()}),h>1&&c.splice.apply(c,[1,0].concat(c.splice(h,a+1))),r.dequeue()}})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.effect-scale.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.effect-scale.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.effect-scale.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){e.effects.effect.puff=function(t,n){var r=e(this),i=e.effects.setMode(r,t.mode||"hide"),s=i==="hide",o=parseInt(t.percent,10)||150,u=o/100,a={height:r.height(),width:r.width(),outerHeight:r.outerHeight(),outerWidth:r.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:i,complete:n,percent:s?o:100,from:s?a:{height:a.height*u,width:a.width*u,outerHeight:a.outerHeight*u,outerWidth:a.outerWidth*u}}),r.effect(t)},e.effects.effect.scale=function(t,n){var r=e(this),i=e.extend(!0,{},t),s=e.effects.setMode(r,t.mode||"effect"),o=parseInt(t.percent,10)||(parseInt(t.percent,10)===0?0:s==="hide"?0:100),u=t.direction||"both",a=t.origin,f={height:r.height(),width:r.width(),outerHeight:r.outerHeight(),outerWidth:r.outerWidth()},l={y:u!=="horizontal"?o/100:1,x:u!=="vertical"?o/100:1};i.effect="size",i.queue=!1,i.complete=n,s!=="effect"&&(i.origin=a||["middle","center"],i.restore=!0),i.from=t.from||(s==="show"?{height:0,width:0,outerHeight:0,outerWidth:0}:f),i.to={height:f.height*l.y,width:f.width*l.x,outerHeight:f.outerHeight*l.y,outerWidth:f.outerWidth*l.x},i.fade&&(s==="show"&&(i.from.opacity=0,i.to.opacity=1),s==="hide"&&(i.from.opacity=1,i.to.opacity=0)),r.effect(i)},e.effects.effect.size=function(t,n){var r,i,s,o=e(this),u=["position","top","bottom","left","right","width","height","overflow","opacity"],a=["position","top","bottom","left","right","overflow","opacity"],f=["width","height","overflow"],l=["fontSize"],c=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],h=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),d=t.restore||p!=="effect",v=t.scale||"both",m=t.origin||["middle","center"],g=o.css("position"),y=d?u:a,b={height:0,width:0,outerHeight:0,outerWidth:0};p==="show"&&o.show(),r={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},t.mode==="toggle"&&p==="show"?(o.from=t.to||b,o.to=t.from||r):(o.from=t.from||(p==="show"?b:r),o.to=t.to||(p==="hide"?b:r)),s={from:{y:o.from.height/r.height,x:o.from.width/r.width},to:{y:o.to.height/r.height,x:o.to.width/r.width}};if(v==="box"||v==="both")s.from.y!==s.to.y&&(y=y.concat(c),o.from=e.effects.setTransition(o,c,s.from.y,o.from),o.to=e.effects.setTransition(o,c,s.to.y,o.to)),s.from.x!==s.to.x&&(y=y.concat(h),o.from=e.effects.setTransition(o,h,s.from.x,o.from),o.to=e.effects.setTransition(o,h,s.to.x,o.to));(v==="content"||v==="both")&&s.from.y!==s.to.y&&(y=y.concat(l).concat(f),o.from=e.effects.setTransition(o,l,s.from.y,o.from),o.to=e.effects.setTransition(o,l,s.to.y,o.to)),e.effects.save(o,y),o.show(),e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),m&&(i=e.effects.getBaseline(m,r),o.from.top=(r.outerHeight-o.outerHeight())*i.y,o.from.left=(r.outerWidth-o.outerWidth())*i.x,o.to.top=(r.outerHeight-o.to.outerHeight)*i.y,o.to.left=(r.outerWidth-o.to.outerWidth)*i.x),o.css(o.from);if(v==="content"||v==="both")c=c.concat(["marginTop","marginBottom"]).concat(l),h=h.concat(["marginLeft","marginRight"]),f=u.concat(c).concat(h),o.find("*[width]").each(function(){var n=e(this),r={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()};d&&e.effects.save(n,f),n.from={height:r.height*s.from.y,width:r.width*s.from.x,outerHeight:r.outerHeight*s.from.y,outerWidth:r.outerWidth*s.from.x},n.to={height:r.height*s.to.y,width:r.width*s.to.x,outerHeight:r.height*s.to.y,outerWidth:r.width*s.to.x},s.from.y!==s.to.y&&(n.from=e.effects.setTransition(n,c,s.from.y,n.from),n.to=e.effects.setTransition(n,c,s.to.y,n.to)),s.from.x!==s.to.x&&(n.from=e.effects.setTransition(n,h,s.from.x,n.from),n.to=e.effects.setTransition(n,h,s.to.x,n.to)),n.css(n.from),n.animate(n.to,t.duration,t.easing,function(){d&&e.effects.restore(n,f)})});o.animate(o.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){o.to.opacity===0&&o.css("opacity",o.from.opacity),p==="hide"&&o.hide(),e.effects.restore(o,y),d||(g==="static"?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,n){var r=parseInt(n,10),i=e?o.to.left:o.to.top;return n==="auto"?i+"px":r+i+"px"})})),e.effects.removeWrapper(o),n()}})}})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.effect-shake.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.effect-shake.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.effect-shake.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){e.effects.effect.shake=function(t,n){var r=e(this),i=["position","top","bottom","left","right","height","width"],s=e.effects.setMode(r,t.mode||"effect"),o=t.direction||"left",u=t.distance||20,a=t.times||3,f=a*2+1,l=Math.round(t.duration/f),c=o==="up"||o==="down"?"top":"left",h=o==="up"||o==="left",p={},d={},v={},m,g=r.queue(),y=g.length;e.effects.save(r,i),r.show(),e.effects.createWrapper(r),p[c]=(h?"-=":"+=")+u,d[c]=(h?"+=":"-=")+u*2,v[c]=(h?"-=":"+=")+u*2,r.animate(p,l,t.easing);for(m=1;m<a;m++)r.animate(d,l,t.easing).animate(v,l,t.easing);r.animate(d,l,t.easing).animate(p,l/2,t.easing).queue(function(){s==="hide"&&r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()}),y>1&&g.splice.apply(g,[1,0].concat(g.splice(y,f+1))),r.dequeue()}})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.effect-slide.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.effect-slide.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.effect-slide.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){e.effects.effect.slide=function(t,n){var r=e(this),i=["position","top","bottom","left","right","width","height"],s=e.effects.setMode(r,t.mode||"show"),o=s==="show",u=t.direction||"left",a=u==="up"||u==="down"?"top":"left",f=u==="up"||u==="left",l,c={};e.effects.save(r,i),r.show(),l=t.distance||r[a==="top"?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(r).css({overflow:"hidden"}),o&&r.css(a,f?isNaN(l)?"-"+l:-l:l),c[a]=(o?f?"+=":"-=":f?"-=":"+=")+l,r.animate(c,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){s==="hide"&&r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()}})}})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.effect-transfer.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.effect-transfer.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.effect-transfer.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){e.effects.effect.transfer=function(t,n){var r=e(this),i=e(t.to),s=i.css("position")==="fixed",o=e("body"),u=s?o.scrollTop():0,a=s?o.scrollLeft():0,f=i.offset(),l={top:f.top-u,left:f.left-a,height:i.innerHeight(),width:i.innerWidth()},c=r.offset(),h=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(t.className).css({top:c.top-u,left:c.left-a,height:r.innerHeight(),width:r.innerWidth(),position:s?"fixed":"absolute"}).animate(l,t.duration,t.easing,function(){h.remove(),n()})}})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.effect.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.effect.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-includes/js/jquery/ui/jquery.ui.menu.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.menu.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-includes/js/jquery/ui/jquery.ui.mouse.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.mouse.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.mouse.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){var n=!1;e(document).mouseup(function(e){n=!1}),e.widget("ui.mouse",{version:"1.9.2",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(n){if(!0===e.data(n.target,t.widgetName+".preventClickEvent"))return e.removeData(n.target,t.widgetName+".preventClickEvent"),n.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(n)return;this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var r=this,i=t.which===1,s=typeof this.options.cancel=="string"&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;if(!i||s||!this._mouseCapture(t))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){r.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)){this._mouseStarted=this._mouseStart(t)!==!1;if(!this._mouseStarted)return t.preventDefault(),!0}return!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return r._mouseMove(e)},this._mouseUpDelegate=function(e){return r._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),n=!0,!0},_mouseMove:function(t){return!e.ui.ie||document.documentMode>=9||!!t.button?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(e){return this.mouseDelayMet},_mouseStart:function(e){},_mouseDrag:function(e){},_mouseStop:function(e){},_mouseCapture:function(e){return!0}})})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.position.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.position.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-includes/js/jquery/ui/jquery.ui.progressbar.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.progressbar.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.progressbar.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){e.widget("ui.progressbar",{version:"1.9.2",options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return e===t?this._value():(this._setOption("value",e),this)},_setOption:function(e,t){e==="value"&&(this.options.value=t,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),this._super(e,t)},_value:function(){var e=this.options.value;return typeof e!="number"&&(e=0),Math.min(this.options.max,Math.max(this.min,e))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var e=this.value(),t=this._percentage();this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),this.valueDiv.toggle(e>this.min).toggleClass("ui-corner-right",e===this.options.max).width(t.toFixed(0)+"%"),this.element.attr("aria-valuenow",e)}})})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.resizable.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.resizable.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-includes/js/jquery/ui/jquery.ui.selectable.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.selectable.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.selectable.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e,t){e.widget("ui.selectable",e.ui.mouse,{version:"1.9.2",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var t=this;this.element.addClass("ui-selectable"),this.dragged=!1;var n;this.refresh=function(){n=e(t.options.filter,t.element[0]),n.addClass("ui-selectee"),n.each(function(){var t=e(this),n=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:n.left,top:n.top,right:n.left+t.outerWidth(),bottom:n.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=n.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var n=this;this.opos=[t.pageX,t.pageY];if(this.options.disabled)return;var r=this.options;this.selectees=e(r.filter,this.element[0]),this._trigger("start",t),e(r.appendTo).append(this.helper),this.helper.css({left:t.clientX,top:t.clientY,width:0,height:0}),r.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var r=e.data(this,"selectable-item");r.startselected=!0,!t.metaKey&&!t.ctrlKey&&(r.$element.removeClass("ui-selected"),r.selected=!1,r.$element.addClass("ui-unselecting"),r.unselecting=!0,n._trigger("unselecting",t,{unselecting:r.element}))}),e(t.target).parents().andSelf().each(function(){var r=e.data(this,"selectable-item");if(r){var i=!t.metaKey&&!t.ctrlKey||!r.$element.hasClass("ui-selected");return r.$element.removeClass(i?"ui-unselecting":"ui-selected").addClass(i?"ui-selecting":"ui-unselecting"),r.unselecting=!i,r.selecting=i,r.selected=i,i?n._trigger("selecting",t,{selecting:r.element}):n._trigger("unselecting",t,{unselecting:r.element}),!1}})},_mouseDrag:function(t){var n=this;this.dragged=!0;if(this.options.disabled)return;var r=this.options,i=this.opos[0],s=this.opos[1],o=t.pageX,u=t.pageY;if(i>o){var a=o;o=i,i=a}if(s>u){var a=u;u=s,s=a}return this.helper.css({left:i,top:s,width:o-i,height:u-s}),this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!a||a.element==n.element[0])return;var f=!1;r.tolerance=="touch"?f=!(a.left>o||a.right<i||a.top>u||a.bottom<s):r.tolerance=="fit"&&(f=a.left>i&&a.right<o&&a.top>s&&a.bottom<u),f?(a.selected&&(a.$element.removeClass("ui-selected"),a.selected=!1),a.unselecting&&(a.$element.removeClass("ui-unselecting"),a.unselecting=!1),a.selecting||(a.$element.addClass("ui-selecting"),a.selecting=!0,n._trigger("selecting",t,{selecting:a.element}))):(a.selecting&&((t.metaKey||t.ctrlKey)&&a.startselected?(a.$element.removeClass("ui-selecting"),a.selecting=!1,a.$element.addClass("ui-selected"),a.selected=!0):(a.$element.removeClass("ui-selecting"),a.selecting=!1,a.startselected&&(a.$element.addClass("ui-unselecting"),a.unselecting=!0),n._trigger("unselecting",t,{unselecting:a.element}))),a.selected&&!t.metaKey&&!t.ctrlKey&&!a.startselected&&(a.$element.removeClass("ui-selected"),a.selected=!1,a.$element.addClass("ui-unselecting"),a.unselecting=!0,n._trigger("unselecting",t,{unselecting:a.element})))}),!1},_mouseStop:function(t){var n=this;this.dragged=!1;var r=this.options;return e(".ui-unselecting",this.element[0]).each(function(){var r=e.data(this,"selectable-item");r.$element.removeClass("ui-unselecting"),r.unselecting=!1,r.startselected=!1,n._trigger("unselected",t,{unselected:r.element})}),e(".ui-selecting",this.element[0]).each(function(){var r=e.data(this,"selectable-item");r.$element.removeClass("ui-selecting").addClass("ui-selected"),r.selecting=!1,r.selected=!0,r.startselected=!0,n._trigger("selected",t,{selected:r.element})}),this._trigger("stop",t),this.helper.remove(),!1}})})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.slider.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.slider.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-includes/js/jquery/ui/jquery.ui.sortable.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.sortable.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-includes/js/jquery/ui/jquery.ui.spinner.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.spinner.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-includes/js/jquery/ui/jquery.ui.tabs.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.tabs.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-includes/js/jquery/ui/jquery.ui.tooltip.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.tooltip.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.tooltip.js
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
(function(e){function n(t,n){var r=(t.attr("aria-describedby")||"").split(/\s+/);r.push(n),t.data("ui-tooltip-id",n).attr("aria-describedby",e.trim(r.join(" ")))}function r(t){var n=t.data("ui-tooltip-id"),r=(t.attr("aria-describedby")||"").split(/\s+/),i=e.inArray(n,r);i!==-1&&r.splice(i,1),t.removeData("ui-tooltip-id"),r=e.trim(r.join(" ")),r?t.attr("aria-describedby",r):t.removeAttr("aria-describedby")}var t=0;e.widget("ui.tooltip",{version:"1.9.2",options:{content:function(){return e(this).attr("title")},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable()},_setOption:function(t,n){var r=this;if(t==="disabled"){this[n?"_disable":"_enable"](),this.options[t]=n;return}this._super(t,n),t==="content"&&e.each(this.tooltips,function(e,t){r._updateContent(t)})},_disable:function(){var t=this;e.each(this.tooltips,function(n,r){var i=e.Event("blur");i.target=i.currentTarget=r[0],t.close(i,!0)}),this.element.find(this.options.items).andSelf().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).andSelf().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var n=this,r=e(t?t.target:this.element).closest(this.options.items);if(!r.length||r.data("ui-tooltip-id"))return;r.attr("title")&&r.data("ui-tooltip-title",r.attr("title")),r.data("ui-tooltip-open",!0),t&&t.type==="mouseover"&&r.parents().each(function(){var t=e(this),r;t.data("ui-tooltip-open")&&(r=e.Event("blur"),r.target=r.currentTarget=this,n.close(r,!0)),t.attr("title")&&(t.uniqueId(),n.parents[this.id]={element:this,title:t.attr("title")},t.attr("title",""))}),this._updateContent(r,t)},_updateContent:function(e,t){var n,r=this.options.content,i=this,s=t?t.type:null;if(typeof r=="string")return this._open(t,e,r);n=r.call(e[0],function(n){if(!e.data("ui-tooltip-open"))return;i._delay(function(){t&&(t.type=s),this._open(t,e,n)})}),n&&this._open(t,e,n)},_open:function(t,r,i){function f(e){a.of=e;if(s.is(":hidden"))return;s.position(a)}var s,o,u,a=e.extend({},this.options.position);if(!i)return;s=this._find(r);if(s.length){s.find(".ui-tooltip-content").html(i);return}r.is("[title]")&&(t&&t.type==="mouseover"?r.attr("title",""):r.removeAttr("title")),s=this._tooltip(r),n(r,s.attr("id")),s.find(".ui-tooltip-content").html(i),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:f}),f(t)):s.position(e.extend({of:r},this.options.position)),s.hide(),this._show(s,this.options.show),this.options.show&&this.options.show.delay&&(u=setInterval(function(){s.is(":visible")&&(f(a.of),clearInterval(u))},e.fx.interval)),this._trigger("open",t,{tooltip:s}),o={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var n=e.Event(t);n.currentTarget=r[0],this.close(n,!0)}},remove:function(){this._removeTooltip(s)}};if(!t||t.type==="mouseover")o.mouseleave="close";if(!t||t.type==="focusin")o.focusout="close";this._on(!0,r,o)},close:function(t){var n=this,i=e(t?t.currentTarget:this.element),s=this._find(i);if(this.closing)return;i.data("ui-tooltip-title")&&i.attr("title",i.data("ui-tooltip-title")),r(i),s.stop(!0),this._hide(s,this.options.hide,function(){n._removeTooltip(e(this))}),i.removeData("ui-tooltip-open"),this._off(i,"mouseleave focusout keyup"),i[0]!==this.element[0]&&this._off(i,"remove"),this._off(this.document,"mousemove"),t&&t.type==="mouseleave"&&e.each(this.parents,function(t,r){e(r.element).attr("title",r.title),delete n.parents[t]}),this.closing=!0,this._trigger("close",t,{tooltip:s}),this.closing=!1},_tooltip:function(n){var r="ui-tooltip-"+t++,i=e("<div>").attr({id:r,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return e("<div>").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),e.fn.bgiframe&&i.bgiframe(),this.tooltips[r]=n,i},_find:function(t){var n=t.data("ui-tooltip-id");return n?e("#"+n):e()},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(n,r){var i=e.Event("blur");i.target=i.currentTarget=r[0],t.close(i,!0),e("#"+n).remove(),r.data("ui-tooltip-title")&&(r.attr("title",r.data("ui-tooltip-title")),r.removeData("ui-tooltip-title"))})}})})(jQuery);
|
||||
5
wp-includes/js/jquery/ui/jquery.ui.widget.min.js
vendored
Normal file
5
wp-includes/js/jquery/ui/jquery.ui.widget.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
480
wp-includes/js/json2.js
Normal file
480
wp-includes/js/json2.js
Normal file
@@ -0,0 +1,480 @@
|
||||
/*
|
||||
http://www.JSON.org/json2.js
|
||||
2011-02-23
|
||||
|
||||
Public Domain.
|
||||
|
||||
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||
|
||||
See http://www.JSON.org/js.html
|
||||
|
||||
|
||||
This code should be minified before deployment.
|
||||
See http://javascript.crockford.com/jsmin.html
|
||||
|
||||
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
||||
NOT CONTROL.
|
||||
|
||||
|
||||
This file creates a global JSON object containing two methods: stringify
|
||||
and parse.
|
||||
|
||||
JSON.stringify(value, replacer, space)
|
||||
value any JavaScript value, usually an object or array.
|
||||
|
||||
replacer an optional parameter that determines how object
|
||||
values are stringified for objects. It can be a
|
||||
function or an array of strings.
|
||||
|
||||
space an optional parameter that specifies the indentation
|
||||
of nested structures. If it is omitted, the text will
|
||||
be packed without extra whitespace. If it is a number,
|
||||
it will specify the number of spaces to indent at each
|
||||
level. If it is a string (such as '\t' or ' '),
|
||||
it contains the characters used to indent at each level.
|
||||
|
||||
This method produces a JSON text from a JavaScript value.
|
||||
|
||||
When an object value is found, if the object contains a toJSON
|
||||
method, its toJSON method will be called and the result will be
|
||||
stringified. A toJSON method does not serialize: it returns the
|
||||
value represented by the name/value pair that should be serialized,
|
||||
or undefined if nothing should be serialized. The toJSON method
|
||||
will be passed the key associated with the value, and this will be
|
||||
bound to the value
|
||||
|
||||
For example, this would serialize Dates as ISO strings.
|
||||
|
||||
Date.prototype.toJSON = function (key) {
|
||||
function f(n) {
|
||||
// Format integers to have at least two digits.
|
||||
return n < 10 ? '0' + n : n;
|
||||
}
|
||||
|
||||
return this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z';
|
||||
};
|
||||
|
||||
You can provide an optional replacer method. It will be passed the
|
||||
key and value of each member, with this bound to the containing
|
||||
object. The value that is returned from your method will be
|
||||
serialized. If your method returns undefined, then the member will
|
||||
be excluded from the serialization.
|
||||
|
||||
If the replacer parameter is an array of strings, then it will be
|
||||
used to select the members to be serialized. It filters the results
|
||||
such that only members with keys listed in the replacer array are
|
||||
stringified.
|
||||
|
||||
Values that do not have JSON representations, such as undefined or
|
||||
functions, will not be serialized. Such values in objects will be
|
||||
dropped; in arrays they will be replaced with null. You can use
|
||||
a replacer function to replace those with JSON values.
|
||||
JSON.stringify(undefined) returns undefined.
|
||||
|
||||
The optional space parameter produces a stringification of the
|
||||
value that is filled with line breaks and indentation to make it
|
||||
easier to read.
|
||||
|
||||
If the space parameter is a non-empty string, then that string will
|
||||
be used for indentation. If the space parameter is a number, then
|
||||
the indentation will be that many spaces.
|
||||
|
||||
Example:
|
||||
|
||||
text = JSON.stringify(['e', {pluribus: 'unum'}]);
|
||||
// text is '["e",{"pluribus":"unum"}]'
|
||||
|
||||
|
||||
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
|
||||
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
|
||||
|
||||
text = JSON.stringify([new Date()], function (key, value) {
|
||||
return this[key] instanceof Date ?
|
||||
'Date(' + this[key] + ')' : value;
|
||||
});
|
||||
// text is '["Date(---current time---)"]'
|
||||
|
||||
|
||||
JSON.parse(text, reviver)
|
||||
This method parses a JSON text to produce an object or array.
|
||||
It can throw a SyntaxError exception.
|
||||
|
||||
The optional reviver parameter is a function that can filter and
|
||||
transform the results. It receives each of the keys and values,
|
||||
and its return value is used instead of the original value.
|
||||
If it returns what it received, then the structure is not modified.
|
||||
If it returns undefined then the member is deleted.
|
||||
|
||||
Example:
|
||||
|
||||
// Parse the text. Values that look like ISO date strings will
|
||||
// be converted to Date objects.
|
||||
|
||||
myData = JSON.parse(text, function (key, value) {
|
||||
var a;
|
||||
if (typeof value === 'string') {
|
||||
a =
|
||||
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
|
||||
if (a) {
|
||||
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
|
||||
+a[5], +a[6]));
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
|
||||
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
|
||||
var d;
|
||||
if (typeof value === 'string' &&
|
||||
value.slice(0, 5) === 'Date(' &&
|
||||
value.slice(-1) === ')') {
|
||||
d = new Date(value.slice(5, -1));
|
||||
if (d) {
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
|
||||
|
||||
This is a reference implementation. You are free to copy, modify, or
|
||||
redistribute.
|
||||
*/
|
||||
|
||||
/*jslint evil: true, strict: false, regexp: false */
|
||||
|
||||
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
|
||||
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
|
||||
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
|
||||
lastIndex, length, parse, prototype, push, replace, slice, stringify,
|
||||
test, toJSON, toString, valueOf
|
||||
*/
|
||||
|
||||
|
||||
// Create a JSON object only if one does not already exist. We create the
|
||||
// methods in a closure to avoid creating global variables.
|
||||
|
||||
var JSON;
|
||||
if (!JSON) {
|
||||
JSON = {};
|
||||
}
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function f(n) {
|
||||
// Format integers to have at least two digits.
|
||||
return n < 10 ? '0' + n : n;
|
||||
}
|
||||
|
||||
if (typeof Date.prototype.toJSON !== 'function') {
|
||||
|
||||
Date.prototype.toJSON = function (key) {
|
||||
|
||||
return isFinite(this.valueOf()) ?
|
||||
this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z' : null;
|
||||
};
|
||||
|
||||
String.prototype.toJSON =
|
||||
Number.prototype.toJSON =
|
||||
Boolean.prototype.toJSON = function (key) {
|
||||
return this.valueOf();
|
||||
};
|
||||
}
|
||||
|
||||
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
gap,
|
||||
indent,
|
||||
meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
},
|
||||
rep;
|
||||
|
||||
|
||||
function quote(string) {
|
||||
|
||||
// If the string contains no control characters, no quote characters, and no
|
||||
// backslash characters, then we can safely slap some quotes around it.
|
||||
// Otherwise we must also replace the offending characters with safe escape
|
||||
// sequences.
|
||||
|
||||
escapable.lastIndex = 0;
|
||||
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
|
||||
var c = meta[a];
|
||||
return typeof c === 'string' ? c :
|
||||
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
}) + '"' : '"' + string + '"';
|
||||
}
|
||||
|
||||
|
||||
function str(key, holder) {
|
||||
|
||||
// Produce a string from holder[key].
|
||||
|
||||
var i, // The loop counter.
|
||||
k, // The member key.
|
||||
v, // The member value.
|
||||
length,
|
||||
mind = gap,
|
||||
partial,
|
||||
value = holder[key];
|
||||
|
||||
// If the value has a toJSON method, call it to obtain a replacement value.
|
||||
|
||||
if (value && typeof value === 'object' &&
|
||||
typeof value.toJSON === 'function') {
|
||||
value = value.toJSON(key);
|
||||
}
|
||||
|
||||
// If we were called with a replacer function, then call the replacer to
|
||||
// obtain a replacement value.
|
||||
|
||||
if (typeof rep === 'function') {
|
||||
value = rep.call(holder, key, value);
|
||||
}
|
||||
|
||||
// What happens next depends on the value's type.
|
||||
|
||||
switch (typeof value) {
|
||||
case 'string':
|
||||
return quote(value);
|
||||
|
||||
case 'number':
|
||||
|
||||
// JSON numbers must be finite. Encode non-finite numbers as null.
|
||||
|
||||
return isFinite(value) ? String(value) : 'null';
|
||||
|
||||
case 'boolean':
|
||||
case 'null':
|
||||
|
||||
// If the value is a boolean or null, convert it to a string. Note:
|
||||
// typeof null does not produce 'null'. The case is included here in
|
||||
// the remote chance that this gets fixed someday.
|
||||
|
||||
return String(value);
|
||||
|
||||
// If the type is 'object', we might be dealing with an object or an array or
|
||||
// null.
|
||||
|
||||
case 'object':
|
||||
|
||||
// Due to a specification blunder in ECMAScript, typeof null is 'object',
|
||||
// so watch out for that case.
|
||||
|
||||
if (!value) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
// Make an array to hold the partial results of stringifying this object value.
|
||||
|
||||
gap += indent;
|
||||
partial = [];
|
||||
|
||||
// Is the value an array?
|
||||
|
||||
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
||||
|
||||
// The value is an array. Stringify every element. Use null as a placeholder
|
||||
// for non-JSON values.
|
||||
|
||||
length = value.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
partial[i] = str(i, value) || 'null';
|
||||
}
|
||||
|
||||
// Join all of the elements together, separated with commas, and wrap them in
|
||||
// brackets.
|
||||
|
||||
v = partial.length === 0 ? '[]' : gap ?
|
||||
'[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
|
||||
'[' + partial.join(',') + ']';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
|
||||
// If the replacer is an array, use it to select the members to be stringified.
|
||||
|
||||
if (rep && typeof rep === 'object') {
|
||||
length = rep.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
if (typeof rep[i] === 'string') {
|
||||
k = rep[i];
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Otherwise, iterate through all of the keys in the object.
|
||||
|
||||
for (k in value) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Join all of the member texts together, separated with commas,
|
||||
// and wrap them in braces.
|
||||
|
||||
v = partial.length === 0 ? '{}' : gap ?
|
||||
'{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
|
||||
'{' + partial.join(',') + '}';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
// If the JSON object does not yet have a stringify method, give it one.
|
||||
|
||||
if (typeof JSON.stringify !== 'function') {
|
||||
JSON.stringify = function (value, replacer, space) {
|
||||
|
||||
// The stringify method takes a value and an optional replacer, and an optional
|
||||
// space parameter, and returns a JSON text. The replacer can be a function
|
||||
// that can replace values, or an array of strings that will select the keys.
|
||||
// A default replacer method can be provided. Use of the space parameter can
|
||||
// produce text that is more easily readable.
|
||||
|
||||
var i;
|
||||
gap = '';
|
||||
indent = '';
|
||||
|
||||
// If the space parameter is a number, make an indent string containing that
|
||||
// many spaces.
|
||||
|
||||
if (typeof space === 'number') {
|
||||
for (i = 0; i < space; i += 1) {
|
||||
indent += ' ';
|
||||
}
|
||||
|
||||
// If the space parameter is a string, it will be used as the indent string.
|
||||
|
||||
} else if (typeof space === 'string') {
|
||||
indent = space;
|
||||
}
|
||||
|
||||
// If there is a replacer, it must be a function or an array.
|
||||
// Otherwise, throw an error.
|
||||
|
||||
rep = replacer;
|
||||
if (replacer && typeof replacer !== 'function' &&
|
||||
(typeof replacer !== 'object' ||
|
||||
typeof replacer.length !== 'number')) {
|
||||
throw new Error('JSON.stringify');
|
||||
}
|
||||
|
||||
// Make a fake root object containing our value under the key of ''.
|
||||
// Return the result of stringifying the value.
|
||||
|
||||
return str('', {'': value});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// If the JSON object does not yet have a parse method, give it one.
|
||||
|
||||
if (typeof JSON.parse !== 'function') {
|
||||
JSON.parse = function (text, reviver) {
|
||||
|
||||
// The parse method takes a text and an optional reviver function, and returns
|
||||
// a JavaScript value if the text is a valid JSON text.
|
||||
|
||||
var j;
|
||||
|
||||
function walk(holder, key) {
|
||||
|
||||
// The walk method is used to recursively walk the resulting structure so
|
||||
// that modifications can be made.
|
||||
|
||||
var k, v, value = holder[key];
|
||||
if (value && typeof value === 'object') {
|
||||
for (k in value) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||
v = walk(value, k);
|
||||
if (v !== undefined) {
|
||||
value[k] = v;
|
||||
} else {
|
||||
delete value[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return reviver.call(holder, key, value);
|
||||
}
|
||||
|
||||
|
||||
// Parsing happens in four stages. In the first stage, we replace certain
|
||||
// Unicode characters with escape sequences. JavaScript handles many characters
|
||||
// incorrectly, either silently deleting them, or treating them as line endings.
|
||||
|
||||
text = String(text);
|
||||
cx.lastIndex = 0;
|
||||
if (cx.test(text)) {
|
||||
text = text.replace(cx, function (a) {
|
||||
return '\\u' +
|
||||
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
});
|
||||
}
|
||||
|
||||
// In the second stage, we run the text against regular expressions that look
|
||||
// for non-JSON patterns. We are especially concerned with '()' and 'new'
|
||||
// because they can cause invocation, and '=' because it can cause mutation.
|
||||
// But just to be safe, we want to reject all unexpected forms.
|
||||
|
||||
// We split the second stage into 4 regexp operations in order to work around
|
||||
// crippling inefficiencies in IE's and Safari's regexp engines. First we
|
||||
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
|
||||
// replace all simple value tokens with ']' characters. Third, we delete all
|
||||
// open brackets that follow a colon or comma or that begin the text. Finally,
|
||||
// we look to see that the remaining characters are only whitespace or ']' or
|
||||
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
|
||||
|
||||
if (/^[\],:{}\s]*$/
|
||||
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
|
||||
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
|
||||
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
||||
|
||||
// In the third stage we use the eval function to compile the text into a
|
||||
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
|
||||
// in JavaScript: it can begin a block or an object literal. We wrap the text
|
||||
// in parens to eliminate the ambiguity.
|
||||
|
||||
j = eval('(' + text + ')');
|
||||
|
||||
// In the optional fourth stage, we recursively walk the new structure, passing
|
||||
// each name/value pair to a reviver function for possible transformation.
|
||||
|
||||
return typeof reviver === 'function' ?
|
||||
walk({'': j}, '') : j;
|
||||
}
|
||||
|
||||
// If the text is not JSON parseable, then a SyntaxError is thrown.
|
||||
|
||||
throw new SyntaxError('JSON.parse');
|
||||
};
|
||||
}
|
||||
}());
|
||||
1
wp-includes/js/json2.min.js
vendored
Normal file
1
wp-includes/js/json2.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var JSON;if(!JSON){JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==="string"){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());
|
||||
349
wp-includes/js/mce-view.js
Normal file
349
wp-includes/js/mce-view.js
Normal file
@@ -0,0 +1,349 @@
|
||||
// Ensure the global `wp` object exists.
|
||||
window.wp = window.wp || {};
|
||||
|
||||
(function($){
|
||||
var views = {},
|
||||
instances = {};
|
||||
|
||||
// Create the `wp.mce` object if necessary.
|
||||
wp.mce = wp.mce || {};
|
||||
|
||||
// wp.mce.view
|
||||
// -----------
|
||||
// A set of utilities that simplifies adding custom UI within a TinyMCE editor.
|
||||
// At its core, it serves as a series of converters, transforming text to a
|
||||
// custom UI, and back again.
|
||||
wp.mce.view = {
|
||||
// ### defaults
|
||||
defaults: {
|
||||
// The default properties used for objects with the `pattern` key in
|
||||
// `wp.mce.view.add()`.
|
||||
pattern: {
|
||||
view: Backbone.View,
|
||||
text: function( instance ) {
|
||||
return instance.options.original;
|
||||
},
|
||||
|
||||
toView: function( content ) {
|
||||
if ( ! this.pattern )
|
||||
return;
|
||||
|
||||
this.pattern.lastIndex = 0;
|
||||
var match = this.pattern.exec( content );
|
||||
|
||||
if ( ! match )
|
||||
return;
|
||||
|
||||
return {
|
||||
index: match.index,
|
||||
content: match[0],
|
||||
options: {
|
||||
original: match[0],
|
||||
results: match
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
// The default properties used for objects with the `shortcode` key in
|
||||
// `wp.mce.view.add()`.
|
||||
shortcode: {
|
||||
view: Backbone.View,
|
||||
text: function( instance ) {
|
||||
return instance.options.shortcode.string();
|
||||
},
|
||||
|
||||
toView: function( content ) {
|
||||
var match = wp.shortcode.next( this.shortcode, content );
|
||||
|
||||
if ( ! match )
|
||||
return;
|
||||
|
||||
return {
|
||||
index: match.index,
|
||||
content: match.content,
|
||||
options: {
|
||||
shortcode: match.shortcode
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// ### add( id, options )
|
||||
// Registers a new TinyMCE view.
|
||||
//
|
||||
// Accepts a unique `id` and an `options` object.
|
||||
//
|
||||
// `options` accepts the following properties:
|
||||
//
|
||||
// * `pattern` is the regular expression used to scan the content and
|
||||
// detect matching views.
|
||||
//
|
||||
// * `view` is a `Backbone.View` constructor. If a plain object is
|
||||
// provided, it will automatically extend the parent constructor
|
||||
// (usually `Backbone.View`). Views are instantiated when the `pattern`
|
||||
// is successfully matched. The instance's `options` object is provided
|
||||
// with the `original` matched value, the match `results` including
|
||||
// capture groups, and the `viewType`, which is the constructor's `id`.
|
||||
//
|
||||
// * `extend` an existing view by passing in its `id`. The current
|
||||
// view will inherit all properties from the parent view, and if
|
||||
// `view` is set to a plain object, it will extend the parent `view`
|
||||
// constructor.
|
||||
//
|
||||
// * `text` is a method that accepts an instance of the `view`
|
||||
// constructor and transforms it into a text representation.
|
||||
add: function( id, options ) {
|
||||
var parent, remove, base, properties;
|
||||
|
||||
// Fetch the parent view or the default options.
|
||||
if ( options.extend )
|
||||
parent = wp.mce.view.get( options.extend );
|
||||
else if ( options.shortcode )
|
||||
parent = wp.mce.view.defaults.shortcode;
|
||||
else
|
||||
parent = wp.mce.view.defaults.pattern;
|
||||
|
||||
// Extend the `options` object with the parent's properties.
|
||||
_.defaults( options, parent );
|
||||
options.id = id;
|
||||
|
||||
// Create properties used to enhance the view for use in TinyMCE.
|
||||
properties = {
|
||||
// Ensure the wrapper element and references to the view are
|
||||
// removed. Otherwise, removed views could randomly restore.
|
||||
remove: function() {
|
||||
delete instances[ this.el.id ];
|
||||
this.$el.parent().remove();
|
||||
|
||||
// Trigger the inherited `remove` method.
|
||||
if ( remove )
|
||||
remove.apply( this, arguments );
|
||||
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
// If the `view` provided was an object, use the parent's
|
||||
// `view` constructor as a base. If a `view` constructor
|
||||
// was provided, treat that as the base.
|
||||
if ( _.isFunction( options.view ) ) {
|
||||
base = options.view;
|
||||
} else {
|
||||
base = parent.view;
|
||||
remove = options.view.remove;
|
||||
_.defaults( properties, options.view );
|
||||
}
|
||||
|
||||
// If there's a `remove` method on the `base` view that wasn't
|
||||
// created by this method, inherit it.
|
||||
if ( ! remove && ! base._mceview )
|
||||
remove = base.prototype.remove;
|
||||
|
||||
// Automatically create the new `Backbone.View` constructor.
|
||||
options.view = base.extend( properties, {
|
||||
// Flag that the new view has been created by `wp.mce.view`.
|
||||
_mceview: true
|
||||
});
|
||||
|
||||
views[ id ] = options;
|
||||
},
|
||||
|
||||
// ### get( id )
|
||||
// Returns a TinyMCE view options object.
|
||||
get: function( id ) {
|
||||
return views[ id ];
|
||||
},
|
||||
|
||||
// ### remove( id )
|
||||
// Unregisters a TinyMCE view.
|
||||
remove: function( id ) {
|
||||
delete views[ id ];
|
||||
},
|
||||
|
||||
// ### toViews( content )
|
||||
// Scans a `content` string for each view's pattern, replacing any
|
||||
// matches with wrapper elements, and creates a new view instance for
|
||||
// every match.
|
||||
//
|
||||
// To render the views, call `wp.mce.view.render( scope )`.
|
||||
toViews: function( content ) {
|
||||
var pieces = [ { content: content } ],
|
||||
current;
|
||||
|
||||
_.each( views, function( view, viewType ) {
|
||||
current = pieces.slice();
|
||||
pieces = [];
|
||||
|
||||
_.each( current, function( piece ) {
|
||||
var remaining = piece.content,
|
||||
result;
|
||||
|
||||
// Ignore processed pieces, but retain their location.
|
||||
if ( piece.processed ) {
|
||||
pieces.push( piece );
|
||||
return;
|
||||
}
|
||||
|
||||
// Iterate through the string progressively matching views
|
||||
// and slicing the string as we go.
|
||||
while ( remaining && (result = view.toView( remaining )) ) {
|
||||
// Any text before the match becomes an unprocessed piece.
|
||||
if ( result.index )
|
||||
pieces.push({ content: remaining.substring( 0, result.index ) });
|
||||
|
||||
// Add the processed piece for the match.
|
||||
pieces.push({
|
||||
content: wp.mce.view.toView( viewType, result.options ),
|
||||
processed: true
|
||||
});
|
||||
|
||||
// Update the remaining content.
|
||||
remaining = remaining.slice( result.index + result.content.length );
|
||||
}
|
||||
|
||||
// There are no additional matches. If any content remains,
|
||||
// add it as an unprocessed piece.
|
||||
if ( remaining )
|
||||
pieces.push({ content: remaining });
|
||||
});
|
||||
});
|
||||
|
||||
return _.pluck( pieces, 'content' ).join('');
|
||||
},
|
||||
|
||||
toView: function( viewType, options ) {
|
||||
var view = wp.mce.view.get( viewType ),
|
||||
instance, id;
|
||||
|
||||
if ( ! view )
|
||||
return '';
|
||||
|
||||
// Create a new view instance.
|
||||
instance = new view.view( _.extend( options || {}, {
|
||||
viewType: viewType
|
||||
}) );
|
||||
|
||||
// Use the view's `id` if it already exists. Otherwise,
|
||||
// create a new `id`.
|
||||
id = instance.el.id = instance.el.id || _.uniqueId('__wpmce-');
|
||||
instances[ id ] = instance;
|
||||
|
||||
// Create a dummy `$wrapper` property to allow `$wrapper` to be
|
||||
// called in the view's `render` method without a conditional.
|
||||
instance.$wrapper = $();
|
||||
|
||||
return wp.html.string({
|
||||
// If the view is a span, wrap it in a span.
|
||||
tag: 'span' === instance.tagName ? 'span' : 'div',
|
||||
|
||||
attrs: {
|
||||
'class': 'wp-view-wrap wp-view-type-' + viewType,
|
||||
'data-wp-view': id,
|
||||
'contenteditable': false
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// ### render( scope )
|
||||
// Renders any view instances inside a DOM node `scope`.
|
||||
//
|
||||
// View instances are detected by the presence of wrapper elements.
|
||||
// To generate wrapper elements, pass your content through
|
||||
// `wp.mce.view.toViews( content )`.
|
||||
render: function( scope ) {
|
||||
$( '.wp-view-wrap', scope ).each( function() {
|
||||
var wrapper = $(this),
|
||||
view = wp.mce.view.instance( this );
|
||||
|
||||
if ( ! view )
|
||||
return;
|
||||
|
||||
// Link the real wrapper to the view.
|
||||
view.$wrapper = wrapper;
|
||||
// Render the view.
|
||||
view.render();
|
||||
// Detach the view element to ensure events are not unbound.
|
||||
view.$el.detach();
|
||||
|
||||
// Empty the wrapper, attach the view element to the wrapper,
|
||||
// and add an ending marker to the wrapper to help regexes
|
||||
// scan the HTML string.
|
||||
wrapper.empty().append( view.el ).append('<span data-wp-view-end class="wp-view-end"></span>');
|
||||
});
|
||||
},
|
||||
|
||||
// ### toText( content )
|
||||
// Scans an HTML `content` string and replaces any view instances with
|
||||
// their respective text representations.
|
||||
toText: function( content ) {
|
||||
return content.replace( /<(?:div|span)[^>]+data-wp-view="([^"]+)"[^>]*>.*?<span[^>]+data-wp-view-end[^>]*><\/span><\/(?:div|span)>/g, function( match, id ) {
|
||||
var instance = instances[ id ],
|
||||
view;
|
||||
|
||||
if ( instance )
|
||||
view = wp.mce.view.get( instance.options.viewType );
|
||||
|
||||
return instance && view ? view.text( instance ) : '';
|
||||
});
|
||||
},
|
||||
|
||||
// ### Remove internal TinyMCE attributes.
|
||||
removeInternalAttrs: function( attrs ) {
|
||||
var result = {};
|
||||
_.each( attrs, function( value, attr ) {
|
||||
if ( -1 === attr.indexOf('data-mce') )
|
||||
result[ attr ] = value;
|
||||
});
|
||||
return result;
|
||||
},
|
||||
|
||||
// ### Parse an attribute string and removes internal TinyMCE attributes.
|
||||
attrs: function( content ) {
|
||||
return wp.mce.view.removeInternalAttrs( wp.html.attrs( content ) );
|
||||
},
|
||||
|
||||
// ### instance( scope )
|
||||
//
|
||||
// Accepts a MCE view wrapper `node` (i.e. a node with the
|
||||
// `wp-view-wrap` class).
|
||||
instance: function( node ) {
|
||||
var id = $( node ).data('wp-view');
|
||||
|
||||
if ( id )
|
||||
return instances[ id ];
|
||||
},
|
||||
|
||||
// ### Select a view.
|
||||
//
|
||||
// Accepts a MCE view wrapper `node` (i.e. a node with the
|
||||
// `wp-view-wrap` class).
|
||||
select: function( node ) {
|
||||
var $node = $(node);
|
||||
|
||||
// Bail if node is already selected.
|
||||
if ( $node.hasClass('selected') )
|
||||
return;
|
||||
|
||||
$node.addClass('selected');
|
||||
$( node.firstChild ).trigger('select');
|
||||
},
|
||||
|
||||
// ### Deselect a view.
|
||||
//
|
||||
// Accepts a MCE view wrapper `node` (i.e. a node with the
|
||||
// `wp-view-wrap` class).
|
||||
deselect: function( node ) {
|
||||
var $node = $(node);
|
||||
|
||||
// Bail if node is already selected.
|
||||
if ( ! $node.hasClass('selected') )
|
||||
return;
|
||||
|
||||
$node.removeClass('selected');
|
||||
$( node.firstChild ).trigger('deselect');
|
||||
}
|
||||
};
|
||||
|
||||
}(jQuery));
|
||||
1
wp-includes/js/mce-view.min.js
vendored
Normal file
1
wp-includes/js/mce-view.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
window.wp=window.wp||{};(function(b){var a={},c={};wp.mce=wp.mce||{};wp.mce.view={defaults:{pattern:{view:Backbone.View,text:function(d){return d.options.original},toView:function(e){if(!this.pattern){return}this.pattern.lastIndex=0;var d=this.pattern.exec(e);if(!d){return}return{index:d.index,content:d[0],options:{original:d[0],results:d}}}},shortcode:{view:Backbone.View,text:function(d){return d.options.shortcode.string()},toView:function(e){var d=wp.shortcode.next(this.shortcode,e);if(!d){return}return{index:d.index,content:d.content,options:{shortcode:d.shortcode}}}}},add:function(i,e){var g,d,h,f;if(e.extend){g=wp.mce.view.get(e.extend)}else{if(e.shortcode){g=wp.mce.view.defaults.shortcode}else{g=wp.mce.view.defaults.pattern}}_.defaults(e,g);e.id=i;f={remove:function(){delete c[this.el.id];this.$el.parent().remove();if(d){d.apply(this,arguments)}return this}};if(_.isFunction(e.view)){h=e.view}else{h=g.view;d=e.view.remove;_.defaults(f,e.view)}if(!d&&!h._mceview){d=h.prototype.remove}e.view=h.extend(f,{_mceview:true});a[i]=e},get:function(d){return a[d]},remove:function(d){delete a[d]},toViews:function(e){var d=[{content:e}],f;_.each(a,function(h,g){f=d.slice();d=[];_.each(f,function(k){var j=k.content,i;if(k.processed){d.push(k);return}while(j&&(i=h.toView(j))){if(i.index){d.push({content:j.substring(0,i.index)})}d.push({content:wp.mce.view.toView(g,i.options),processed:true});j=j.slice(i.index+i.content.length)}if(j){d.push({content:j})}})});return _.pluck(d,"content").join("")},toView:function(e,g){var f=wp.mce.view.get(e),d,h;if(!f){return""}d=new f.view(_.extend(g||{},{viewType:e}));h=d.el.id=d.el.id||_.uniqueId("__wpmce-");c[h]=d;d.$wrapper=b();return wp.html.string({tag:"span"===d.tagName?"span":"div",attrs:{"class":"wp-view-wrap wp-view-type-"+e,"data-wp-view":h,contenteditable:false}})},render:function(d){b(".wp-view-wrap",d).each(function(){var f=b(this),e=wp.mce.view.instance(this);if(!e){return}e.$wrapper=f;e.render();e.$el.detach();f.empty().append(e.el).append('<span data-wp-view-end class="wp-view-end"></span>')})},toText:function(d){return d.replace(/<(?:div|span)[^>]+data-wp-view="([^"]+)"[^>]*>.*?<span[^>]+data-wp-view-end[^>]*><\/span><\/(?:div|span)>/g,function(g,h){var e=c[h],f;if(e){f=wp.mce.view.get(e.options.viewType)}return e&&f?f.text(e):""})},removeInternalAttrs:function(e){var d={};_.each(e,function(g,f){if(-1===f.indexOf("data-mce")){d[f]=g}});return d},attrs:function(d){return wp.mce.view.removeInternalAttrs(wp.html.attrs(d))},instance:function(d){var e=b(d).data("wp-view");if(e){return c[e]}},select:function(e){var d=b(e);if(d.hasClass("selected")){return}d.addClass("selected");b(e.firstChild).trigger("select")},deselect:function(e){var d=b(e);if(!d.hasClass("selected")){return}d.removeClass("selected");b(e.firstChild).trigger("deselect")}}}(jQuery));
|
||||
649
wp-includes/js/media-editor.js
Normal file
649
wp-includes/js/media-editor.js
Normal file
@@ -0,0 +1,649 @@
|
||||
// WordPress, TinyMCE, and Media
|
||||
// -----------------------------
|
||||
(function($){
|
||||
// Stores the editors' `wp.media.controller.Frame` instances.
|
||||
var workflows = {};
|
||||
|
||||
wp.media.string = {
|
||||
// Joins the `props` and `attachment` objects,
|
||||
// outputting the proper object format based on the
|
||||
// attachment's type.
|
||||
props: function( props, attachment ) {
|
||||
var link, linkUrl, size, sizes, fallbacks,
|
||||
defaultProps = wp.media.view.settings.defaultProps;
|
||||
|
||||
// Final fallbacks run after all processing has been completed.
|
||||
fallbacks = function( props ) {
|
||||
// Generate alt fallbacks and strip tags.
|
||||
if ( 'image' === props.type && ! props.alt ) {
|
||||
props.alt = props.caption || props.title || '';
|
||||
props.alt = props.alt.replace( /<\/?[^>]+>/g, '' );
|
||||
props.alt = props.alt.replace( /[\r\n]+/g, ' ' );
|
||||
}
|
||||
|
||||
return props;
|
||||
};
|
||||
|
||||
props = props ? _.clone( props ) : {};
|
||||
|
||||
if ( attachment && attachment.type )
|
||||
props.type = attachment.type;
|
||||
|
||||
if ( 'image' === props.type ) {
|
||||
props = _.defaults( props || {}, {
|
||||
align: defaultProps.align || getUserSetting( 'align', 'none' ),
|
||||
size: defaultProps.size || getUserSetting( 'imgsize', 'medium' ),
|
||||
url: '',
|
||||
classes: []
|
||||
});
|
||||
}
|
||||
|
||||
// All attachment-specific settings follow.
|
||||
if ( ! attachment )
|
||||
return fallbacks( props );
|
||||
|
||||
props.title = props.title || attachment.title;
|
||||
|
||||
link = props.link || defaultProps.link || getUserSetting( 'urlbutton', 'file' );
|
||||
if ( 'file' === link )
|
||||
linkUrl = attachment.url;
|
||||
else if ( 'post' === link )
|
||||
linkUrl = attachment.link;
|
||||
else if ( 'custom' === link )
|
||||
linkUrl = props.linkUrl;
|
||||
props.linkUrl = linkUrl || '';
|
||||
|
||||
// Format properties for images.
|
||||
if ( 'image' === attachment.type ) {
|
||||
props.classes.push( 'wp-image-' + attachment.id );
|
||||
|
||||
sizes = attachment.sizes;
|
||||
size = sizes && sizes[ props.size ] ? sizes[ props.size ] : attachment;
|
||||
|
||||
_.extend( props, _.pick( attachment, 'align', 'caption', 'alt' ), {
|
||||
width: size.width,
|
||||
height: size.height,
|
||||
src: size.url,
|
||||
captionId: 'attachment_' + attachment.id
|
||||
});
|
||||
|
||||
// Format properties for non-images.
|
||||
} else {
|
||||
props.title = props.title || attachment.filename;
|
||||
props.rel = props.rel || 'attachment wp-att-' + attachment.id;
|
||||
}
|
||||
|
||||
return fallbacks( props );
|
||||
},
|
||||
|
||||
link: function( props, attachment ) {
|
||||
var options;
|
||||
|
||||
props = wp.media.string.props( props, attachment );
|
||||
|
||||
options = {
|
||||
tag: 'a',
|
||||
content: props.title,
|
||||
attrs: {
|
||||
href: props.linkUrl
|
||||
}
|
||||
};
|
||||
|
||||
if ( props.rel )
|
||||
options.attrs.rel = props.rel;
|
||||
|
||||
return wp.html.string( options );
|
||||
},
|
||||
|
||||
image: function( props, attachment ) {
|
||||
var img = {},
|
||||
options, classes, shortcode, html;
|
||||
|
||||
props = wp.media.string.props( props, attachment );
|
||||
classes = props.classes || [];
|
||||
|
||||
img.src = props.url;
|
||||
_.extend( img, _.pick( props, 'width', 'height', 'alt' ) );
|
||||
|
||||
// Only assign the align class to the image if we're not printing
|
||||
// a caption, since the alignment is sent to the shortcode.
|
||||
if ( props.align && ! props.caption )
|
||||
classes.push( 'align' + props.align );
|
||||
|
||||
if ( props.size )
|
||||
classes.push( 'size-' + props.size );
|
||||
|
||||
img['class'] = _.compact( classes ).join(' ');
|
||||
|
||||
// Generate `img` tag options.
|
||||
options = {
|
||||
tag: 'img',
|
||||
attrs: img,
|
||||
single: true
|
||||
};
|
||||
|
||||
// Generate the `a` element options, if they exist.
|
||||
if ( props.linkUrl ) {
|
||||
options = {
|
||||
tag: 'a',
|
||||
attrs: {
|
||||
href: props.linkUrl
|
||||
},
|
||||
content: options
|
||||
};
|
||||
}
|
||||
|
||||
html = wp.html.string( options );
|
||||
|
||||
// Generate the caption shortcode.
|
||||
if ( props.caption ) {
|
||||
shortcode = {};
|
||||
|
||||
if ( img.width )
|
||||
shortcode.width = img.width;
|
||||
|
||||
if ( props.captionId )
|
||||
shortcode.id = props.captionId;
|
||||
|
||||
if ( props.align )
|
||||
shortcode.align = 'align' + props.align;
|
||||
|
||||
html = wp.shortcode.string({
|
||||
tag: 'caption',
|
||||
attrs: shortcode,
|
||||
content: html + ' ' + props.caption
|
||||
});
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
};
|
||||
|
||||
wp.media.gallery = (function() {
|
||||
var galleries = {};
|
||||
|
||||
return {
|
||||
defaults: {
|
||||
order: 'ASC',
|
||||
id: wp.media.view.settings.post.id,
|
||||
itemtag: 'dl',
|
||||
icontag: 'dt',
|
||||
captiontag: 'dd',
|
||||
columns: '3',
|
||||
link: 'post',
|
||||
size: 'thumbnail',
|
||||
orderby: 'menu_order ID'
|
||||
},
|
||||
|
||||
attachments: function( shortcode ) {
|
||||
var shortcodeString = shortcode.string(),
|
||||
result = galleries[ shortcodeString ],
|
||||
attrs, args, query, others;
|
||||
|
||||
delete galleries[ shortcodeString ];
|
||||
|
||||
if ( result )
|
||||
return result;
|
||||
|
||||
// Fill the default shortcode attributes.
|
||||
attrs = _.defaults( shortcode.attrs.named, wp.media.gallery.defaults );
|
||||
args = _.pick( attrs, 'orderby', 'order' );
|
||||
|
||||
args.type = 'image';
|
||||
args.perPage = -1;
|
||||
|
||||
// Mark the `orderby` override attribute.
|
||||
if ( 'rand' === attrs.orderby )
|
||||
attrs._orderbyRandom = true;
|
||||
|
||||
// Map the `orderby` attribute to the corresponding model property.
|
||||
if ( ! attrs.orderby || /^menu_order(?: ID)?$/i.test( attrs.orderby ) )
|
||||
args.orderby = 'menuOrder';
|
||||
|
||||
// Map the `ids` param to the correct query args.
|
||||
if ( attrs.ids ) {
|
||||
args.post__in = attrs.ids.split(',');
|
||||
args.orderby = 'post__in';
|
||||
} else if ( attrs.include ) {
|
||||
args.post__in = attrs.include.split(',');
|
||||
}
|
||||
|
||||
if ( attrs.exclude )
|
||||
args.post__not_in = attrs.exclude.split(',');
|
||||
|
||||
if ( ! args.post__in )
|
||||
args.uploadedTo = attrs.id;
|
||||
|
||||
// Collect the attributes that were not included in `args`.
|
||||
others = _.omit( attrs, 'id', 'ids', 'include', 'exclude', 'orderby', 'order' );
|
||||
|
||||
query = wp.media.query( args );
|
||||
query.gallery = new Backbone.Model( others );
|
||||
return query;
|
||||
},
|
||||
|
||||
shortcode: function( attachments ) {
|
||||
var props = attachments.props.toJSON(),
|
||||
attrs = _.pick( props, 'orderby', 'order' ),
|
||||
shortcode, clone;
|
||||
|
||||
if ( attachments.gallery )
|
||||
_.extend( attrs, attachments.gallery.toJSON() );
|
||||
|
||||
// Convert all gallery shortcodes to use the `ids` property.
|
||||
// Ignore `post__in` and `post__not_in`; the attachments in
|
||||
// the collection will already reflect those properties.
|
||||
attrs.ids = attachments.pluck('id');
|
||||
|
||||
// Copy the `uploadedTo` post ID.
|
||||
if ( props.uploadedTo )
|
||||
attrs.id = props.uploadedTo;
|
||||
|
||||
// Check if the gallery is randomly ordered.
|
||||
if ( attrs._orderbyRandom )
|
||||
attrs.orderby = 'rand';
|
||||
delete attrs._orderbyRandom;
|
||||
|
||||
// If the `ids` attribute is set and `orderby` attribute
|
||||
// is the default value, clear it for cleaner output.
|
||||
if ( attrs.ids && 'post__in' === attrs.orderby )
|
||||
delete attrs.orderby;
|
||||
|
||||
// Remove default attributes from the shortcode.
|
||||
_.each( wp.media.gallery.defaults, function( value, key ) {
|
||||
if ( value === attrs[ key ] )
|
||||
delete attrs[ key ];
|
||||
});
|
||||
|
||||
shortcode = new wp.shortcode({
|
||||
tag: 'gallery',
|
||||
attrs: attrs,
|
||||
type: 'single'
|
||||
});
|
||||
|
||||
// Use a cloned version of the gallery.
|
||||
clone = new wp.media.model.Attachments( attachments.models, {
|
||||
props: props
|
||||
});
|
||||
clone.gallery = attachments.gallery;
|
||||
galleries[ shortcode.string() ] = clone;
|
||||
|
||||
return shortcode;
|
||||
},
|
||||
|
||||
edit: function( content ) {
|
||||
var shortcode = wp.shortcode.next( 'gallery', content ),
|
||||
defaultPostId = wp.media.gallery.defaults.id,
|
||||
attachments, selection;
|
||||
|
||||
// Bail if we didn't match the shortcode or all of the content.
|
||||
if ( ! shortcode || shortcode.content !== content )
|
||||
return;
|
||||
|
||||
// Ignore the rest of the match object.
|
||||
shortcode = shortcode.shortcode;
|
||||
|
||||
if ( _.isUndefined( shortcode.get('id') ) && ! _.isUndefined( defaultPostId ) )
|
||||
shortcode.set( 'id', defaultPostId );
|
||||
|
||||
attachments = wp.media.gallery.attachments( shortcode );
|
||||
|
||||
selection = new wp.media.model.Selection( attachments.models, {
|
||||
props: attachments.props.toJSON(),
|
||||
multiple: true
|
||||
});
|
||||
|
||||
selection.gallery = attachments.gallery;
|
||||
|
||||
// Fetch the query's attachments, and then break ties from the
|
||||
// query to allow for sorting.
|
||||
selection.more().done( function() {
|
||||
// Break ties with the query.
|
||||
selection.props.set({ query: false });
|
||||
selection.unmirror();
|
||||
selection.props.unset('orderby');
|
||||
});
|
||||
|
||||
// Destroy the previous gallery frame.
|
||||
if ( this.frame )
|
||||
this.frame.dispose();
|
||||
|
||||
// Store the current gallery frame.
|
||||
this.frame = wp.media({
|
||||
frame: 'post',
|
||||
state: 'gallery-edit',
|
||||
title: wp.media.view.l10n.editGalleryTitle,
|
||||
editing: true,
|
||||
multiple: true,
|
||||
selection: selection
|
||||
}).open();
|
||||
|
||||
return this.frame;
|
||||
}
|
||||
};
|
||||
}());
|
||||
|
||||
wp.media.featuredImage = {
|
||||
get: function() {
|
||||
return wp.media.view.settings.post.featuredImageId;
|
||||
},
|
||||
|
||||
set: function( id ) {
|
||||
var settings = wp.media.view.settings;
|
||||
|
||||
settings.post.featuredImageId = id;
|
||||
|
||||
wp.media.post( 'set-post-thumbnail', {
|
||||
json: true,
|
||||
post_id: settings.post.id,
|
||||
thumbnail_id: settings.post.featuredImageId,
|
||||
_wpnonce: settings.post.nonce
|
||||
}).done( function( html ) {
|
||||
$( '.inside', '#postimagediv' ).html( html );
|
||||
});
|
||||
},
|
||||
|
||||
frame: function() {
|
||||
if ( this._frame )
|
||||
return this._frame;
|
||||
|
||||
this._frame = wp.media({
|
||||
state: 'featured-image',
|
||||
states: [ new wp.media.controller.FeaturedImage() ]
|
||||
});
|
||||
|
||||
this._frame.on( 'toolbar:create:featured-image', function( toolbar ) {
|
||||
this.createSelectToolbar( toolbar, {
|
||||
text: wp.media.view.l10n.setFeaturedImage
|
||||
});
|
||||
}, this._frame );
|
||||
|
||||
this._frame.state('featured-image').on( 'select', this.select );
|
||||
return this._frame;
|
||||
},
|
||||
|
||||
select: function() {
|
||||
var settings = wp.media.view.settings,
|
||||
selection = this.get('selection').single();
|
||||
|
||||
if ( ! settings.post.featuredImageId )
|
||||
return;
|
||||
|
||||
wp.media.featuredImage.set( selection ? selection.id : -1 );
|
||||
},
|
||||
|
||||
init: function() {
|
||||
// Open the content media manager to the 'featured image' tab when
|
||||
// the post thumbnail is clicked.
|
||||
$('#postimagediv').on( 'click', '#set-post-thumbnail', function( event ) {
|
||||
event.preventDefault();
|
||||
// Stop propagation to prevent thickbox from activating.
|
||||
event.stopPropagation();
|
||||
|
||||
wp.media.featuredImage.frame().open();
|
||||
|
||||
// Update the featured image id when the 'remove' link is clicked.
|
||||
}).on( 'click', '#remove-post-thumbnail', function() {
|
||||
wp.media.view.settings.post.featuredImageId = -1;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$( wp.media.featuredImage.init );
|
||||
|
||||
wp.media.editor = {
|
||||
insert: function( h ) {
|
||||
var mce = typeof(tinymce) != 'undefined',
|
||||
qt = typeof(QTags) != 'undefined',
|
||||
wpActiveEditor = window.wpActiveEditor,
|
||||
ed;
|
||||
|
||||
// Delegate to the global `send_to_editor` if it exists.
|
||||
// This attempts to play nice with any themes/plugins that have
|
||||
// overridden the insert functionality.
|
||||
if ( window.send_to_editor )
|
||||
return window.send_to_editor.apply( this, arguments );
|
||||
|
||||
if ( ! wpActiveEditor ) {
|
||||
if ( mce && tinymce.activeEditor ) {
|
||||
ed = tinymce.activeEditor;
|
||||
wpActiveEditor = window.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') !== -1 ) {
|
||||
if ( ed.wpSetImgCaption )
|
||||
h = ed.wpSetImgCaption(h);
|
||||
} else if ( h.indexOf('[gallery') !== -1 ) {
|
||||
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;
|
||||
}
|
||||
|
||||
// If the old thickbox remove function exists, call it in case
|
||||
// a theme/plugin overloaded it.
|
||||
if ( window.tb_remove )
|
||||
try { window.tb_remove(); } catch( e ) {}
|
||||
},
|
||||
|
||||
add: function( id, options ) {
|
||||
var workflow = this.get( id );
|
||||
|
||||
if ( workflow )
|
||||
return workflow;
|
||||
|
||||
workflow = workflows[ id ] = wp.media( _.defaults( options || {}, {
|
||||
frame: 'post',
|
||||
state: 'insert',
|
||||
title: wp.media.view.l10n.addMedia,
|
||||
multiple: true
|
||||
} ) );
|
||||
|
||||
workflow.on( 'insert', function( selection ) {
|
||||
var state = workflow.state();
|
||||
|
||||
selection = selection || state.get('selection');
|
||||
|
||||
if ( ! selection )
|
||||
return;
|
||||
|
||||
$.when.apply( $, selection.map( function( attachment ) {
|
||||
var display = state.display( attachment ).toJSON();
|
||||
return this.send.attachment( display, attachment.toJSON() );
|
||||
}, this ) ).done( function() {
|
||||
wp.media.editor.insert( _.toArray( arguments ).join("\n\n") );
|
||||
});
|
||||
}, this );
|
||||
|
||||
workflow.state('gallery-edit').on( 'update', function( selection ) {
|
||||
this.insert( wp.media.gallery.shortcode( selection ).string() );
|
||||
}, this );
|
||||
|
||||
workflow.state('embed').on( 'select', function() {
|
||||
var state = workflow.state(),
|
||||
type = state.get('type'),
|
||||
embed = state.props.toJSON();
|
||||
|
||||
embed.url = embed.url || '';
|
||||
|
||||
if ( 'link' === type ) {
|
||||
_.defaults( embed, {
|
||||
title: embed.url,
|
||||
linkUrl: embed.url
|
||||
});
|
||||
|
||||
this.send.link( embed ).done( function( resp ) {
|
||||
wp.media.editor.insert( resp );
|
||||
});
|
||||
|
||||
} else if ( 'image' === type ) {
|
||||
_.defaults( embed, {
|
||||
title: embed.url,
|
||||
linkUrl: '',
|
||||
align: 'none',
|
||||
link: 'none'
|
||||
});
|
||||
|
||||
if ( 'none' === embed.link )
|
||||
embed.linkUrl = '';
|
||||
else if ( 'file' === embed.link )
|
||||
embed.linkUrl = embed.url;
|
||||
|
||||
this.insert( wp.media.string.image( embed ) );
|
||||
}
|
||||
}, this );
|
||||
|
||||
workflow.state('featured-image').on( 'select', wp.media.featuredImage.select );
|
||||
workflow.setState( workflow.options.state );
|
||||
return workflow;
|
||||
},
|
||||
|
||||
id: function( id ) {
|
||||
if ( id )
|
||||
return id;
|
||||
|
||||
// If an empty `id` is provided, default to `wpActiveEditor`.
|
||||
id = wpActiveEditor;
|
||||
|
||||
// If that doesn't work, fall back to `tinymce.activeEditor.id`.
|
||||
if ( ! id && typeof tinymce !== 'undefined' && tinymce.activeEditor )
|
||||
id = tinymce.activeEditor.id;
|
||||
|
||||
// Last but not least, fall back to the empty string.
|
||||
id = id || '';
|
||||
return id;
|
||||
},
|
||||
|
||||
get: function( id ) {
|
||||
id = this.id( id );
|
||||
return workflows[ id ];
|
||||
},
|
||||
|
||||
remove: function( id ) {
|
||||
id = this.id( id );
|
||||
delete workflows[ id ];
|
||||
},
|
||||
|
||||
send: {
|
||||
attachment: function( props, attachment ) {
|
||||
var caption = attachment.caption,
|
||||
options, html;
|
||||
|
||||
// If captions are disabled, clear the caption.
|
||||
if ( ! wp.media.view.settings.captions )
|
||||
delete attachment.caption;
|
||||
|
||||
props = wp.media.string.props( props, attachment );
|
||||
|
||||
options = {
|
||||
id: attachment.id,
|
||||
post_content: attachment.description,
|
||||
post_excerpt: caption
|
||||
};
|
||||
|
||||
if ( props.linkUrl )
|
||||
options.url = props.linkUrl;
|
||||
|
||||
if ( 'image' === attachment.type ) {
|
||||
html = wp.media.string.image( props );
|
||||
|
||||
_.each({
|
||||
align: 'align',
|
||||
size: 'image-size',
|
||||
alt: 'image_alt'
|
||||
}, function( option, prop ) {
|
||||
if ( props[ prop ] )
|
||||
options[ option ] = props[ prop ];
|
||||
});
|
||||
|
||||
} else {
|
||||
html = wp.media.string.link( props );
|
||||
options.post_title = props.title;
|
||||
}
|
||||
|
||||
return wp.media.post( 'send-attachment-to-editor', {
|
||||
nonce: wp.media.view.settings.nonce.sendToEditor,
|
||||
attachment: options,
|
||||
html: html,
|
||||
post_id: wp.media.view.settings.post.id
|
||||
});
|
||||
},
|
||||
|
||||
link: function( embed ) {
|
||||
return wp.media.post( 'send-link-to-editor', {
|
||||
nonce: wp.media.view.settings.nonce.sendToEditor,
|
||||
src: embed.linkUrl,
|
||||
title: embed.title,
|
||||
html: wp.media.string.link( embed ),
|
||||
post_id: wp.media.view.settings.post.id
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
open: function( id ) {
|
||||
var workflow, editor;
|
||||
|
||||
id = this.id( id );
|
||||
|
||||
// Save a bookmark of the caret position in IE.
|
||||
if ( typeof tinymce !== 'undefined' ) {
|
||||
editor = tinymce.get( id );
|
||||
|
||||
if ( tinymce.isIE && editor && ! editor.isHidden() ) {
|
||||
editor.focus();
|
||||
editor.windowManager.insertimagebookmark = editor.selection.getBookmark();
|
||||
}
|
||||
}
|
||||
|
||||
workflow = this.get( id );
|
||||
|
||||
// Initialize the editor's workflow if we haven't yet.
|
||||
if ( ! workflow )
|
||||
workflow = this.add( id );
|
||||
|
||||
return workflow.open();
|
||||
},
|
||||
|
||||
init: function() {
|
||||
$(document.body).on( 'click', '.insert-media', function( event ) {
|
||||
var $this = $(this),
|
||||
editor = $this.data('editor');
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
// Remove focus from the `.insert-media` button.
|
||||
// Prevents Opera from showing the outline of the button
|
||||
// above the modal.
|
||||
//
|
||||
// See: http://core.trac.wordpress.org/ticket/22445
|
||||
$this.blur();
|
||||
|
||||
wp.media.editor.open( editor );
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
_.bindAll( wp.media.editor, 'open' );
|
||||
$( wp.media.editor.init );
|
||||
}(jQuery));
|
||||
1
wp-includes/js/media-editor.min.js
vendored
Normal file
1
wp-includes/js/media-editor.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
908
wp-includes/js/media-models.js
Normal file
908
wp-includes/js/media-models.js
Normal file
@@ -0,0 +1,908 @@
|
||||
window.wp = window.wp || {};
|
||||
|
||||
(function($){
|
||||
var Attachment, Attachments, Query, compare, l10n, media;
|
||||
|
||||
/**
|
||||
* wp.media( attributes )
|
||||
*
|
||||
* Handles the default media experience. Automatically creates
|
||||
* and opens a media frame, and returns the result.
|
||||
* Does nothing if the controllers do not exist.
|
||||
*
|
||||
* @param {object} attributes The properties passed to the main media controller.
|
||||
* @return {object} A media workflow.
|
||||
*/
|
||||
media = wp.media = function( attributes ) {
|
||||
var MediaFrame = media.view.MediaFrame,
|
||||
frame;
|
||||
|
||||
if ( ! MediaFrame )
|
||||
return;
|
||||
|
||||
attributes = _.defaults( attributes || {}, {
|
||||
frame: 'select'
|
||||
});
|
||||
|
||||
if ( 'select' === attributes.frame && MediaFrame.Select )
|
||||
frame = new MediaFrame.Select( attributes );
|
||||
else if ( 'post' === attributes.frame && MediaFrame.Post )
|
||||
frame = new MediaFrame.Post( attributes );
|
||||
|
||||
delete attributes.frame;
|
||||
|
||||
return frame;
|
||||
};
|
||||
|
||||
_.extend( media, { model: {}, view: {}, controller: {}, frames: {} });
|
||||
|
||||
// Link any localized strings.
|
||||
l10n = media.model.l10n = typeof _wpMediaModelsL10n === 'undefined' ? {} : _wpMediaModelsL10n;
|
||||
|
||||
// Link any settings.
|
||||
media.model.settings = l10n.settings || {};
|
||||
delete l10n.settings;
|
||||
|
||||
/**
|
||||
* ========================================================================
|
||||
* UTILITIES
|
||||
* ========================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* A basic comparator.
|
||||
*
|
||||
* @param {mixed} a The primary parameter to compare.
|
||||
* @param {mixed} b The primary parameter to compare.
|
||||
* @param {string} ac The fallback parameter to compare, a's cid.
|
||||
* @param {string} bc The fallback parameter to compare, b's cid.
|
||||
* @return {number} -1: a should come before b.
|
||||
* 0: a and b are of the same rank.
|
||||
* 1: b should come before a.
|
||||
*/
|
||||
compare = function( a, b, ac, bc ) {
|
||||
if ( _.isEqual( a, b ) )
|
||||
return ac === bc ? 0 : (ac > bc ? -1 : 1);
|
||||
else
|
||||
return a > b ? -1 : 1;
|
||||
};
|
||||
|
||||
_.extend( media, {
|
||||
/**
|
||||
* media.template( id )
|
||||
*
|
||||
* Fetches a template by id.
|
||||
*
|
||||
* @param {string} id A string that corresponds to a DOM element with an id prefixed with "tmpl-".
|
||||
* For example, "attachment" maps to "tmpl-attachment".
|
||||
* @return {function} A function that lazily-compiles the template requested.
|
||||
*/
|
||||
template: _.memoize( function( id ) {
|
||||
var compiled,
|
||||
options = {
|
||||
evaluate: /<#([\s\S]+?)#>/g,
|
||||
interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
|
||||
escape: /\{\{([^\}]+?)\}\}(?!\})/g,
|
||||
variable: 'data'
|
||||
};
|
||||
|
||||
return function( data ) {
|
||||
compiled = compiled || _.template( $( '#tmpl-' + id ).html(), null, options );
|
||||
return compiled( data );
|
||||
};
|
||||
}),
|
||||
|
||||
/**
|
||||
* media.post( [action], [data] )
|
||||
*
|
||||
* Sends a POST request to WordPress.
|
||||
*
|
||||
* @param {string} action The slug of the action to fire in WordPress.
|
||||
* @param {object} data The data to populate $_POST with.
|
||||
* @return {$.promise} A jQuery promise that represents the request.
|
||||
*/
|
||||
post: function( action, data ) {
|
||||
return media.ajax({
|
||||
data: _.isObject( action ) ? action : _.extend( data || {}, { action: action })
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* media.ajax( [action], [options] )
|
||||
*
|
||||
* Sends a POST request to WordPress.
|
||||
*
|
||||
* @param {string} action The slug of the action to fire in WordPress.
|
||||
* @param {object} options The options passed to jQuery.ajax.
|
||||
* @return {$.promise} A jQuery promise that represents the request.
|
||||
*/
|
||||
ajax: function( action, options ) {
|
||||
if ( _.isObject( action ) ) {
|
||||
options = action;
|
||||
} else {
|
||||
options = options || {};
|
||||
options.data = _.extend( options.data || {}, { action: action });
|
||||
}
|
||||
|
||||
options = _.defaults( options || {}, {
|
||||
type: 'POST',
|
||||
url: media.model.settings.ajaxurl,
|
||||
context: this
|
||||
});
|
||||
|
||||
return $.Deferred( function( deferred ) {
|
||||
// Transfer success/error callbacks.
|
||||
if ( options.success )
|
||||
deferred.done( options.success );
|
||||
if ( options.error )
|
||||
deferred.fail( options.error );
|
||||
|
||||
delete options.success;
|
||||
delete options.error;
|
||||
|
||||
// Use with PHP's wp_send_json_success() and wp_send_json_error()
|
||||
$.ajax( options ).done( function( response ) {
|
||||
// Treat a response of `1` as successful for backwards
|
||||
// compatibility with existing handlers.
|
||||
if ( response === '1' || response === 1 )
|
||||
response = { success: true };
|
||||
|
||||
if ( _.isObject( response ) && ! _.isUndefined( response.success ) )
|
||||
deferred[ response.success ? 'resolveWith' : 'rejectWith' ]( this, [response.data] );
|
||||
else
|
||||
deferred.rejectWith( this, [response] );
|
||||
}).fail( function() {
|
||||
deferred.rejectWith( this, arguments );
|
||||
});
|
||||
}).promise();
|
||||
},
|
||||
|
||||
// Scales a set of dimensions to fit within bounding dimensions.
|
||||
fit: function( dimensions ) {
|
||||
var width = dimensions.width,
|
||||
height = dimensions.height,
|
||||
maxWidth = dimensions.maxWidth,
|
||||
maxHeight = dimensions.maxHeight,
|
||||
constraint;
|
||||
|
||||
// Compare ratios between the two values to determine which
|
||||
// max to constrain by. If a max value doesn't exist, then the
|
||||
// opposite side is the constraint.
|
||||
if ( ! _.isUndefined( maxWidth ) && ! _.isUndefined( maxHeight ) ) {
|
||||
constraint = ( width / height > maxWidth / maxHeight ) ? 'width' : 'height';
|
||||
} else if ( _.isUndefined( maxHeight ) ) {
|
||||
constraint = 'width';
|
||||
} else if ( _.isUndefined( maxWidth ) && height > maxHeight ) {
|
||||
constraint = 'height';
|
||||
}
|
||||
|
||||
// If the value of the constrained side is larger than the max,
|
||||
// then scale the values. Otherwise return the originals; they fit.
|
||||
if ( 'width' === constraint && width > maxWidth ) {
|
||||
return {
|
||||
width : maxWidth,
|
||||
height: Math.round( maxWidth * height / width )
|
||||
};
|
||||
} else if ( 'height' === constraint && height > maxHeight ) {
|
||||
return {
|
||||
width : Math.round( maxHeight * width / height ),
|
||||
height: maxHeight
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
width : width,
|
||||
height: height
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
// Truncates a string by injecting an ellipsis into the middle.
|
||||
// Useful for filenames.
|
||||
truncate: function( string, length, replacement ) {
|
||||
length = length || 30;
|
||||
replacement = replacement || '…';
|
||||
|
||||
if ( string.length <= length )
|
||||
return string;
|
||||
|
||||
return string.substr( 0, length / 2 ) + replacement + string.substr( -1 * length / 2 );
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* ========================================================================
|
||||
* MODELS
|
||||
* ========================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* wp.media.attachment
|
||||
*/
|
||||
media.attachment = function( id ) {
|
||||
return Attachment.get( id );
|
||||
};
|
||||
|
||||
/**
|
||||
* wp.media.model.Attachment
|
||||
*/
|
||||
Attachment = media.model.Attachment = Backbone.Model.extend({
|
||||
sync: function( method, model, options ) {
|
||||
// If the attachment does not yet have an `id`, return an instantly
|
||||
// rejected promise. Otherwise, all of our requests will fail.
|
||||
if ( _.isUndefined( this.id ) )
|
||||
return $.Deferred().rejectWith( this ).promise();
|
||||
|
||||
// Overload the `read` request so Attachment.fetch() functions correctly.
|
||||
if ( 'read' === method ) {
|
||||
options = options || {};
|
||||
options.context = this;
|
||||
options.data = _.extend( options.data || {}, {
|
||||
action: 'get-attachment',
|
||||
id: this.id
|
||||
});
|
||||
return media.ajax( options );
|
||||
|
||||
// Overload the `update` request so properties can be saved.
|
||||
} else if ( 'update' === method ) {
|
||||
// If we do not have the necessary nonce, fail immeditately.
|
||||
if ( ! this.get('nonces') || ! this.get('nonces').update )
|
||||
return $.Deferred().rejectWith( this ).promise();
|
||||
|
||||
options = options || {};
|
||||
options.context = this;
|
||||
|
||||
// Set the action and ID.
|
||||
options.data = _.extend( options.data || {}, {
|
||||
action: 'save-attachment',
|
||||
id: this.id,
|
||||
nonce: this.get('nonces').update,
|
||||
post_id: media.model.settings.post.id
|
||||
});
|
||||
|
||||
// Record the values of the changed attributes.
|
||||
if ( options.changes ) {
|
||||
_.each( options.changes, function( value, key ) {
|
||||
options.changes[ key ] = this.get( key );
|
||||
}, this );
|
||||
|
||||
options.data.changes = options.changes;
|
||||
delete options.changes;
|
||||
}
|
||||
|
||||
return media.ajax( options );
|
||||
|
||||
// Overload the `delete` request so attachments can be removed.
|
||||
// This will permanently delete an attachment.
|
||||
} else if ( 'delete' === method ) {
|
||||
options = options || {};
|
||||
|
||||
if ( ! options.wait )
|
||||
this.destroyed = true;
|
||||
|
||||
options.context = this;
|
||||
options.data = _.extend( options.data || {}, {
|
||||
action: 'delete-post',
|
||||
id: this.id,
|
||||
_wpnonce: this.get('nonces')['delete']
|
||||
});
|
||||
|
||||
return media.ajax( options ).done( function() {
|
||||
this.destroyed = true;
|
||||
}).fail( function() {
|
||||
this.destroyed = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
parse: function( resp, xhr ) {
|
||||
if ( ! resp )
|
||||
return resp;
|
||||
|
||||
// Convert date strings into Date objects.
|
||||
resp.date = new Date( resp.date );
|
||||
resp.modified = new Date( resp.modified );
|
||||
return resp;
|
||||
},
|
||||
|
||||
saveCompat: function( data, options ) {
|
||||
var model = this;
|
||||
|
||||
// If we do not have the necessary nonce, fail immeditately.
|
||||
if ( ! this.get('nonces') || ! this.get('nonces').update )
|
||||
return $.Deferred().rejectWith( this ).promise();
|
||||
|
||||
return media.post( 'save-attachment-compat', _.defaults({
|
||||
id: this.id,
|
||||
nonce: this.get('nonces').update,
|
||||
post_id: media.model.settings.post.id
|
||||
}, data ) ).done( function( resp, status, xhr ) {
|
||||
model.set( model.parse( resp, xhr ), options );
|
||||
});
|
||||
}
|
||||
}, {
|
||||
create: function( attrs ) {
|
||||
return Attachments.all.push( attrs );
|
||||
},
|
||||
|
||||
get: _.memoize( function( id, attachment ) {
|
||||
return Attachments.all.push( attachment || { id: id } );
|
||||
})
|
||||
});
|
||||
|
||||
/**
|
||||
* wp.media.model.Attachments
|
||||
*/
|
||||
Attachments = media.model.Attachments = Backbone.Collection.extend({
|
||||
model: Attachment,
|
||||
|
||||
initialize: function( models, options ) {
|
||||
options = options || {};
|
||||
|
||||
this.props = new Backbone.Model();
|
||||
this.filters = options.filters || {};
|
||||
|
||||
// Bind default `change` events to the `props` model.
|
||||
this.props.on( 'change', this._changeFilteredProps, this );
|
||||
|
||||
this.props.on( 'change:order', this._changeOrder, this );
|
||||
this.props.on( 'change:orderby', this._changeOrderby, this );
|
||||
this.props.on( 'change:query', this._changeQuery, this );
|
||||
|
||||
// Set the `props` model and fill the default property values.
|
||||
this.props.set( _.defaults( options.props || {} ) );
|
||||
|
||||
// Observe another `Attachments` collection if one is provided.
|
||||
if ( options.observe )
|
||||
this.observe( options.observe );
|
||||
},
|
||||
|
||||
// Automatically sort the collection when the order changes.
|
||||
_changeOrder: function( model, order ) {
|
||||
if ( this.comparator )
|
||||
this.sort();
|
||||
},
|
||||
|
||||
// Set the default comparator only when the `orderby` property is set.
|
||||
_changeOrderby: function( model, orderby ) {
|
||||
// If a different comparator is defined, bail.
|
||||
if ( this.comparator && this.comparator !== Attachments.comparator )
|
||||
return;
|
||||
|
||||
if ( orderby && 'post__in' !== orderby )
|
||||
this.comparator = Attachments.comparator;
|
||||
else
|
||||
delete this.comparator;
|
||||
},
|
||||
|
||||
// If the `query` property is set to true, query the server using
|
||||
// the `props` values, and sync the results to this collection.
|
||||
_changeQuery: function( model, query ) {
|
||||
if ( query ) {
|
||||
this.props.on( 'change', this._requery, this );
|
||||
this._requery();
|
||||
} else {
|
||||
this.props.off( 'change', this._requery, this );
|
||||
}
|
||||
},
|
||||
|
||||
_changeFilteredProps: function( model, options ) {
|
||||
// If this is a query, updating the collection will be handled by
|
||||
// `this._requery()`.
|
||||
if ( this.props.get('query') )
|
||||
return;
|
||||
|
||||
var changed = _.chain( options.changes ).map( function( t, prop ) {
|
||||
var filter = Attachments.filters[ prop ],
|
||||
term = model.get( prop );
|
||||
|
||||
if ( ! filter )
|
||||
return;
|
||||
|
||||
if ( term && ! this.filters[ prop ] )
|
||||
this.filters[ prop ] = filter;
|
||||
else if ( ! term && this.filters[ prop ] === filter )
|
||||
delete this.filters[ prop ];
|
||||
else
|
||||
return;
|
||||
|
||||
// Record the change.
|
||||
return true;
|
||||
}, this ).any().value();
|
||||
|
||||
if ( ! changed )
|
||||
return;
|
||||
|
||||
// If no `Attachments` model is provided to source the searches
|
||||
// from, then automatically generate a source from the existing
|
||||
// models.
|
||||
if ( ! this._source )
|
||||
this._source = new Attachments( this.models );
|
||||
|
||||
this.reset( this._source.filter( this.validator, this ) );
|
||||
},
|
||||
|
||||
validateDestroyed: false,
|
||||
|
||||
validator: function( attachment ) {
|
||||
if ( ! this.validateDestroyed && attachment.destroyed )
|
||||
return false;
|
||||
return _.all( this.filters, function( filter, key ) {
|
||||
return !! filter.call( this, attachment );
|
||||
}, this );
|
||||
},
|
||||
|
||||
validate: function( attachment, options ) {
|
||||
var valid = this.validator( attachment ),
|
||||
hasAttachment = !! this.getByCid( attachment.cid );
|
||||
|
||||
if ( ! valid && hasAttachment )
|
||||
this.remove( attachment, options );
|
||||
else if ( valid && ! hasAttachment )
|
||||
this.add( attachment, options );
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
validateAll: function( attachments, options ) {
|
||||
options = options || {};
|
||||
|
||||
_.each( attachments.models, function( attachment ) {
|
||||
this.validate( attachment, { silent: true });
|
||||
}, this );
|
||||
|
||||
if ( ! options.silent )
|
||||
this.trigger( 'reset', this, options );
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
observe: function( attachments ) {
|
||||
this.observers = this.observers || [];
|
||||
this.observers.push( attachments );
|
||||
|
||||
attachments.on( 'add change remove', this._validateHandler, this );
|
||||
attachments.on( 'reset', this._validateAllHandler, this );
|
||||
|
||||
this.validateAll( attachments );
|
||||
return this;
|
||||
},
|
||||
|
||||
unobserve: function( attachments ) {
|
||||
if ( attachments ) {
|
||||
attachments.off( null, null, this );
|
||||
this.observers = _.without( this.observers, attachments );
|
||||
|
||||
} else {
|
||||
_.each( this.observers, function( attachments ) {
|
||||
attachments.off( null, null, this );
|
||||
}, this );
|
||||
delete this.observers;
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
_validateHandler: function( attachment, attachments, options ) {
|
||||
// If we're not mirroring this `attachments` collection,
|
||||
// only retain the `silent` option.
|
||||
options = attachments === this.mirroring ? options : {
|
||||
silent: options && options.silent
|
||||
};
|
||||
|
||||
return this.validate( attachment, options );
|
||||
},
|
||||
|
||||
_validateAllHandler: function( attachments, options ) {
|
||||
return this.validateAll( attachments, options );
|
||||
},
|
||||
|
||||
mirror: function( attachments ) {
|
||||
if ( this.mirroring && this.mirroring === attachments )
|
||||
return this;
|
||||
|
||||
this.unmirror();
|
||||
this.mirroring = attachments;
|
||||
|
||||
// Clear the collection silently. A `reset` event will be fired
|
||||
// when `observe()` calls `validateAll()`.
|
||||
this.reset( [], { silent: true } );
|
||||
this.observe( attachments );
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
unmirror: function() {
|
||||
if ( ! this.mirroring )
|
||||
return;
|
||||
|
||||
this.unobserve( this.mirroring );
|
||||
delete this.mirroring;
|
||||
},
|
||||
|
||||
more: function( options ) {
|
||||
var deferred = $.Deferred(),
|
||||
mirroring = this.mirroring,
|
||||
attachments = this;
|
||||
|
||||
if ( ! mirroring || ! mirroring.more )
|
||||
return deferred.resolveWith( this ).promise();
|
||||
|
||||
// If we're mirroring another collection, forward `more` to
|
||||
// the mirrored collection. Account for a race condition by
|
||||
// checking if we're still mirroring that collection when
|
||||
// the request resolves.
|
||||
mirroring.more( options ).done( function() {
|
||||
if ( this === attachments.mirroring )
|
||||
deferred.resolveWith( this );
|
||||
});
|
||||
|
||||
return deferred.promise();
|
||||
},
|
||||
|
||||
hasMore: function() {
|
||||
return this.mirroring ? this.mirroring.hasMore() : false;
|
||||
},
|
||||
|
||||
parse: function( resp, xhr ) {
|
||||
return _.map( resp, function( attrs ) {
|
||||
var attachment = Attachment.get( attrs.id );
|
||||
return attachment.set( attachment.parse( attrs, xhr ) );
|
||||
});
|
||||
},
|
||||
|
||||
_requery: function() {
|
||||
if ( this.props.get('query') )
|
||||
this.mirror( Query.get( this.props.toJSON() ) );
|
||||
},
|
||||
|
||||
// If this collection is sorted by `menuOrder`, recalculates and saves
|
||||
// the menu order to the database.
|
||||
saveMenuOrder: function() {
|
||||
if ( 'menuOrder' !== this.props.get('orderby') )
|
||||
return;
|
||||
|
||||
// Removes any uploading attachments, updates each attachment's
|
||||
// menu order, and returns an object with an { id: menuOrder }
|
||||
// mapping to pass to the request.
|
||||
var attachments = this.chain().filter( function( attachment ) {
|
||||
return ! _.isUndefined( attachment.id );
|
||||
}).map( function( attachment, index ) {
|
||||
// Indices start at 1.
|
||||
index = index + 1;
|
||||
attachment.set( 'menuOrder', index );
|
||||
return [ attachment.id, index ];
|
||||
}).object().value();
|
||||
|
||||
if ( _.isEmpty( attachments ) )
|
||||
return;
|
||||
|
||||
return media.post( 'save-attachment-order', {
|
||||
nonce: media.model.settings.post.nonce,
|
||||
post_id: media.model.settings.post.id,
|
||||
attachments: attachments
|
||||
});
|
||||
}
|
||||
}, {
|
||||
comparator: function( a, b, options ) {
|
||||
var key = this.props.get('orderby'),
|
||||
order = this.props.get('order') || 'DESC',
|
||||
ac = a.cid,
|
||||
bc = b.cid;
|
||||
|
||||
a = a.get( key );
|
||||
b = b.get( key );
|
||||
|
||||
if ( 'date' === key || 'modified' === key ) {
|
||||
a = a || new Date();
|
||||
b = b || new Date();
|
||||
}
|
||||
|
||||
// If `options.ties` is set, don't enforce the `cid` tiebreaker.
|
||||
if ( options && options.ties )
|
||||
ac = bc = null;
|
||||
|
||||
return ( 'DESC' === order ) ? compare( a, b, ac, bc ) : compare( b, a, bc, ac );
|
||||
},
|
||||
|
||||
filters: {
|
||||
// Note that this client-side searching is *not* equivalent
|
||||
// to our server-side searching.
|
||||
search: function( attachment ) {
|
||||
if ( ! this.props.get('search') )
|
||||
return true;
|
||||
|
||||
return _.any(['title','filename','description','caption','name'], function( key ) {
|
||||
var value = attachment.get( key );
|
||||
return value && -1 !== value.search( this.props.get('search') );
|
||||
}, this );
|
||||
},
|
||||
|
||||
type: function( attachment ) {
|
||||
var type = this.props.get('type');
|
||||
return ! type || -1 !== type.indexOf( attachment.get('type') );
|
||||
},
|
||||
|
||||
uploadedTo: function( attachment ) {
|
||||
var uploadedTo = this.props.get('uploadedTo');
|
||||
if ( _.isUndefined( uploadedTo ) )
|
||||
return true;
|
||||
|
||||
return uploadedTo === attachment.get('uploadedTo');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Attachments.all = new Attachments();
|
||||
|
||||
/**
|
||||
* wp.media.query
|
||||
*/
|
||||
media.query = function( props ) {
|
||||
return new Attachments( null, {
|
||||
props: _.extend( _.defaults( props || {}, { orderby: 'date' } ), { query: true } )
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* wp.media.model.Query
|
||||
*
|
||||
* A set of attachments that corresponds to a set of consecutively paged
|
||||
* queries on the server.
|
||||
*
|
||||
* Note: Do NOT change this.args after the query has been initialized.
|
||||
* Things will break.
|
||||
*/
|
||||
Query = media.model.Query = Attachments.extend({
|
||||
initialize: function( models, options ) {
|
||||
var allowed;
|
||||
|
||||
options = options || {};
|
||||
Attachments.prototype.initialize.apply( this, arguments );
|
||||
|
||||
this.args = options.args;
|
||||
this._hasMore = true;
|
||||
this.created = new Date();
|
||||
|
||||
this.filters.order = function( attachment ) {
|
||||
var orderby = this.props.get('orderby'),
|
||||
order = this.props.get('order');
|
||||
|
||||
if ( ! this.comparator )
|
||||
return true;
|
||||
|
||||
// We want any items that can be placed before the last
|
||||
// item in the set. If we add any items after the last
|
||||
// item, then we can't guarantee the set is complete.
|
||||
if ( this.length ) {
|
||||
return 1 !== this.comparator( attachment, this.last(), { ties: true });
|
||||
|
||||
// Handle the case where there are no items yet and
|
||||
// we're sorting for recent items. In that case, we want
|
||||
// changes that occurred after we created the query.
|
||||
} else if ( 'DESC' === order && ( 'date' === orderby || 'modified' === orderby ) ) {
|
||||
return attachment.get( orderby ) >= this.created;
|
||||
|
||||
// If we're sorting by menu order and we have no items,
|
||||
// accept any items that have the default menu order (0).
|
||||
} else if ( 'ASC' === order && 'menuOrder' === orderby ) {
|
||||
return attachment.get( orderby ) === 0;
|
||||
}
|
||||
|
||||
// Otherwise, we don't want any items yet.
|
||||
return false;
|
||||
};
|
||||
|
||||
// Observe the central `wp.Uploader.queue` collection to watch for
|
||||
// new matches for the query.
|
||||
//
|
||||
// Only observe when a limited number of query args are set. There
|
||||
// are no filters for other properties, so observing will result in
|
||||
// false positives in those queries.
|
||||
allowed = [ 's', 'order', 'orderby', 'posts_per_page', 'post_mime_type', 'post_parent' ];
|
||||
if ( wp.Uploader && _( this.args ).chain().keys().difference( allowed ).isEmpty().value() )
|
||||
this.observe( wp.Uploader.queue );
|
||||
},
|
||||
|
||||
hasMore: function() {
|
||||
return this._hasMore;
|
||||
},
|
||||
|
||||
more: function( options ) {
|
||||
var query = this;
|
||||
|
||||
if ( this._more && 'pending' === this._more.state() )
|
||||
return this._more;
|
||||
|
||||
if ( ! this.hasMore() )
|
||||
return $.Deferred().resolveWith( this ).promise();
|
||||
|
||||
options = options || {};
|
||||
options.add = true;
|
||||
|
||||
return this._more = this.fetch( options ).done( function( resp ) {
|
||||
if ( _.isEmpty( resp ) || -1 === this.args.posts_per_page || resp.length < this.args.posts_per_page )
|
||||
query._hasMore = false;
|
||||
});
|
||||
},
|
||||
|
||||
sync: function( method, model, options ) {
|
||||
var fallback;
|
||||
|
||||
// Overload the read method so Attachment.fetch() functions correctly.
|
||||
if ( 'read' === method ) {
|
||||
options = options || {};
|
||||
options.context = this;
|
||||
options.data = _.extend( options.data || {}, {
|
||||
action: 'query-attachments',
|
||||
post_id: media.model.settings.post.id
|
||||
});
|
||||
|
||||
// Clone the args so manipulation is non-destructive.
|
||||
args = _.clone( this.args );
|
||||
|
||||
// Determine which page to query.
|
||||
if ( -1 !== args.posts_per_page )
|
||||
args.paged = Math.floor( this.length / args.posts_per_page ) + 1;
|
||||
|
||||
options.data.query = args;
|
||||
return media.ajax( options );
|
||||
|
||||
// Otherwise, fall back to Backbone.sync()
|
||||
} else {
|
||||
fallback = Attachments.prototype.sync ? Attachments.prototype : Backbone;
|
||||
return fallback.sync.apply( this, arguments );
|
||||
}
|
||||
}
|
||||
}, {
|
||||
defaultProps: {
|
||||
orderby: 'date',
|
||||
order: 'DESC'
|
||||
},
|
||||
|
||||
defaultArgs: {
|
||||
posts_per_page: 40
|
||||
},
|
||||
|
||||
orderby: {
|
||||
allowed: [ 'name', 'author', 'date', 'title', 'modified', 'uploadedTo', 'id', 'post__in', 'menuOrder' ],
|
||||
valuemap: {
|
||||
'id': 'ID',
|
||||
'uploadedTo': 'parent',
|
||||
'menuOrder': 'menu_order ID'
|
||||
}
|
||||
},
|
||||
|
||||
propmap: {
|
||||
'search': 's',
|
||||
'type': 'post_mime_type',
|
||||
'perPage': 'posts_per_page',
|
||||
'menuOrder': 'menu_order',
|
||||
'uploadedTo': 'post_parent'
|
||||
},
|
||||
|
||||
// Caches query objects so queries can be easily reused.
|
||||
get: (function(){
|
||||
var queries = [];
|
||||
|
||||
return function( props, options ) {
|
||||
var args = {},
|
||||
orderby = Query.orderby,
|
||||
defaults = Query.defaultProps,
|
||||
query;
|
||||
|
||||
// Remove the `query` property. This isn't linked to a query,
|
||||
// this *is* the query.
|
||||
delete props.query;
|
||||
|
||||
// Fill default args.
|
||||
_.defaults( props, defaults );
|
||||
|
||||
// Normalize the order.
|
||||
props.order = props.order.toUpperCase();
|
||||
if ( 'DESC' !== props.order && 'ASC' !== props.order )
|
||||
props.order = defaults.order.toUpperCase();
|
||||
|
||||
// Ensure we have a valid orderby value.
|
||||
if ( ! _.contains( orderby.allowed, props.orderby ) )
|
||||
props.orderby = defaults.orderby;
|
||||
|
||||
// Generate the query `args` object.
|
||||
// Correct any differing property names.
|
||||
_.each( props, function( value, prop ) {
|
||||
if ( _.isNull( value ) )
|
||||
return;
|
||||
|
||||
args[ Query.propmap[ prop ] || prop ] = value;
|
||||
});
|
||||
|
||||
// Fill any other default query args.
|
||||
_.defaults( args, Query.defaultArgs );
|
||||
|
||||
// `props.orderby` does not always map directly to `args.orderby`.
|
||||
// Substitute exceptions specified in orderby.keymap.
|
||||
args.orderby = orderby.valuemap[ props.orderby ] || props.orderby;
|
||||
|
||||
// Search the query cache for matches.
|
||||
query = _.find( queries, function( query ) {
|
||||
return _.isEqual( query.args, args );
|
||||
});
|
||||
|
||||
// Otherwise, create a new query and add it to the cache.
|
||||
if ( ! query ) {
|
||||
query = new Query( [], _.extend( options || {}, {
|
||||
props: props,
|
||||
args: args
|
||||
} ) );
|
||||
queries.push( query );
|
||||
}
|
||||
|
||||
return query;
|
||||
};
|
||||
}())
|
||||
});
|
||||
|
||||
/**
|
||||
* wp.media.model.Selection
|
||||
*
|
||||
* Used to manage a selection of attachments in the views.
|
||||
*/
|
||||
media.model.Selection = Attachments.extend({
|
||||
initialize: function( models, options ) {
|
||||
Attachments.prototype.initialize.apply( this, arguments );
|
||||
this.multiple = options && options.multiple;
|
||||
|
||||
// Refresh the `single` model whenever the selection changes.
|
||||
// Binds `single` instead of using the context argument to ensure
|
||||
// it receives no parameters.
|
||||
this.on( 'add remove reset', _.bind( this.single, this, false ) );
|
||||
},
|
||||
|
||||
// Override the selection's add method.
|
||||
// If the workflow does not support multiple
|
||||
// selected attachments, reset the selection.
|
||||
add: function( models, options ) {
|
||||
if ( ! this.multiple )
|
||||
this.remove( this.models );
|
||||
|
||||
return Attachments.prototype.add.call( this, models, options );
|
||||
},
|
||||
|
||||
single: function( model ) {
|
||||
var previous = this._single;
|
||||
|
||||
// If a `model` is provided, use it as the single model.
|
||||
if ( model )
|
||||
this._single = model;
|
||||
|
||||
// If the single model isn't in the selection, remove it.
|
||||
if ( this._single && ! this.getByCid( this._single.cid ) )
|
||||
delete this._single;
|
||||
|
||||
this._single = this._single || this.last();
|
||||
|
||||
// If single has changed, fire an event.
|
||||
if ( this._single !== previous ) {
|
||||
if ( previous ) {
|
||||
previous.trigger( 'selection:unsingle', previous, this );
|
||||
|
||||
// If the model was already removed, trigger the collection
|
||||
// event manually.
|
||||
if ( ! this.getByCid( previous.cid ) )
|
||||
this.trigger( 'selection:unsingle', previous, this );
|
||||
}
|
||||
if ( this._single )
|
||||
this._single.trigger( 'selection:single', this._single, this );
|
||||
}
|
||||
|
||||
// Return the single model, or the last model as a fallback.
|
||||
return this._single;
|
||||
}
|
||||
});
|
||||
|
||||
// Clean up. Prevents mobile browsers caching
|
||||
$(window).on('unload', function(){
|
||||
window.wp = null;
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
1
wp-includes/js/media-models.min.js
vendored
Normal file
1
wp-includes/js/media-models.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4305
wp-includes/js/media-views.js
Normal file
4305
wp-includes/js/media-views.js
Normal file
File diff suppressed because it is too large
Load Diff
1
wp-includes/js/media-views.min.js
vendored
Normal file
1
wp-includes/js/media-views.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
227
wp-includes/js/plupload/changelog.txt
Normal file
227
wp-includes/js/plupload/changelog.txt
Normal file
@@ -0,0 +1,227 @@
|
||||
Version 1.5.5 (2013-01-23)
|
||||
UI Widget: Fix sortable feature, broken in jQuery UI 1.9.
|
||||
Queue: Replace live() with delegate(), as live() was removed from jQuery 1.9.
|
||||
HTML5: window.getComputedStyle in Firefox doesn't support dashed rulenames - use zIndex instead of z-index.
|
||||
HTML5/Flash/Silverlight/Gears: Process JPEGs, if quality parameter is present, whatever the scale factor.
|
||||
Flash: Survive invalid EXIF tag offsets.
|
||||
Flash: Allow only letters, digits and underscore in runtime id to avoid script injection.
|
||||
SilverLight: Prepend ampersand to the query string, for non multipart cases (as in Flash and HTML5).
|
||||
Add mime types for m2v,3gp,3g2 extensions.
|
||||
Version 1.5.4 (2012-04-12)
|
||||
Flash: Disable scripting if swf was loaded from another domain.
|
||||
Version 1.5.3 (2012-04-05)
|
||||
HTML5: Check if xhr object is initialized, before calling abort() on it.
|
||||
HTML4: Postpone form removal until uploaders state changes, to avoid error on resuming stopped uploads.
|
||||
BrowserPlus: Fix mechanical typo, that caused error during mime type check.
|
||||
BrowserPlus: browserPlus.Uploader.Cancel() has two required parameters, dies with the error if not passed.
|
||||
Flash: Improve runtime's behaviour during upload cancellation.
|
||||
Flash: Survive the case when GPSVersionID contains unexpected value.
|
||||
Flash: Fix random freeze in Chrome's bundled Flash Player.
|
||||
Flash: Avoid the silent break when URLStream not yet open, but close is called on it.
|
||||
Flash: Move Destroy handler out of Flash:Init handler, since it might be called not only after Flash:Init but also before it.
|
||||
Flash: Avoid warning during build with mxmlc.
|
||||
Try removeEventListener first in IE and only if it fails - detachEvent.
|
||||
Fix plupload.getPos to return proper value in IE8+.
|
||||
Do not initiate plupload.STARTED state, if file queue is empty.
|
||||
Additional language packs: Estonian, Polish, Korean, French-Canadian, Greek, Persian/Farsi.
|
||||
Version 1.5.2 (2012-01-06)
|
||||
UI Widget: Do not show UI if no runtime can be initialized.
|
||||
UI Widget: Timely update file size and total size if resize in action.
|
||||
UI Widget: Constrain renaming feature to queued files only.
|
||||
UI Widget: Disable Add button properly, if requested, rather then just hide.
|
||||
HTML4/HTML5/BrowserPlus: Avoid adding mime type twice to dialog trigger.
|
||||
HTML5: fix regression, when unresized images were failing on FF3.6.
|
||||
HTML5: Constrain Gecko 2,5,6 workaround to multipart mode only.
|
||||
HTML5/Flash: Take into account weird possibilities of ExifVersion being a string, rather then standard Undefined.
|
||||
Flash: Simplify event dispatching in BitmapDataUnlimited class, in order to avoid freezing on resizing in FP11.
|
||||
Add ability to disable file dialog trigger on request (uploader.disableBrowse(true/false)).
|
||||
Support for immediate abort of upload process, be it chunked upload or regular one.
|
||||
Abort all activity, before destroying uploader.
|
||||
Revive temporary file removal logic in upload.php.
|
||||
Fix potential vulnerability in dump.php and upload.php.
|
||||
Additional MIME types: application/vnd.openxmlformats-officedocument.*, application/x-javascript, application/json, text/css,css, application/vnd.oasis.opendocument.formula-templat.
|
||||
Additional language packs: Hungarian, Croatian, Serbian, Romanian.
|
||||
Version 1.5.1.1 (2011-09-27)
|
||||
HTML5: Fix mechanical typo, that successfully broke drag and drop, wherever could.
|
||||
Version 1.5.1 (2011-09-26)
|
||||
HTML4: Add support for server responses in HTML format.
|
||||
HTML5: Disable multiple file selection in Safari 5.x for Windows (see #363).
|
||||
HTML5: Gecko 2/5/6 should upload chunks as binary strings when in chunking mode and client side resize is requested.
|
||||
Flash: Enforce URLStream mode when custom headers are passed.
|
||||
Flash: Fix embedding problems in IE9 (and all other IEs).
|
||||
Flash/Gears/BrowserPlus/SilverLight: Expose multi_selection feature, to be used in required_features (mainly to overcome Safari for Windows problem).
|
||||
SilverLight: Properly handle custom and null headers.
|
||||
UploadComplete moved to fire after the last StateChanged event.
|
||||
Additional language packs: Finnish.
|
||||
Version 1.5b (2011-09-11)
|
||||
UI Widget: Fix sortable logic.
|
||||
UI Widget: Fix bug, when message was displayed simultaneously across all Plupload UI instances on the page.
|
||||
UI Widget: notify() method is now public - users can throw their own messages into the widget header.
|
||||
HTML4/HTML5: Revise input[type=file] placement logic to support cursor styling on Geko 2+.
|
||||
HTML5: Revise Drag'n'Drop detection logic.
|
||||
HTML5: Make Exif and GPS information available to user, introduce two new events: ExifData and GpsData.
|
||||
HTML5: Add support for File.prototype.slice() method (mozSlice/webkitSlice) in order to be able to upload files in chunks without preloading.
|
||||
HTML5: Remove any JPEG headers before restoring them, 'cause user agent (like Chrome), might be inserting it's own.
|
||||
Flash: Remove a limit on the depth of image header check, since it still fails in some cases and performance gain is negligible.
|
||||
Flash: Fix regression, when runtime hanged when not images where passed in as images.
|
||||
SilverLight: Fix bug, when JSON serializer was failing on null.
|
||||
SilverLight: Remove cast to integer for chunk boundary, which resulted in a wrong size for last chunks on huge files.
|
||||
SilverLight: Increase read buffer, add disposal of ImageStream and FileStream, optimize for performance.
|
||||
Updated build.xml to include language packs in release package under js/ folder.
|
||||
Gears/BrowserPlus: Add support for * file filter.
|
||||
BeforeUpload now can cancel upload if required.
|
||||
Additional MIME types: text/csv, image/photoshop, video/x-ms-wmv, video/avi, video/webm support
|
||||
Additional language packs: Japanese
|
||||
Cleaned examples.
|
||||
Version 1.4.3.2 (2011-04-13)
|
||||
Fixed bug in HTML5 runtime, when was reduced by a factor of 100 after every upload.
|
||||
Version 1.4.3.1 (2011-04-12)
|
||||
Fixed build script, mistakenly populating jquery.plupload.queue directory from jquery.ui.plupload sources.
|
||||
Fixed script urls in all examples, build script now will alter them automatically from dev to release when needed.
|
||||
Fixed isEmptyObj undefined error in HTML4 runtime.
|
||||
Fixed bug in UI Widget preventing UploadComplete from triggering.
|
||||
Version 1.4.3 (2011-04-11)
|
||||
Added Latvian language pack and updated French.
|
||||
Fixed bug in Flash runtime when JPEG header was not investigated deep enough to reach SOFn marker in large images.
|
||||
Fixed bug, when PNGs were cropped to width in Flash runtimes, rather then resized.
|
||||
Fixed Flash to allow multiple uploading of the same file, with different settings.
|
||||
Fixed Flash runtime to clean anonymous listeners properly.
|
||||
Fixed HTML5 runtime to resolve to mimeType in case-insensitive way.
|
||||
Fixed HTML5/Flash/SilverLight/Gears runtimes for inconsistency in naming of chunks feature, comparing to other runtimes.
|
||||
Fixed HTML4/HTML5 runtimes for input[type=file] to outsize contaner effectively enough to fill the whole click area.
|
||||
Fixed all runtimes to preserve position (relative/absolute) rule on containers that already have it.
|
||||
Fixed SilverLight runtime to support large files (over 2GB).
|
||||
Restructured the examples, src and build scripts to make it more clear that jQuery is optional.
|
||||
Added support for *.* filter.
|
||||
Added support for preserving ICC and IPTC headers when resizing JPEGs.
|
||||
Added Image.onerror/onabort handlers to HTML5 in order to gracefully bypass faulty images.
|
||||
Added ability to drop image size (by lowering quality), while preserving original dimension (HTML5/Flash/Gears).
|
||||
Ported EXIF, ICC, IPTC preservation code to Flash runtime.
|
||||
Version 1.4.2 (2011-02-20)
|
||||
Added Brazilian Portuguese, German, Russian and Spanish translations.
|
||||
Added support for file_data_name option to SilverLight runtime.
|
||||
Added support for better quality image resizing to Flash runtime.
|
||||
Added support for properly handling images with dimensions up to 8191x8191 pixels to Flash runtime.
|
||||
Added 'updatelist' event to UI Widget, which will be triggered every time file list will get redrawn.
|
||||
Added support for dynamically changing options to UI Widget.
|
||||
Fixed HTML4 runtime bug, when UploadFile handler was attached twice.
|
||||
Fixed HTML5 to use FileReader.readAsBinaryString() instead of File.getAsBinary() on newer WebKit browsers (like Chrome 9).
|
||||
Fixed Flash runtime from sending duplicate Filename param, when using FileReference.upload().
|
||||
Updated S3 example to illustrate support for a proper progress indication.
|
||||
Version 1.4.1 (2011-02-01)
|
||||
Added an example on how to use Plupload with Amazon S3 written in PHP but can easily be ported to other languages.
|
||||
Fixed bug where hidden input elements wasn't created when the multiple_queues option wasn't used.
|
||||
Fixed bug where FF4 would produce an exception about missing BlobBuilder.
|
||||
Version 1.4.0 (2011-01-26)
|
||||
Added removeEvent and removeAllEvents methods and modified addEvent accordingly, in order to support dynamic unload.
|
||||
Added unbindAll method.
|
||||
Added UploadComplete event, which fires when internal iterator reaches the end of the queue.
|
||||
Added public destroy method to plupload object, new event - Destroy, and corresponding handlers to all runtimes.
|
||||
Added Czech, Italian, French, Dutch translations.
|
||||
Added support for translatable error messages.
|
||||
Added two new options: browse_button_hover and browse_button_active, in order to support browse_button interactivity.
|
||||
Added support for 'multi_selection: false' to Silverlight runtime.
|
||||
Added support for video/mp4, video/x-m4v and audio/mp4 MIME Types.
|
||||
Added artificial sendAsBinary method to XMLHttpRequest.prototype for browsers that have support for BlobBuilder and typed arrays.
|
||||
Added version tracking variable into plupload object and version comment to the header of every file.
|
||||
Fixed measurements of browse_button element in order to size and position input[type=file] element to fit it fully.
|
||||
Fixed Flash runtime behavior for multiple_select=false and other simpleUpload usage cases: basically new FileReference has to be created for every select dialog.
|
||||
Fixed browser sniffer to match only Safari, for fakeSafariDragDrop (seems like Safari on Mac doesn't require it either).
|
||||
Fixed so that ExternalInterface escapes strings properly, before passing them to JS.
|
||||
Fixed eventual reinitialization of flash/silverlight runtimes, especially for cases when object wrapper needed to be programmatically hidden and then shown again.
|
||||
Fixed so that Plupload will now ignore files with duplicate names when adding to the queue, in one set. Mainly introduced to work around Safari on Windows bug (https://bugs.webkit.org/show_bug.cgi?id=37957).
|
||||
Fixed bug, when final UploadProgress was firing after FileUploaded for Flash simpleUpload.
|
||||
Fixed bug where upload would fail if an error was produced inside the FilesAdded event.
|
||||
Fixed bug in Flash runtime when it used a wrong size when resizing, but not chunking.
|
||||
Fixed bug in Silverlight runtime that would keep sending 0 byte packages when a picture was chunked before resized.
|
||||
Disabled blur filter (is going to be replaced with some bilinear resampling in next release).
|
||||
Completely revised UI Widget, to be more jQuery UI oriented. Optionally depends on UI Button, UI Sortable, UI ProgressBar.
|
||||
Version 1.3.0 (2010-11-24)
|
||||
Added new jQuery UI widget that supports jQuery UI themes.
|
||||
Added new multiple_queues option that enables you to upload multiple times in the queue widgets.
|
||||
Added support for crossdomain loading of the XAP and SWF files and crossdomain upload.
|
||||
Added new multiple_queues option that enables you to upload multiple times in the queue widgets.
|
||||
Added support for crossdomain loading of the XAP and SWF files and crossdomain upload.
|
||||
Added preinit/init options to to ease up the binding of custom events to queueWidget and the Uploader class.
|
||||
Added drag/drop support for Safari until they fix the broken drag/drop support on Windows.
|
||||
Added events example file that show how to bind all events and display event specific data.
|
||||
Added support for retaining Exif data on images when they where resized using the HTML5 runtime.
|
||||
Fixed logic issue with the upload.php example file. Chunking wasn't working correctly.
|
||||
Fixed issue with HTML4 not handling the form encoding correctly on older IE versions. Patch contributed by jinxdone.
|
||||
Fixed so the HTML4 runtime only submits the defined multipart_params arguments.
|
||||
Fixes issue where it wasn't possible to dynamically override url or mutlipart_params for the HTML4 runtime.
|
||||
Fixed so all runtimes pass the name, chunk and chunks parameters as multipart parameters instead of querystring parameters.
|
||||
Fixed so files are read using the newer FileReader class if it's available if not it tries the older getAsXXX on Gecko.
|
||||
Fixed bug where IE 9 beta 1 wouldn't render Silverlight properly.
|
||||
Fixed bug where Flash would do extra empty requests if images below a specific size would be uploaded.
|
||||
Fixed bug where Google Gears would resize and re-encode images even if the it wasn't changed in scale.
|
||||
Fixed bug where the HTML5 runtime wouldn't free memory after each request on Gecko.
|
||||
Version 1.2.4 (2010-09-08)
|
||||
Added new BeforeUpload event to make it easier to override settings before a file is uploaded.
|
||||
Added new automatic usage of FileReference in Flash if it's possible. Contributed by Marcel Jackwerth.
|
||||
Added new chunking support for Chrome 5 and Firefox 3.6 using the HTML 5 runtime.
|
||||
Added new multipart upload support for WebKit using the HTML 5 runtime and the FormData object.
|
||||
Added new image scaling method for the Flash runtime contributed by rcoopman.
|
||||
Added new alert error message if the user selected invalid files.
|
||||
Added new automatic unique name generation to the example.php script. Contributed by Brandon Kelly.
|
||||
Changed so the default upload method is multipart and the default chunk size is 0.
|
||||
Fixed progress issue with the HTML5 runtime running on Gecko.
|
||||
Fixed so longer extensions can be used such as .tar.gz.
|
||||
Fixed so the file extension is retained when using the unique_names option.
|
||||
Version 1.2.3 (2010-05-27)
|
||||
Added new drag/drop support for HTML5 running on Chrome beta.
|
||||
Added new multipart state for the features object. It's now possible to detect multipart support.
|
||||
Added new getFeatures function to all runtime. Basic concept by Javier Martinez Fernandez.
|
||||
Fixed bug where runtimes where initialized even if they didn't match the required_features setting.
|
||||
Version 1.2.2.1 (2010-05-04)
|
||||
Added new headers option, enables you to set custom headers for the upload requests.
|
||||
Fixed bug where the file extension checking was case sensitive.
|
||||
Version 1.2.2 (2010-04-26)
|
||||
Added new file_data_name option that enables you to set the multipart file data param. Patch contributed by Alex Ganov.
|
||||
Added new FILE_SIZE_ERROR type that will be triggered if the user selected a file that is to large or zero bytes.
|
||||
Added new FILE_EXTENSION_ERROR type that will be triggered if you add a file with an invalid file extension.
|
||||
Added new required_features setting, enables you to specify a list of required features that the runtime must have.
|
||||
Fixed so the plupload.buildUrl function uses the UTF compatible encodeURIComponent method instead of escape.
|
||||
Fixed so that all file types can be selected if you don't specify a filter setting.
|
||||
Fixed so more valid HTTP status codes are accepted as valid responses.
|
||||
Fixed so all runtimes fills the features object with available features.
|
||||
Fixed some issues with the HTML4 runtime if there wasn't any existing forms on the page.
|
||||
Fixed some conflict issues with HTML4 runtime and forms with the input names of action or target.
|
||||
Fixed bug where some Gecko versions would produce exceptions when checking the HTTP status of a XHR.
|
||||
Version 1.2.1 (2010-03-22)
|
||||
Fixed bug with incorrect aspect ratio in Flash image scaling.
|
||||
Fixed bug where chunked uploads could get scrambled in the Flash runtime. Patch contributed by Grady Werner.
|
||||
Fixed bug where a beta version of Chrome wouldn't handle drag/drop correctly because of missing drag effect.
|
||||
Fixed so the HTML 4 runtime displays N/A for file sizes and the progress is based on uploaded files instead of bytes.
|
||||
Fixed so chunking can be disabled properly in Flash but that will affect the progress bar.
|
||||
Fixed so queue widget displays the drag/drop message if file queue is emptied.
|
||||
Fixed small files are uploaded as one single chunk and not forced into 4 chunks in the Flash runtime.
|
||||
Version 1.2 (2010-03-09)
|
||||
Added new rename file support for jQuery queue widget, click on a file name to rename it if it's enabled.
|
||||
Added official ChunkUploaded event, it similar to FileUploaded but executed for each chunk.
|
||||
Added bytes per second support to total queue progress.
|
||||
Added better error handling to core API using the new Error event.
|
||||
Added better error handling to jQuery queue widget.
|
||||
Fixed so chunking uploads is dispatch from JS not from inside Flash/Silverlight.
|
||||
Version 1.1.1 (2010-02-25)
|
||||
Added new setup setting to queue widget. Makes it easier to bind custom events to uploader instance.
|
||||
Fixed so it's possible to disable chunking compleatly. It's now disabled by default.
|
||||
Fixed bug where multipart mode was enabled all the time in the Flash runtime.
|
||||
Fixed bug where chunked uploading in Silverlight would fail.
|
||||
Fixed bug where the delete button was visible while uploading.
|
||||
Fixed bug where unique_names setting wasn't working when the core API was used.
|
||||
Fixed bug where the queue widget wouldn't display the currently uploaded file if the unique_names was enabled.
|
||||
Version 1.1 (2010-02-24)
|
||||
Added new multipart and multipart_params support.
|
||||
Added new container option, enables you to specify where flash/silverlight objects would be added.
|
||||
Added chunking support to BrowserPlus runtime, contributed by Steve Spencer.
|
||||
Added FileUploaded event that fires when a file is uploaded.
|
||||
Added more easily understandable buttons to queue widget.
|
||||
Added html4 runtime, contributed by Ryan Demmer.
|
||||
Fixed issues with i18n support and added a Swedish and Danish language pack.
|
||||
Fixed bug where the Flash runtime could do empty requests if the image was scaled down.
|
||||
Fixed bug where uploading small images in Silverlight would produce an exception.
|
||||
Fixed so the runtime list can include whitespace or missing runtimes. Patch contributed by <20>yvind Sean Kinsey.
|
||||
Fixed so to large files are ignored and never dispatched to the FilesAdded event.
|
||||
Version 1.0 (2010-02-03)
|
||||
First official release of Plupload.
|
||||
491
wp-includes/js/plupload/handlers.js
Normal file
491
wp-includes/js/plupload/handlers.js
Normal file
@@ -0,0 +1,491 @@
|
||||
var topWin = window.dialogArguments || opener || parent || top, uploader, uploader_init;
|
||||
|
||||
function fileDialogStart() {
|
||||
jQuery("#media-upload-error").empty();
|
||||
}
|
||||
|
||||
// progress and success handlers for media multi uploads
|
||||
function fileQueued(fileObj) {
|
||||
// Get rid of unused form
|
||||
jQuery('.media-blank').remove();
|
||||
|
||||
var items = jQuery('#media-items').children(), postid = post_id || 0;
|
||||
|
||||
// Collapse a single item
|
||||
if ( items.length == 1 ) {
|
||||
items.removeClass('open').find('.slidetoggle').slideUp(200);
|
||||
}
|
||||
// Create a progress bar containing the filename
|
||||
jQuery('<div class="media-item">')
|
||||
.attr( 'id', 'media-item-' + fileObj.id )
|
||||
.addClass('child-of-' + postid)
|
||||
.append('<div class="progress"><div class="percent">0%</div><div class="bar"></div></div>',
|
||||
jQuery('<div class="filename original">').text( ' ' + fileObj.name ))
|
||||
.appendTo( jQuery('#media-items' ) );
|
||||
|
||||
// Disable submit
|
||||
jQuery('#insert-gallery').prop('disabled', true);
|
||||
}
|
||||
|
||||
function uploadStart() {
|
||||
try {
|
||||
if ( typeof topWin.tb_remove != 'undefined' )
|
||||
topWin.jQuery('#TB_overlay').unbind('click', topWin.tb_remove);
|
||||
} catch(e){}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function uploadProgress(up, file) {
|
||||
var item = jQuery('#media-item-' + file.id);
|
||||
|
||||
jQuery('.bar', item).width( (200 * file.loaded) / file.size );
|
||||
jQuery('.percent', item).html( file.percent + '%' );
|
||||
}
|
||||
|
||||
// check to see if a large file failed to upload
|
||||
function fileUploading(up, file) {
|
||||
var hundredmb = 100 * 1024 * 1024, max = parseInt(up.settings.max_file_size, 10);
|
||||
|
||||
if ( max > hundredmb && file.size > hundredmb ) {
|
||||
setTimeout(function(){
|
||||
var done;
|
||||
|
||||
if ( file.status < 3 && file.loaded == 0 ) { // not uploading
|
||||
wpFileError(file, pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>'));
|
||||
up.stop(); // stops the whole queue
|
||||
up.removeFile(file);
|
||||
up.start(); // restart the queue
|
||||
}
|
||||
}, 10000); // wait for 10 sec. for the file to start uploading
|
||||
}
|
||||
}
|
||||
|
||||
function updateMediaForm() {
|
||||
var items = jQuery('#media-items').children();
|
||||
|
||||
// Just one file, no need for collapsible part
|
||||
if ( items.length == 1 ) {
|
||||
items.addClass('open').find('.slidetoggle').show();
|
||||
jQuery('.insert-gallery').hide();
|
||||
} else if ( items.length > 1 ) {
|
||||
items.removeClass('open');
|
||||
// Only show Gallery button when there are at least two files.
|
||||
jQuery('.insert-gallery').show();
|
||||
}
|
||||
|
||||
// Only show Save buttons when there is at least one file.
|
||||
if ( items.not('.media-blank').length > 0 )
|
||||
jQuery('.savebutton').show();
|
||||
else
|
||||
jQuery('.savebutton').hide();
|
||||
}
|
||||
|
||||
function uploadSuccess(fileObj, serverData) {
|
||||
var item = jQuery('#media-item-' + fileObj.id);
|
||||
|
||||
// on success serverData should be numeric, fix bug in html4 runtime returning the serverData wrapped in a <pre> tag
|
||||
serverData = serverData.replace(/^<pre>(\d+)<\/pre>$/, '$1');
|
||||
|
||||
// if async-upload returned an error message, place it in the media item div and return
|
||||
if ( serverData.match(/media-upload-error|error-div/) ) {
|
||||
item.html(serverData);
|
||||
return;
|
||||
} else {
|
||||
jQuery('.percent', item).html( pluploadL10n.crunching );
|
||||
}
|
||||
|
||||
prepareMediaItem(fileObj, serverData);
|
||||
updateMediaForm();
|
||||
|
||||
// Increment the counter.
|
||||
if ( post_id && item.hasClass('child-of-' + post_id) )
|
||||
jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1);
|
||||
}
|
||||
|
||||
function setResize(arg) {
|
||||
if ( arg ) {
|
||||
if ( uploader.features.jpgresize )
|
||||
uploader.settings['resize'] = { width: resize_width, height: resize_height, quality: 100 };
|
||||
else
|
||||
uploader.settings.multipart_params.image_resize = true;
|
||||
} else {
|
||||
delete(uploader.settings.resize);
|
||||
delete(uploader.settings.multipart_params.image_resize);
|
||||
}
|
||||
}
|
||||
|
||||
function prepareMediaItem(fileObj, serverData) {
|
||||
var f = ( typeof shortform == 'undefined' ) ? 1 : 2, item = jQuery('#media-item-' + fileObj.id);
|
||||
if ( f == 2 && shortform > 2 )
|
||||
f = shortform;
|
||||
|
||||
try {
|
||||
if ( typeof topWin.tb_remove != 'undefined' )
|
||||
topWin.jQuery('#TB_overlay').click(topWin.tb_remove);
|
||||
} catch(e){}
|
||||
|
||||
if ( isNaN(serverData) || !serverData ) { // Old style: Append the HTML returned by the server -- thumbnail and form inputs
|
||||
item.append(serverData);
|
||||
prepareMediaItemInit(fileObj);
|
||||
} else { // New style: server data is just the attachment ID, fetch the thumbnail and form html from the server
|
||||
item.load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm()});
|
||||
}
|
||||
}
|
||||
|
||||
function prepareMediaItemInit(fileObj) {
|
||||
var item = jQuery('#media-item-' + fileObj.id);
|
||||
// Clone the thumbnail as a "pinkynail" -- a tiny image to the left of the filename
|
||||
jQuery('.thumbnail', item).clone().attr('class', 'pinkynail toggle').prependTo(item);
|
||||
|
||||
// Replace the original filename with the new (unique) one assigned during upload
|
||||
jQuery('.filename.original', item).replaceWith( jQuery('.filename.new', item) );
|
||||
|
||||
// Bind AJAX to the new Delete button
|
||||
jQuery('a.delete', item).click(function(){
|
||||
// Tell the server to delete it. TODO: handle exceptions
|
||||
jQuery.ajax({
|
||||
url: ajaxurl,
|
||||
type: 'post',
|
||||
success: deleteSuccess,
|
||||
error: deleteError,
|
||||
id: fileObj.id,
|
||||
data: {
|
||||
id : this.id.replace(/[^0-9]/g, ''),
|
||||
action : 'trash-post',
|
||||
_ajax_nonce : this.href.replace(/^.*wpnonce=/,'')
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// Bind AJAX to the new Undo button
|
||||
jQuery('a.undo', item).click(function(){
|
||||
// Tell the server to untrash it. TODO: handle exceptions
|
||||
jQuery.ajax({
|
||||
url: ajaxurl,
|
||||
type: 'post',
|
||||
id: fileObj.id,
|
||||
data: {
|
||||
id : this.id.replace(/[^0-9]/g,''),
|
||||
action: 'untrash-post',
|
||||
_ajax_nonce: this.href.replace(/^.*wpnonce=/,'')
|
||||
},
|
||||
success: function(data, textStatus){
|
||||
var item = jQuery('#media-item-' + fileObj.id);
|
||||
|
||||
if ( type = jQuery('#type-of-' + fileObj.id).val() )
|
||||
jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-0+1);
|
||||
|
||||
if ( post_id && item.hasClass('child-of-'+post_id) )
|
||||
jQuery('#attachments-count').text(jQuery('#attachments-count').text()-0+1);
|
||||
|
||||
jQuery('.filename .trashnotice', item).remove();
|
||||
jQuery('.filename .title', item).css('font-weight','normal');
|
||||
jQuery('a.undo', item).addClass('hidden');
|
||||
jQuery('.menu_order_input', item).show();
|
||||
item.css( {backgroundColor:'#ceb'} ).animate( {backgroundColor: '#fff'}, { queue: false, duration: 500, complete: function(){ jQuery(this).css({backgroundColor:''}); } }).removeClass('undo');
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// Open this item if it says to start open (e.g. to display an error)
|
||||
jQuery('#media-item-' + fileObj.id + '.startopen').removeClass('startopen').addClass('open').find('slidetoggle').fadeIn();
|
||||
}
|
||||
|
||||
// generic error message
|
||||
function wpQueueError(message) {
|
||||
jQuery('#media-upload-error').show().html( '<div class="error"><p>' + message + '</p></div>' );
|
||||
}
|
||||
|
||||
// file-specific error messages
|
||||
function wpFileError(fileObj, message) {
|
||||
itemAjaxError(fileObj.id, message);
|
||||
}
|
||||
|
||||
function itemAjaxError(id, message) {
|
||||
var item = jQuery('#media-item-' + id), filename = item.find('.filename').text(), last_err = item.data('last-err');
|
||||
|
||||
if ( last_err == id ) // prevent firing an error for the same file twice
|
||||
return;
|
||||
|
||||
item.html('<div class="error-div">'
|
||||
+ '<a class="dismiss" href="#">' + pluploadL10n.dismiss + '</a>'
|
||||
+ '<strong>' + pluploadL10n.error_uploading.replace('%s', jQuery.trim(filename)) + '</strong> '
|
||||
+ message
|
||||
+ '</div>').data('last-err', id);
|
||||
}
|
||||
|
||||
function deleteSuccess(data, textStatus) {
|
||||
if ( data == '-1' )
|
||||
return itemAjaxError(this.id, 'You do not have permission. Has your session expired?');
|
||||
|
||||
if ( data == '0' )
|
||||
return itemAjaxError(this.id, 'Could not be deleted. Has it been deleted already?');
|
||||
|
||||
var id = this.id, item = jQuery('#media-item-' + id);
|
||||
|
||||
// Decrement the counters.
|
||||
if ( type = jQuery('#type-of-' + id).val() )
|
||||
jQuery('#' + type + '-counter').text( jQuery('#' + type + '-counter').text() - 1 );
|
||||
|
||||
if ( post_id && item.hasClass('child-of-'+post_id) )
|
||||
jQuery('#attachments-count').text( jQuery('#attachments-count').text() - 1 );
|
||||
|
||||
if ( jQuery('form.type-form #media-items').children().length == 1 && jQuery('.hidden', '#media-items').length > 0 ) {
|
||||
jQuery('.toggle').toggle();
|
||||
jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
|
||||
}
|
||||
|
||||
// Vanish it.
|
||||
jQuery('.toggle', item).toggle();
|
||||
jQuery('.slidetoggle', item).slideUp(200).siblings().removeClass('hidden');
|
||||
item.css( {backgroundColor:'#faa'} ).animate( {backgroundColor:'#f4f4f4'}, {queue:false, duration:500} ).addClass('undo');
|
||||
|
||||
jQuery('.filename:empty', item).remove();
|
||||
jQuery('.filename .title', item).css('font-weight','bold');
|
||||
jQuery('.filename', item).append('<span class="trashnotice"> ' + pluploadL10n.deleted + ' </span>').siblings('a.toggle').hide();
|
||||
jQuery('.filename', item).append( jQuery('a.undo', item).removeClass('hidden') );
|
||||
jQuery('.menu_order_input', item).hide();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function deleteError(X, textStatus, errorThrown) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
function uploadComplete() {
|
||||
jQuery('#insert-gallery').prop('disabled', false);
|
||||
}
|
||||
|
||||
function switchUploader(s) {
|
||||
if ( s ) {
|
||||
deleteUserSetting('uploader');
|
||||
jQuery('.media-upload-form').removeClass('html-uploader');
|
||||
|
||||
if ( typeof(uploader) == 'object' )
|
||||
uploader.refresh();
|
||||
} else {
|
||||
setUserSetting('uploader', '1'); // 1 == html uploader
|
||||
jQuery('.media-upload-form').addClass('html-uploader');
|
||||
}
|
||||
}
|
||||
|
||||
function dndHelper(s) {
|
||||
var d = document.getElementById('dnd-helper');
|
||||
|
||||
if ( s ) {
|
||||
d.style.display = 'block';
|
||||
} else {
|
||||
d.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
function uploadError(fileObj, errorCode, message, uploader) {
|
||||
var hundredmb = 100 * 1024 * 1024, max;
|
||||
|
||||
switch (errorCode) {
|
||||
case plupload.FAILED:
|
||||
wpFileError(fileObj, pluploadL10n.upload_failed);
|
||||
break;
|
||||
case plupload.FILE_EXTENSION_ERROR:
|
||||
wpFileError(fileObj, pluploadL10n.invalid_filetype);
|
||||
break;
|
||||
case plupload.FILE_SIZE_ERROR:
|
||||
uploadSizeError(uploader, fileObj);
|
||||
break;
|
||||
case plupload.IMAGE_FORMAT_ERROR:
|
||||
wpFileError(fileObj, pluploadL10n.not_an_image);
|
||||
break;
|
||||
case plupload.IMAGE_MEMORY_ERROR:
|
||||
wpFileError(fileObj, pluploadL10n.image_memory_exceeded);
|
||||
break;
|
||||
case plupload.IMAGE_DIMENSIONS_ERROR:
|
||||
wpFileError(fileObj, pluploadL10n.image_dimensions_exceeded);
|
||||
break;
|
||||
case plupload.GENERIC_ERROR:
|
||||
wpQueueError(pluploadL10n.upload_failed);
|
||||
break;
|
||||
case plupload.IO_ERROR:
|
||||
max = parseInt(uploader.settings.max_file_size, 10);
|
||||
|
||||
if ( max > hundredmb && fileObj.size > hundredmb )
|
||||
wpFileError(fileObj, pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>'));
|
||||
else
|
||||
wpQueueError(pluploadL10n.io_error);
|
||||
break;
|
||||
case plupload.HTTP_ERROR:
|
||||
wpQueueError(pluploadL10n.http_error);
|
||||
break;
|
||||
case plupload.INIT_ERROR:
|
||||
jQuery('.media-upload-form').addClass('html-uploader');
|
||||
break;
|
||||
case plupload.SECURITY_ERROR:
|
||||
wpQueueError(pluploadL10n.security_error);
|
||||
break;
|
||||
/* case plupload.UPLOAD_ERROR.UPLOAD_STOPPED:
|
||||
case plupload.UPLOAD_ERROR.FILE_CANCELLED:
|
||||
jQuery('#media-item-' + fileObj.id).remove();
|
||||
break;*/
|
||||
default:
|
||||
wpFileError(fileObj, pluploadL10n.default_error);
|
||||
}
|
||||
}
|
||||
|
||||
function uploadSizeError( up, file, over100mb ) {
|
||||
var message;
|
||||
|
||||
if ( over100mb )
|
||||
message = pluploadL10n.big_upload_queued.replace('%s', file.name) + ' ' + pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>');
|
||||
else
|
||||
message = pluploadL10n.file_exceeds_size_limit.replace('%s', file.name);
|
||||
|
||||
jQuery('#media-items').append('<div id="media-item-' + file.id + '" class="media-item error"><p>' + message + '</p></div>');
|
||||
up.removeFile(file);
|
||||
}
|
||||
|
||||
jQuery(document).ready(function($){
|
||||
$('.media-upload-form').bind('click.uploader', function(e) {
|
||||
var target = $(e.target), tr, c;
|
||||
|
||||
if ( target.is('input[type="radio"]') ) { // remember the last used image size and alignment
|
||||
tr = target.closest('tr');
|
||||
|
||||
if ( tr.hasClass('align') )
|
||||
setUserSetting('align', target.val());
|
||||
else if ( tr.hasClass('image-size') )
|
||||
setUserSetting('imgsize', target.val());
|
||||
|
||||
} else if ( target.is('button.button') ) { // remember the last used image link url
|
||||
c = e.target.className || '';
|
||||
c = c.match(/url([^ '"]+)/);
|
||||
|
||||
if ( c && c[1] ) {
|
||||
setUserSetting('urlbutton', c[1]);
|
||||
target.siblings('.urlfield').val( target.data('link-url') );
|
||||
}
|
||||
} else if ( target.is('a.dismiss') ) {
|
||||
target.parents('.media-item').fadeOut(200, function(){
|
||||
$(this).remove();
|
||||
});
|
||||
} else if ( target.is('.upload-flash-bypass a') || target.is('a.uploader-html') ) { // switch uploader to html4
|
||||
$('#media-items, p.submit, span.big-file-warning').css('display', 'none');
|
||||
switchUploader(0);
|
||||
e.preventDefault();
|
||||
} else if ( target.is('.upload-html-bypass a') ) { // switch uploader to multi-file
|
||||
$('#media-items, p.submit, span.big-file-warning').css('display', '');
|
||||
switchUploader(1);
|
||||
e.preventDefault();
|
||||
} else if ( target.is('a.describe-toggle-on') ) { // Show
|
||||
target.parent().addClass('open');
|
||||
target.siblings('.slidetoggle').fadeIn(250, function(){
|
||||
var S = $(window).scrollTop(), H = $(window).height(), top = $(this).offset().top, h = $(this).height(), b, B;
|
||||
|
||||
if ( H && top && h ) {
|
||||
b = top + h;
|
||||
B = S + H;
|
||||
|
||||
if ( b > B ) {
|
||||
if ( b - B < top - S )
|
||||
window.scrollBy(0, (b - B) + 10);
|
||||
else
|
||||
window.scrollBy(0, top - S - 40);
|
||||
}
|
||||
}
|
||||
});
|
||||
e.preventDefault();
|
||||
} else if ( target.is('a.describe-toggle-off') ) { // Hide
|
||||
target.siblings('.slidetoggle').fadeOut(250, function(){
|
||||
target.parent().removeClass('open');
|
||||
});
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// init and set the uploader
|
||||
uploader_init = function() {
|
||||
uploader = new plupload.Uploader(wpUploaderInit);
|
||||
|
||||
$('#image_resize').bind('change', function() {
|
||||
var arg = $(this).prop('checked');
|
||||
|
||||
setResize( arg );
|
||||
|
||||
if ( arg )
|
||||
setUserSetting('upload_resize', '1');
|
||||
else
|
||||
deleteUserSetting('upload_resize');
|
||||
});
|
||||
|
||||
uploader.bind('Init', function(up) {
|
||||
var uploaddiv = $('#plupload-upload-ui');
|
||||
|
||||
setResize( getUserSetting('upload_resize', false) );
|
||||
|
||||
if ( up.features.dragdrop && ! $(document.body).hasClass('mobile') ) {
|
||||
uploaddiv.addClass('drag-drop');
|
||||
$('#drag-drop-area').bind('dragover.wp-uploader', function(){ // dragenter doesn't fire right :(
|
||||
uploaddiv.addClass('drag-over');
|
||||
}).bind('dragleave.wp-uploader, drop.wp-uploader', function(){
|
||||
uploaddiv.removeClass('drag-over');
|
||||
});
|
||||
} else {
|
||||
uploaddiv.removeClass('drag-drop');
|
||||
$('#drag-drop-area').unbind('.wp-uploader');
|
||||
}
|
||||
|
||||
if ( up.runtime == 'html4' )
|
||||
$('.upload-flash-bypass').hide();
|
||||
});
|
||||
|
||||
uploader.init();
|
||||
|
||||
uploader.bind('FilesAdded', function(up, files) {
|
||||
var hundredmb = 100 * 1024 * 1024, max = parseInt(up.settings.max_file_size, 10);
|
||||
|
||||
$('#media-upload-error').html('');
|
||||
uploadStart();
|
||||
|
||||
plupload.each(files, function(file){
|
||||
if ( max > hundredmb && file.size > hundredmb && up.runtime != 'html5' )
|
||||
uploadSizeError( up, file, true );
|
||||
else
|
||||
fileQueued(file);
|
||||
});
|
||||
|
||||
up.refresh();
|
||||
up.start();
|
||||
});
|
||||
|
||||
uploader.bind('BeforeUpload', function(up, file) {
|
||||
// something
|
||||
});
|
||||
|
||||
uploader.bind('UploadFile', function(up, file) {
|
||||
fileUploading(up, file);
|
||||
});
|
||||
|
||||
uploader.bind('UploadProgress', function(up, file) {
|
||||
uploadProgress(up, file);
|
||||
});
|
||||
|
||||
uploader.bind('Error', function(up, err) {
|
||||
uploadError(err.file, err.code, err.message, up);
|
||||
up.refresh();
|
||||
});
|
||||
|
||||
uploader.bind('FileUploaded', function(up, file, response) {
|
||||
uploadSuccess(file, response.response);
|
||||
});
|
||||
|
||||
uploader.bind('UploadComplete', function(up, files) {
|
||||
uploadComplete();
|
||||
});
|
||||
}
|
||||
|
||||
if ( typeof(wpUploaderInit) == 'object' )
|
||||
uploader_init();
|
||||
|
||||
});
|
||||
1
wp-includes/js/plupload/handlers.min.js
vendored
Normal file
1
wp-includes/js/plupload/handlers.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
339
wp-includes/js/plupload/license.txt
Normal file
339
wp-includes/js/plupload/license.txt
Normal file
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
1
wp-includes/js/plupload/plupload.flash.js
Normal file
1
wp-includes/js/plupload/plupload.flash.js
Normal file
File diff suppressed because one or more lines are too long
BIN
wp-includes/js/plupload/plupload.flash.swf
Normal file
BIN
wp-includes/js/plupload/plupload.flash.swf
Normal file
Binary file not shown.
1
wp-includes/js/plupload/plupload.html4.js
Normal file
1
wp-includes/js/plupload/plupload.html4.js
Normal file
@@ -0,0 +1 @@
|
||||
(function(d,a,b,c){function e(f){return a.getElementById(f)}b.runtimes.Html4=b.addRuntime("html4",{getFeatures:function(){return{multipart:true,triggerDialog:(b.ua.gecko&&d.FormData||b.ua.webkit)}},init:function(f,g){f.bind("Init",function(p){var j=a.body,n,h="javascript",k,x,q,z=[],r=/MSIE/.test(navigator.userAgent),t=[],m=p.settings.filters,o,l,s,w;no_type_restriction:for(o=0;o<m.length;o++){l=m[o].extensions.split(/,/);for(w=0;w<l.length;w++){if(l[w]==="*"){t=[];break no_type_restriction}s=b.mimeTypes[l[w]];if(s&&b.inArray(s,t)===-1){t.push(s)}}}t=t.join(",");function v(){var B,y,i,A;q=b.guid();z.push(q);B=a.createElement("form");B.setAttribute("id","form_"+q);B.setAttribute("method","post");B.setAttribute("enctype","multipart/form-data");B.setAttribute("encoding","multipart/form-data");B.setAttribute("target",p.id+"_iframe");B.style.position="absolute";y=a.createElement("input");y.setAttribute("id","input_"+q);y.setAttribute("type","file");y.setAttribute("accept",t);y.setAttribute("size",1);A=e(p.settings.browse_button);if(p.features.triggerDialog&&A){b.addEvent(e(p.settings.browse_button),"click",function(C){if(!y.disabled){y.click()}C.preventDefault()},p.id)}b.extend(y.style,{width:"100%",height:"100%",opacity:0,fontSize:"99px",cursor:"pointer"});b.extend(B.style,{overflow:"hidden"});i=p.settings.shim_bgcolor;if(i){B.style.background=i}if(r){b.extend(y.style,{filter:"alpha(opacity=0)"})}b.addEvent(y,"change",function(F){var D=F.target,C,E=[],G;if(D.value){e("form_"+q).style.top=-1048575+"px";C=D.value.replace(/\\/g,"/");C=C.substring(C.length,C.lastIndexOf("/")+1);E.push(new b.File(q,C));if(!p.features.triggerDialog){b.removeAllEvents(B,p.id)}else{b.removeEvent(A,"click",p.id)}b.removeEvent(y,"change",p.id);v();if(E.length){f.trigger("FilesAdded",E)}}},p.id);B.appendChild(y);j.appendChild(B);p.refresh()}function u(){var i=a.createElement("div");i.innerHTML='<iframe id="'+p.id+'_iframe" name="'+p.id+'_iframe" src="'+h+':""" style="display:none"></iframe>';n=i.firstChild;j.appendChild(n);b.addEvent(n,"load",function(C){var D=C.target,B,y;if(!k){return}try{B=D.contentWindow.document||D.contentDocument||d.frames[D.id].document}catch(A){p.trigger("Error",{code:b.SECURITY_ERROR,message:b.translate("Security error."),file:k});return}y=B.body.innerHTML;if(y){k.status=b.DONE;k.loaded=1025;k.percent=100;p.trigger("UploadProgress",k);p.trigger("FileUploaded",k,{response:y})}},p.id)}if(p.settings.container){j=e(p.settings.container);if(b.getStyle(j,"position")==="static"){j.style.position="relative"}}p.bind("UploadFile",function(i,A){var B,y;if(A.status==b.DONE||A.status==b.FAILED||i.state==b.STOPPED){return}B=e("form_"+A.id);y=e("input_"+A.id);y.setAttribute("name",i.settings.file_data_name);B.setAttribute("action",i.settings.url);b.each(b.extend({name:A.target_name||A.name},i.settings.multipart_params),function(E,C){var D=a.createElement("input");b.extend(D,{type:"hidden",name:C,value:E});B.insertBefore(D,B.firstChild)});k=A;e("form_"+q).style.top=-1048575+"px";B.submit()});p.bind("FileUploaded",function(i){i.refresh()});p.bind("StateChanged",function(i){if(i.state==b.STARTED){u()}else{if(i.state==b.STOPPED){d.setTimeout(function(){b.removeEvent(n,"load",i.id);if(n.parentNode){n.parentNode.removeChild(n)}},0)}}b.each(i.files,function(A,y){if(A.status===b.DONE||A.status===b.FAILED){var B=e("form_"+A.id);if(B){B.parentNode.removeChild(B)}}})});p.bind("Refresh",function(y){var F,A,B,C,i,G,H,E,D;F=e(y.settings.browse_button);if(F){i=b.getPos(F,e(y.settings.container));G=b.getSize(F);H=e("form_"+q);E=e("input_"+q);b.extend(H.style,{top:i.y+"px",left:i.x+"px",width:G.w+"px",height:G.h+"px"});if(y.features.triggerDialog){if(b.getStyle(F,"position")==="static"){b.extend(F.style,{position:"relative"})}D=parseInt(F.style.zIndex,10);if(isNaN(D)){D=0}b.extend(F.style,{zIndex:D});b.extend(H.style,{zIndex:D-1})}B=y.settings.browse_button_hover;C=y.settings.browse_button_active;A=y.features.triggerDialog?F:H;if(B){b.addEvent(A,"mouseover",function(){b.addClass(F,B)},y.id);b.addEvent(A,"mouseout",function(){b.removeClass(F,B)},y.id)}if(C){b.addEvent(A,"mousedown",function(){b.addClass(F,C)},y.id);b.addEvent(a.body,"mouseup",function(){b.removeClass(F,C)},y.id)}}});f.bind("FilesRemoved",function(y,B){var A,C;for(A=0;A<B.length;A++){C=e("form_"+B[A].id);if(C){C.parentNode.removeChild(C)}}});f.bind("DisableBrowse",function(i,A){var y=a.getElementById("input_"+q);if(y){y.disabled=A}});f.bind("Destroy",function(i){var y,A,B,C={inputContainer:"form_"+q,inputFile:"input_"+q,browseButton:i.settings.browse_button};for(y in C){A=e(C[y]);if(A){b.removeAllEvents(A,i.id)}}b.removeAllEvents(a.body,i.id);b.each(z,function(E,D){B=e("form_"+E);if(B){j.removeChild(B)}})});v()});g({success:true})}})})(window,document,plupload);
|
||||
1
wp-includes/js/plupload/plupload.html5.js
Normal file
1
wp-includes/js/plupload/plupload.html5.js
Normal file
File diff suppressed because one or more lines are too long
2
wp-includes/js/plupload/plupload.js
Normal file
2
wp-includes/js/plupload/plupload.js
Normal file
File diff suppressed because one or more lines are too long
1
wp-includes/js/plupload/plupload.silverlight.js
Normal file
1
wp-includes/js/plupload/plupload.silverlight.js
Normal file
File diff suppressed because one or more lines are too long
BIN
wp-includes/js/plupload/plupload.silverlight.xap
Normal file
BIN
wp-includes/js/plupload/plupload.silverlight.xap
Normal file
Binary file not shown.
343
wp-includes/js/plupload/wp-plupload.js
Normal file
343
wp-includes/js/plupload/wp-plupload.js
Normal file
@@ -0,0 +1,343 @@
|
||||
window.wp = window.wp || {};
|
||||
|
||||
(function( exports, $ ) {
|
||||
var Uploader;
|
||||
|
||||
if ( typeof _wpPluploadSettings === 'undefined' )
|
||||
return;
|
||||
|
||||
/*
|
||||
* An object that helps create a WordPress uploader using plupload.
|
||||
*
|
||||
* @param options - object - The options passed to the new plupload instance.
|
||||
* Accepts the following parameters:
|
||||
* - container - The id of uploader container.
|
||||
* - browser - The id of button to trigger the file select.
|
||||
* - dropzone - The id of file drop target.
|
||||
* - plupload - An object of parameters to pass to the plupload instance.
|
||||
* - params - An object of parameters to pass to $_POST when uploading the file.
|
||||
* Extends this.plupload.multipart_params under the hood.
|
||||
*
|
||||
* @param attributes - object - Attributes and methods for this specific instance.
|
||||
*/
|
||||
Uploader = function( options ) {
|
||||
var self = this,
|
||||
elements = {
|
||||
container: 'container',
|
||||
browser: 'browse_button',
|
||||
dropzone: 'drop_element'
|
||||
},
|
||||
key, error;
|
||||
|
||||
this.supports = {
|
||||
upload: Uploader.browser.supported
|
||||
};
|
||||
|
||||
this.supported = this.supports.upload;
|
||||
|
||||
if ( ! this.supported )
|
||||
return;
|
||||
|
||||
// Use deep extend to ensure that multipart_params and other objects are cloned.
|
||||
this.plupload = $.extend( true, { multipart_params: {} }, Uploader.defaults );
|
||||
this.container = document.body; // Set default container.
|
||||
|
||||
// Extend the instance with options
|
||||
//
|
||||
// Use deep extend to allow options.plupload to override individual
|
||||
// default plupload keys.
|
||||
$.extend( true, this, options );
|
||||
|
||||
// Proxy all methods so this always refers to the current instance.
|
||||
for ( key in this ) {
|
||||
if ( $.isFunction( this[ key ] ) )
|
||||
this[ key ] = $.proxy( this[ key ], this );
|
||||
}
|
||||
|
||||
// Ensure all elements are jQuery elements and have id attributes
|
||||
// Then set the proper plupload arguments to the ids.
|
||||
for ( key in elements ) {
|
||||
if ( ! this[ key ] )
|
||||
continue;
|
||||
|
||||
this[ key ] = $( this[ key ] ).first();
|
||||
|
||||
if ( ! this[ key ].length ) {
|
||||
delete this[ key ];
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! this[ key ].prop('id') )
|
||||
this[ key ].prop( 'id', '__wp-uploader-id-' + Uploader.uuid++ );
|
||||
this.plupload[ elements[ key ] ] = this[ key ].prop('id');
|
||||
}
|
||||
|
||||
// If the uploader has neither a browse button nor a dropzone, bail.
|
||||
if ( ! ( this.browser && this.browser.length ) && ! ( this.dropzone && this.dropzone.length ) )
|
||||
return;
|
||||
|
||||
this.uploader = new plupload.Uploader( this.plupload );
|
||||
delete this.plupload;
|
||||
|
||||
// Set default params and remove this.params alias.
|
||||
this.param( this.params || {} );
|
||||
delete this.params;
|
||||
|
||||
error = function( message, data, file ) {
|
||||
if ( file.attachment )
|
||||
file.attachment.destroy();
|
||||
|
||||
Uploader.errors.unshift({
|
||||
message: message || pluploadL10n.default_error,
|
||||
data: data,
|
||||
file: file
|
||||
});
|
||||
|
||||
self.error( message, data, file );
|
||||
};
|
||||
|
||||
this.uploader.init();
|
||||
|
||||
this.supports.dragdrop = this.uploader.features.dragdrop && ! Uploader.browser.mobile;
|
||||
|
||||
// Generate drag/drop helper classes.
|
||||
(function( dropzone, supported ) {
|
||||
var timer, active;
|
||||
|
||||
if ( ! dropzone )
|
||||
return;
|
||||
|
||||
dropzone.toggleClass( 'supports-drag-drop', !! supported );
|
||||
|
||||
if ( ! supported )
|
||||
return dropzone.unbind('.wp-uploader');
|
||||
|
||||
// 'dragenter' doesn't fire correctly,
|
||||
// simulate it with a limited 'dragover'
|
||||
dropzone.bind( 'dragover.wp-uploader', function(){
|
||||
if ( timer )
|
||||
clearTimeout( timer );
|
||||
|
||||
if ( active )
|
||||
return;
|
||||
|
||||
dropzone.trigger('dropzone:enter').addClass('drag-over');
|
||||
active = true;
|
||||
});
|
||||
|
||||
dropzone.bind('dragleave.wp-uploader, drop.wp-uploader', function(){
|
||||
// Using an instant timer prevents the drag-over class from
|
||||
// being quickly removed and re-added when elements inside the
|
||||
// dropzone are repositioned.
|
||||
//
|
||||
// See http://core.trac.wordpress.org/ticket/21705
|
||||
timer = setTimeout( function() {
|
||||
active = false;
|
||||
dropzone.trigger('dropzone:leave').removeClass('drag-over');
|
||||
}, 0 );
|
||||
});
|
||||
}( this.dropzone, this.supports.dragdrop ));
|
||||
|
||||
if ( this.browser ) {
|
||||
this.browser.on( 'mouseenter', this.refresh );
|
||||
} else {
|
||||
this.uploader.disableBrowse( true );
|
||||
// If HTML5 mode, hide the auto-created file container.
|
||||
$('#' + this.uploader.id + '_html5_container').hide();
|
||||
}
|
||||
|
||||
this.uploader.bind( 'FilesAdded', function( up, files ) {
|
||||
_.each( files, function( file ) {
|
||||
var attributes, image;
|
||||
|
||||
// Ignore failed uploads.
|
||||
if ( plupload.FAILED === file.status )
|
||||
return;
|
||||
|
||||
// Generate attributes for a new `Attachment` model.
|
||||
attributes = _.extend({
|
||||
file: file,
|
||||
uploading: true,
|
||||
date: new Date(),
|
||||
filename: file.name,
|
||||
menuOrder: 0,
|
||||
uploadedTo: wp.media.model.settings.post.id
|
||||
}, _.pick( file, 'loaded', 'size', 'percent' ) );
|
||||
|
||||
// Handle early mime type scanning for images.
|
||||
image = /(?:jpe?g|png|gif)$/i.exec( file.name );
|
||||
|
||||
// Did we find an image?
|
||||
if ( image ) {
|
||||
attributes.type = 'image';
|
||||
|
||||
// `jpeg`, `png` and `gif` are valid subtypes.
|
||||
// `jpg` is not, so map it to `jpeg`.
|
||||
attributes.subtype = ( 'jpg' === image[0] ) ? 'jpeg' : image[0];
|
||||
}
|
||||
|
||||
// Create the `Attachment`.
|
||||
file.attachment = wp.media.model.Attachment.create( attributes );
|
||||
|
||||
Uploader.queue.add( file.attachment );
|
||||
|
||||
self.added( file.attachment );
|
||||
});
|
||||
|
||||
up.refresh();
|
||||
up.start();
|
||||
});
|
||||
|
||||
this.uploader.bind( 'UploadProgress', function( up, file ) {
|
||||
file.attachment.set( _.pick( file, 'loaded', 'percent' ) );
|
||||
self.progress( file.attachment );
|
||||
});
|
||||
|
||||
this.uploader.bind( 'FileUploaded', function( up, file, response ) {
|
||||
var complete;
|
||||
|
||||
try {
|
||||
response = JSON.parse( response.response );
|
||||
} catch ( e ) {
|
||||
return error( pluploadL10n.default_error, e, file );
|
||||
}
|
||||
|
||||
if ( ! _.isObject( response ) || _.isUndefined( response.success ) )
|
||||
return error( pluploadL10n.default_error, null, file );
|
||||
else if ( ! response.success )
|
||||
return error( response.data && response.data.message, response.data, file );
|
||||
|
||||
_.each(['file','loaded','size','percent'], function( key ) {
|
||||
file.attachment.unset( key );
|
||||
});
|
||||
|
||||
file.attachment.set( _.extend( response.data, { uploading: false }) );
|
||||
wp.media.model.Attachment.get( response.data.id, file.attachment );
|
||||
|
||||
complete = Uploader.queue.all( function( attachment ) {
|
||||
return ! attachment.get('uploading');
|
||||
});
|
||||
|
||||
if ( complete )
|
||||
Uploader.queue.reset();
|
||||
|
||||
self.success( file.attachment );
|
||||
});
|
||||
|
||||
this.uploader.bind( 'Error', function( up, pluploadError ) {
|
||||
var message = pluploadL10n.default_error,
|
||||
key;
|
||||
|
||||
// Check for plupload errors.
|
||||
for ( key in Uploader.errorMap ) {
|
||||
if ( pluploadError.code === plupload[ key ] ) {
|
||||
message = Uploader.errorMap[ key ];
|
||||
if ( _.isFunction( message ) )
|
||||
message = message( pluploadError.file, pluploadError );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
error( message, pluploadError, pluploadError.file );
|
||||
up.refresh();
|
||||
});
|
||||
|
||||
this.init();
|
||||
};
|
||||
|
||||
// Adds the 'defaults' and 'browser' properties.
|
||||
$.extend( Uploader, _wpPluploadSettings );
|
||||
|
||||
Uploader.uuid = 0;
|
||||
|
||||
Uploader.errorMap = {
|
||||
'FAILED': pluploadL10n.upload_failed,
|
||||
'FILE_EXTENSION_ERROR': pluploadL10n.invalid_filetype,
|
||||
'IMAGE_FORMAT_ERROR': pluploadL10n.not_an_image,
|
||||
'IMAGE_MEMORY_ERROR': pluploadL10n.image_memory_exceeded,
|
||||
'IMAGE_DIMENSIONS_ERROR': pluploadL10n.image_dimensions_exceeded,
|
||||
'GENERIC_ERROR': pluploadL10n.upload_failed,
|
||||
'IO_ERROR': pluploadL10n.io_error,
|
||||
'HTTP_ERROR': pluploadL10n.http_error,
|
||||
'SECURITY_ERROR': pluploadL10n.security_error,
|
||||
|
||||
'FILE_SIZE_ERROR': function( file ) {
|
||||
return pluploadL10n.file_exceeds_size_limit.replace('%s', file.name);
|
||||
}
|
||||
};
|
||||
|
||||
$.extend( Uploader.prototype, {
|
||||
/**
|
||||
* Acts as a shortcut to extending the uploader's multipart_params object.
|
||||
*
|
||||
* param( key )
|
||||
* Returns the value of the key.
|
||||
*
|
||||
* param( key, value )
|
||||
* Sets the value of a key.
|
||||
*
|
||||
* param( map )
|
||||
* Sets values for a map of data.
|
||||
*/
|
||||
param: function( key, value ) {
|
||||
if ( arguments.length === 1 && typeof key === 'string' )
|
||||
return this.uploader.settings.multipart_params[ key ];
|
||||
|
||||
if ( arguments.length > 1 ) {
|
||||
this.uploader.settings.multipart_params[ key ] = value;
|
||||
} else {
|
||||
$.extend( this.uploader.settings.multipart_params, key );
|
||||
}
|
||||
},
|
||||
|
||||
init: function() {},
|
||||
error: function() {},
|
||||
success: function() {},
|
||||
added: function() {},
|
||||
progress: function() {},
|
||||
complete: function() {},
|
||||
refresh: function() {
|
||||
var node, attached, container, id;
|
||||
|
||||
if ( this.browser ) {
|
||||
node = this.browser[0];
|
||||
|
||||
// Check if the browser node is in the DOM.
|
||||
while ( node ) {
|
||||
if ( node === document.body ) {
|
||||
attached = true;
|
||||
break;
|
||||
}
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
||||
// If the browser node is not attached to the DOM, use a
|
||||
// temporary container to house it, as the browser button
|
||||
// shims require the button to exist in the DOM at all times.
|
||||
if ( ! attached ) {
|
||||
id = 'wp-uploader-browser-' + this.uploader.id;
|
||||
|
||||
container = $( '#' + id );
|
||||
if ( ! container.length ) {
|
||||
container = $('<div class="wp-uploader-browser" />').css({
|
||||
position: 'fixed',
|
||||
top: '-1000px',
|
||||
left: '-1000px',
|
||||
height: 0,
|
||||
width: 0
|
||||
}).attr( 'id', 'wp-uploader-browser-' + this.uploader.id ).appendTo('body');
|
||||
}
|
||||
|
||||
container.append( this.browser );
|
||||
}
|
||||
}
|
||||
|
||||
this.uploader.refresh();
|
||||
}
|
||||
});
|
||||
|
||||
Uploader.queue = new wp.media.model.Attachments( [], { query: false });
|
||||
Uploader.errors = new Backbone.Collection();
|
||||
|
||||
exports.Uploader = Uploader;
|
||||
})( wp, jQuery );
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user