mirror of
https://github.com/janunger/rheinwerk-video-training.git
synced 2026-02-06 07:05:14 +01:00
Initiale Version
This commit is contained in:
387
Kapitel_7/Lektion_4/wordpress/wp-includes/js/admin-bar.js
Executable file
387
Kapitel_7/Lektion_4/wordpress/wp-includes/js/admin-bar.js
Executable file
@@ -0,0 +1,387 @@
|
||||
/* jshint loopfunc: true */
|
||||
// use jQuery and hoverIntent if loaded
|
||||
if ( typeof(jQuery) != 'undefined' ) {
|
||||
if ( typeof(jQuery.fn.hoverIntent) == 'undefined' ) {
|
||||
/* jshint ignore:start */
|
||||
// hoverIntent v1.8.1 - Copy of wp-includes/js/hoverIntent.min.js
|
||||
!function(a){a.fn.hoverIntent=function(b,c,d){var e={interval:100,sensitivity:6,timeout:0};e="object"==typeof b?a.extend(e,b):a.isFunction(c)?a.extend(e,{over:b,out:c,selector:d}):a.extend(e,{over:b,out:b,selector:c});var f,g,h,i,j=function(a){f=a.pageX,g=a.pageY},k=function(b,c){return c.hoverIntent_t=clearTimeout(c.hoverIntent_t),Math.sqrt((h-f)*(h-f)+(i-g)*(i-g))<e.sensitivity?(a(c).off("mousemove.hoverIntent",j),c.hoverIntent_s=!0,e.over.apply(c,[b])):(h=f,i=g,c.hoverIntent_t=setTimeout(function(){k(b,c)},e.interval),void 0)},l=function(a,b){return b.hoverIntent_t=clearTimeout(b.hoverIntent_t),b.hoverIntent_s=!1,e.out.apply(b,[a])},m=function(b){var c=a.extend({},b),d=this;d.hoverIntent_t&&(d.hoverIntent_t=clearTimeout(d.hoverIntent_t)),"mouseenter"===b.type?(h=c.pageX,i=c.pageY,a(d).on("mousemove.hoverIntent",j),d.hoverIntent_s||(d.hoverIntent_t=setTimeout(function(){k(c,d)},e.interval))):(a(d).off("mousemove.hoverIntent",j),d.hoverIntent_s&&(d.hoverIntent_t=setTimeout(function(){l(c,d)},e.timeout)))};return this.on({"mouseenter.hoverIntent":m,"mouseleave.hoverIntent":m},e.selector)}}(jQuery);
|
||||
/* jshint ignore:end */
|
||||
}
|
||||
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.parent().is('#wp-admin-bar-root-default') && !el.hasClass('hover') ) {
|
||||
e.preventDefault();
|
||||
adminbar.find('li.menupop.hover').removeClass('hover');
|
||||
el.addClass('hover');
|
||||
} else if ( !el.hasClass('hover') ) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
el.addClass('hover');
|
||||
} else if ( ! $( e.target ).closest( 'div' ).hasClass( 'ab-sub-wrapper' ) ) {
|
||||
// We're dealing with an already-touch-opened menu genericon (we know el.hasClass('hover')),
|
||||
// so close it on a second tap and prevent propag and defaults. See #29906
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
el.removeClass('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() {
|
||||
if ( disableHoverIntent )
|
||||
return;
|
||||
|
||||
$(this).addClass('hover');
|
||||
},
|
||||
out: function() {
|
||||
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'),
|
||||
parentHasHover = target.parent().hasClass('hover');
|
||||
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
if ( !wrap.length )
|
||||
wrap = $('#wpadminbar .quicklinks');
|
||||
|
||||
wrap.find('.menupop').removeClass('hover');
|
||||
|
||||
if ( ! parentHasHover ) {
|
||||
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);
|
||||
});
|
||||
|
||||
adminbar.click( function(e) {
|
||||
if ( e.target.id != 'wpadminbar' && e.target.id != 'wp-admin-bar-top-secondary' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
adminbar.find( 'li.menupop.hover' ).removeClass( 'hover' );
|
||||
$( 'html, body' ).animate( { scrollTop: 0 }, 'fast' );
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// fix focus bug in WebKit
|
||||
$('.screen-reader-shortcut').keydown( function(e) {
|
||||
var id, ua;
|
||||
|
||||
if ( 13 != e.which )
|
||||
return;
|
||||
|
||||
id = $( this ).attr( 'href' );
|
||||
|
||||
ua = navigator.userAgent.toLowerCase();
|
||||
|
||||
if ( ua.indexOf('applewebkit') != -1 && id && id.charAt(0) == '#' ) {
|
||||
setTimeout(function () {
|
||||
$(id).focus();
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
|
||||
$( '#adminbar-search' ).on({
|
||||
focus: function() {
|
||||
$( '#adminbarsearch' ).addClass( 'adminbar-focused' );
|
||||
}, blur: function() {
|
||||
$( '#adminbarsearch' ).removeClass( 'adminbar-focused' );
|
||||
}
|
||||
} );
|
||||
|
||||
// Empty sessionStorage on logging out
|
||||
if ( 'sessionStorage' in window ) {
|
||||
$('#wp-admin-bar-logout a').click( function() {
|
||||
try {
|
||||
for ( var key in sessionStorage ) {
|
||||
if ( key.indexOf('wp-autosave-') != -1 )
|
||||
sessionStorage.removeItem(key);
|
||||
}
|
||||
} catch(e) {}
|
||||
});
|
||||
}
|
||||
|
||||
if ( navigator.userAgent && document.body.className.indexOf( 'no-font-face' ) === -1 &&
|
||||
/Android (1.0|1.1|1.5|1.6|2.0|2.1)|Nokia|Opera Mini|w(eb)?OSBrowser|webOS|UCWEB|Windows Phone OS 7|XBLWP7|ZuneWP7|MSIE 7/.test( navigator.userAgent ) ) {
|
||||
|
||||
document.body.className += ' no-font-face';
|
||||
}
|
||||
});
|
||||
} 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 );
|
||||
});
|
||||
|
||||
addEvent( document.getElementById('wp-admin-bar-logout'), 'click', function() {
|
||||
if ( 'sessionStorage' in window ) {
|
||||
try {
|
||||
for ( var key in sessionStorage ) {
|
||||
if ( key.indexOf('wp-autosave-') != -1 )
|
||||
sessionStorage.removeItem(key);
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ( w.location.hash )
|
||||
w.scrollBy(0,-32);
|
||||
|
||||
if ( navigator.userAgent && document.body.className.indexOf( 'no-font-face' ) === -1 &&
|
||||
/Android (1.0|1.1|1.5|1.6|2.0|2.1)|Nokia|Opera Mini|w(eb)?OSBrowser|webOS|UCWEB|Windows Phone OS 7|XBLWP7|ZuneWP7|MSIE 7/.test( navigator.userAgent ) ) {
|
||||
|
||||
document.body.className += ' no-font-face';
|
||||
}
|
||||
});
|
||||
})(document, window);
|
||||
|
||||
}
|
||||
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/admin-bar.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/admin-bar.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
594
Kapitel_7/Lektion_4/wordpress/wp-includes/js/autosave.js
Executable file
594
Kapitel_7/Lektion_4/wordpress/wp-includes/js/autosave.js
Executable file
@@ -0,0 +1,594 @@
|
||||
/* global tinymce, wpCookies, autosaveL10n, switchEditors */
|
||||
// Back-compat
|
||||
window.autosave = function() {
|
||||
return true;
|
||||
};
|
||||
|
||||
( function( $, window ) {
|
||||
function autosave() {
|
||||
var initialCompareString,
|
||||
lastTriggerSave = 0,
|
||||
$document = $(document);
|
||||
|
||||
/**
|
||||
* Returns the data saved in both local and remote autosave
|
||||
*
|
||||
* @return object Object containing the post data
|
||||
*/
|
||||
function getPostData( type ) {
|
||||
var post_name, parent_id, data,
|
||||
time = ( new Date() ).getTime(),
|
||||
cats = [],
|
||||
editor = typeof tinymce !== 'undefined' && tinymce.get('content');
|
||||
|
||||
// Don't run editor.save() more often than every 3 sec.
|
||||
// It is resource intensive and might slow down typing in long posts on slow devices.
|
||||
if ( editor && ! editor.isHidden() && time - 3000 > lastTriggerSave ) {
|
||||
editor.save();
|
||||
lastTriggerSave = time;
|
||||
}
|
||||
|
||||
data = {
|
||||
post_id: $( '#post_ID' ).val() || 0,
|
||||
post_type: $( '#post_type' ).val() || '',
|
||||
post_author: $( '#post_author' ).val() || '',
|
||||
post_title: $( '#title' ).val() || '',
|
||||
content: $( '#content' ).val() || '',
|
||||
excerpt: $( '#excerpt' ).val() || ''
|
||||
};
|
||||
|
||||
if ( type === 'local' ) {
|
||||
return data;
|
||||
}
|
||||
|
||||
$( 'input[id^="in-category-"]:checked' ).each( function() {
|
||||
cats.push( this.value );
|
||||
});
|
||||
data.catslist = cats.join(',');
|
||||
|
||||
if ( post_name = $( '#post_name' ).val() ) {
|
||||
data.post_name = post_name;
|
||||
}
|
||||
|
||||
if ( parent_id = $( '#parent_id' ).val() ) {
|
||||
data.parent_id = parent_id;
|
||||
}
|
||||
|
||||
if ( $( '#comment_status' ).prop( 'checked' ) ) {
|
||||
data.comment_status = 'open';
|
||||
}
|
||||
|
||||
if ( $( '#ping_status' ).prop( 'checked' ) ) {
|
||||
data.ping_status = 'open';
|
||||
}
|
||||
|
||||
if ( $( '#auto_draft' ).val() === '1' ) {
|
||||
data.auto_draft = '1';
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
// Concatenate title, content and excerpt. Used to track changes when auto-saving.
|
||||
function getCompareString( postData ) {
|
||||
if ( typeof postData === 'object' ) {
|
||||
return ( postData.post_title || '' ) + '::' + ( postData.content || '' ) + '::' + ( postData.excerpt || '' );
|
||||
}
|
||||
|
||||
return ( $('#title').val() || '' ) + '::' + ( $('#content').val() || '' ) + '::' + ( $('#excerpt').val() || '' );
|
||||
}
|
||||
|
||||
function disableButtons() {
|
||||
$document.trigger('autosave-disable-buttons');
|
||||
// Re-enable 5 sec later. Just gives autosave a head start to avoid collisions.
|
||||
setTimeout( enableButtons, 5000 );
|
||||
}
|
||||
|
||||
function enableButtons() {
|
||||
$document.trigger( 'autosave-enable-buttons' );
|
||||
}
|
||||
|
||||
// Autosave in localStorage
|
||||
function autosaveLocal() {
|
||||
var restorePostData, undoPostData, blog_id, post_id, hasStorage, intervalTimer,
|
||||
lastCompareString,
|
||||
isSuspended = false;
|
||||
|
||||
// Check if the browser supports sessionStorage and it's not disabled
|
||||
function checkStorage() {
|
||||
var test = Math.random().toString(),
|
||||
result = false;
|
||||
|
||||
try {
|
||||
window.sessionStorage.setItem( 'wp-test', test );
|
||||
result = window.sessionStorage.getItem( 'wp-test' ) === test;
|
||||
window.sessionStorage.removeItem( 'wp-test' );
|
||||
} catch(e) {}
|
||||
|
||||
hasStorage = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the local storage
|
||||
*
|
||||
* @return mixed False if no sessionStorage in the browser or an Object containing all postData for this blog
|
||||
*/
|
||||
function getStorage() {
|
||||
var stored_obj = false;
|
||||
// Separate local storage containers for each blog_id
|
||||
if ( hasStorage && blog_id ) {
|
||||
stored_obj = sessionStorage.getItem( 'wp-autosave-' + blog_id );
|
||||
|
||||
if ( stored_obj ) {
|
||||
stored_obj = JSON.parse( stored_obj );
|
||||
} else {
|
||||
stored_obj = {};
|
||||
}
|
||||
}
|
||||
|
||||
return stored_obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the storage for this blog
|
||||
*
|
||||
* Confirms that the data was saved successfully.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function setStorage( stored_obj ) {
|
||||
var key;
|
||||
|
||||
if ( hasStorage && blog_id ) {
|
||||
key = 'wp-autosave-' + blog_id;
|
||||
sessionStorage.setItem( key, JSON.stringify( stored_obj ) );
|
||||
return sessionStorage.getItem( key ) !== null;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the saved post data for the current post
|
||||
*
|
||||
* @return mixed False if no storage or no data or the postData as an Object
|
||||
*/
|
||||
function getSavedPostData() {
|
||||
var stored = getStorage();
|
||||
|
||||
if ( ! stored || ! post_id ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return stored[ 'post_' + post_id ] || false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set (save or delete) post data in the storage.
|
||||
*
|
||||
* If stored_data evaluates to 'false' the storage key for the current post will be removed
|
||||
*
|
||||
* $param stored_data The post data to store or null/false/empty to delete the key
|
||||
* @return bool
|
||||
*/
|
||||
function setData( stored_data ) {
|
||||
var stored = getStorage();
|
||||
|
||||
if ( ! stored || ! post_id ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( stored_data ) {
|
||||
stored[ 'post_' + post_id ] = stored_data;
|
||||
} else if ( stored.hasOwnProperty( 'post_' + post_id ) ) {
|
||||
delete stored[ 'post_' + post_id ];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return setStorage( stored );
|
||||
}
|
||||
|
||||
function suspend() {
|
||||
isSuspended = true;
|
||||
}
|
||||
|
||||
function resume() {
|
||||
isSuspended = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save post data for the current post
|
||||
*
|
||||
* Runs on a 15 sec. interval, saves when there are differences in the post title or content.
|
||||
* When the optional data is provided, updates the last saved post data.
|
||||
*
|
||||
* $param data optional Object The post data for saving, minimum 'post_title' and 'content'
|
||||
* @return bool
|
||||
*/
|
||||
function save( data ) {
|
||||
var postData, compareString,
|
||||
result = false;
|
||||
|
||||
if ( isSuspended || ! hasStorage ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( data ) {
|
||||
postData = getSavedPostData() || {};
|
||||
$.extend( postData, data );
|
||||
} else {
|
||||
postData = getPostData('local');
|
||||
}
|
||||
|
||||
compareString = getCompareString( postData );
|
||||
|
||||
if ( typeof lastCompareString === 'undefined' ) {
|
||||
lastCompareString = initialCompareString;
|
||||
}
|
||||
|
||||
// If the content, title and excerpt did not change since the last save, don't save again
|
||||
if ( compareString === lastCompareString ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
postData.save_time = ( new Date() ).getTime();
|
||||
postData.status = $( '#post_status' ).val() || '';
|
||||
result = setData( postData );
|
||||
|
||||
if ( result ) {
|
||||
lastCompareString = compareString;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Run on DOM ready
|
||||
function run() {
|
||||
post_id = $('#post_ID').val() || 0;
|
||||
|
||||
// Check if the local post data is different than the loaded post data.
|
||||
if ( $( '#wp-content-wrap' ).hasClass( 'tmce-active' ) ) {
|
||||
// If TinyMCE loads first, check the post 1.5 sec. after it is ready.
|
||||
// By this time the content has been loaded in the editor and 'saved' to the textarea.
|
||||
// This prevents false positives.
|
||||
$document.on( 'tinymce-editor-init.autosave', function() {
|
||||
window.setTimeout( function() {
|
||||
checkPost();
|
||||
}, 1500 );
|
||||
});
|
||||
} else {
|
||||
checkPost();
|
||||
}
|
||||
|
||||
// Save every 15 sec.
|
||||
intervalTimer = window.setInterval( save, 15000 );
|
||||
|
||||
$( 'form#post' ).on( 'submit.autosave-local', function() {
|
||||
var editor = typeof tinymce !== 'undefined' && tinymce.get('content'),
|
||||
post_id = $('#post_ID').val() || 0;
|
||||
|
||||
if ( editor && ! editor.isHidden() ) {
|
||||
// Last onSubmit event in the editor, needs to run after the content has been moved to the textarea.
|
||||
editor.on( 'submit', function() {
|
||||
save({
|
||||
post_title: $( '#title' ).val() || '',
|
||||
content: $( '#content' ).val() || '',
|
||||
excerpt: $( '#excerpt' ).val() || ''
|
||||
});
|
||||
});
|
||||
} else {
|
||||
save({
|
||||
post_title: $( '#title' ).val() || '',
|
||||
content: $( '#content' ).val() || '',
|
||||
excerpt: $( '#excerpt' ).val() || ''
|
||||
});
|
||||
}
|
||||
|
||||
var secure = ( 'https:' === window.location.protocol );
|
||||
wpCookies.set( 'wp-saving-post', post_id + '-check', 24 * 60 * 60, false, false, secure );
|
||||
});
|
||||
}
|
||||
|
||||
// Strip whitespace and compare two strings
|
||||
function compare( str1, str2 ) {
|
||||
function removeSpaces( string ) {
|
||||
return string.toString().replace(/[\x20\t\r\n\f]+/g, '');
|
||||
}
|
||||
|
||||
return ( removeSpaces( str1 || '' ) === removeSpaces( str2 || '' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the saved data for the current post (if any) is different than the loaded post data on the screen
|
||||
*
|
||||
* Shows a standard message letting the user restore the post data if different.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function checkPost() {
|
||||
var content, post_title, excerpt, $notice,
|
||||
postData = getSavedPostData(),
|
||||
cookie = wpCookies.get( 'wp-saving-post' );
|
||||
|
||||
if ( cookie === post_id + '-saved' ) {
|
||||
wpCookies.remove( 'wp-saving-post' );
|
||||
// The post was saved properly, remove old data and bail
|
||||
setData( false );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! postData ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// There is a newer autosave. Don't show two "restore" notices at the same time.
|
||||
if ( $( '#has-newer-autosave' ).length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
content = $( '#content' ).val() || '';
|
||||
post_title = $( '#title' ).val() || '';
|
||||
excerpt = $( '#excerpt' ).val() || '';
|
||||
|
||||
if ( compare( content, postData.content ) && compare( post_title, postData.post_title ) &&
|
||||
compare( excerpt, postData.excerpt ) ) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
restorePostData = postData;
|
||||
undoPostData = {
|
||||
content: content,
|
||||
post_title: post_title,
|
||||
excerpt: excerpt
|
||||
};
|
||||
|
||||
$notice = $( '#local-storage-notice' )
|
||||
.insertAfter( $( '.wrap h1, .wrap h2' ).first() )
|
||||
.addClass( 'notice-warning' )
|
||||
.show();
|
||||
|
||||
$notice.on( 'click.autosave-local', function( event ) {
|
||||
var $target = $( event.target );
|
||||
|
||||
if ( $target.hasClass( 'restore-backup' ) ) {
|
||||
restorePost( restorePostData );
|
||||
$target.parent().hide();
|
||||
$(this).find( 'p.undo-restore' ).show();
|
||||
$notice.removeClass( 'notice-warning' ).addClass( 'notice-success' );
|
||||
} else if ( $target.hasClass( 'undo-restore-backup' ) ) {
|
||||
restorePost( undoPostData );
|
||||
$target.parent().hide();
|
||||
$(this).find( 'p.local-restore' ).show();
|
||||
$notice.removeClass( 'notice-success' ).addClass( 'notice-warning' );
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
// Restore the current title, content and excerpt from postData.
|
||||
function restorePost( postData ) {
|
||||
var editor;
|
||||
|
||||
if ( postData ) {
|
||||
// Set the last saved data
|
||||
lastCompareString = getCompareString( postData );
|
||||
|
||||
if ( $( '#title' ).val() !== postData.post_title ) {
|
||||
$( '#title' ).focus().val( postData.post_title || '' );
|
||||
}
|
||||
|
||||
$( '#excerpt' ).val( postData.excerpt || '' );
|
||||
editor = typeof tinymce !== 'undefined' && tinymce.get('content');
|
||||
|
||||
if ( editor && ! editor.isHidden() && typeof switchEditors !== 'undefined' ) {
|
||||
// Make sure there's an undo level in the editor
|
||||
editor.undoManager.add();
|
||||
editor.setContent( postData.content ? switchEditors.wpautop( postData.content ) : '' );
|
||||
} else {
|
||||
// Make sure the Text editor is selected
|
||||
$( '#content-html' ).click();
|
||||
$( '#content' ).val( postData.content );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
blog_id = typeof window.autosaveL10n !== 'undefined' && window.autosaveL10n.blog_id;
|
||||
|
||||
// Check if the browser supports sessionStorage and it's not disabled,
|
||||
// then initialize and run checkPost().
|
||||
// Don't run if the post type supports neither 'editor' (textarea#content) nor 'excerpt'.
|
||||
if ( checkStorage() && blog_id && ( $('#content').length || $('#excerpt').length ) ) {
|
||||
$document.ready( run );
|
||||
}
|
||||
|
||||
return {
|
||||
hasStorage: hasStorage,
|
||||
getSavedPostData: getSavedPostData,
|
||||
save: save,
|
||||
suspend: suspend,
|
||||
resume: resume
|
||||
};
|
||||
}
|
||||
|
||||
// Autosave on the server
|
||||
function autosaveServer() {
|
||||
var _blockSave, _blockSaveTimer, previousCompareString, lastCompareString,
|
||||
nextRun = 0,
|
||||
isSuspended = false;
|
||||
|
||||
// Block saving for the next 10 sec.
|
||||
function tempBlockSave() {
|
||||
_blockSave = true;
|
||||
window.clearTimeout( _blockSaveTimer );
|
||||
|
||||
_blockSaveTimer = window.setTimeout( function() {
|
||||
_blockSave = false;
|
||||
}, 10000 );
|
||||
}
|
||||
|
||||
function suspend() {
|
||||
isSuspended = true;
|
||||
}
|
||||
|
||||
function resume() {
|
||||
isSuspended = false;
|
||||
}
|
||||
|
||||
// Runs on heartbeat-response
|
||||
function response( data ) {
|
||||
_schedule();
|
||||
_blockSave = false;
|
||||
lastCompareString = previousCompareString;
|
||||
previousCompareString = '';
|
||||
|
||||
$document.trigger( 'after-autosave', [data] );
|
||||
enableButtons();
|
||||
|
||||
if ( data.success ) {
|
||||
// No longer an auto-draft
|
||||
$( '#auto_draft' ).val('');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save immediately
|
||||
*
|
||||
* Resets the timing and tells heartbeat to connect now
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function triggerSave() {
|
||||
nextRun = 0;
|
||||
wp.heartbeat.connectNow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post content in the textarea has changed since page load.
|
||||
*
|
||||
* This also happens when TinyMCE is active and editor.save() is triggered by
|
||||
* wp.autosave.getPostData().
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function postChanged() {
|
||||
return getCompareString() !== initialCompareString;
|
||||
}
|
||||
|
||||
// Runs on 'heartbeat-send'
|
||||
function save() {
|
||||
var postData, compareString;
|
||||
|
||||
// window.autosave() used for back-compat
|
||||
if ( isSuspended || _blockSave || ! window.autosave() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ( new Date() ).getTime() < nextRun ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
postData = getPostData();
|
||||
compareString = getCompareString( postData );
|
||||
|
||||
// First check
|
||||
if ( typeof lastCompareString === 'undefined' ) {
|
||||
lastCompareString = initialCompareString;
|
||||
}
|
||||
|
||||
// No change
|
||||
if ( compareString === lastCompareString ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
previousCompareString = compareString;
|
||||
tempBlockSave();
|
||||
disableButtons();
|
||||
|
||||
$document.trigger( 'wpcountwords', [ postData.content ] )
|
||||
.trigger( 'before-autosave', [ postData ] );
|
||||
|
||||
postData._wpnonce = $( '#_wpnonce' ).val() || '';
|
||||
|
||||
return postData;
|
||||
}
|
||||
|
||||
function _schedule() {
|
||||
nextRun = ( new Date() ).getTime() + ( autosaveL10n.autosaveInterval * 1000 ) || 60000;
|
||||
}
|
||||
|
||||
$document.on( 'heartbeat-send.autosave', function( event, data ) {
|
||||
var autosaveData = save();
|
||||
|
||||
if ( autosaveData ) {
|
||||
data.wp_autosave = autosaveData;
|
||||
}
|
||||
}).on( 'heartbeat-tick.autosave', function( event, data ) {
|
||||
if ( data.wp_autosave ) {
|
||||
response( data.wp_autosave );
|
||||
}
|
||||
}).on( 'heartbeat-connection-lost.autosave', function( event, error, status ) {
|
||||
// When connection is lost, keep user from submitting changes.
|
||||
if ( 'timeout' === error || 603 === status ) {
|
||||
var $notice = $('#lost-connection-notice');
|
||||
|
||||
if ( ! wp.autosave.local.hasStorage ) {
|
||||
$notice.find('.hide-if-no-sessionstorage').hide();
|
||||
}
|
||||
|
||||
$notice.show();
|
||||
disableButtons();
|
||||
}
|
||||
}).on( 'heartbeat-connection-restored.autosave', function() {
|
||||
$('#lost-connection-notice').hide();
|
||||
enableButtons();
|
||||
}).ready( function() {
|
||||
_schedule();
|
||||
});
|
||||
|
||||
return {
|
||||
tempBlockSave: tempBlockSave,
|
||||
triggerSave: triggerSave,
|
||||
postChanged: postChanged,
|
||||
suspend: suspend,
|
||||
resume: resume
|
||||
};
|
||||
}
|
||||
|
||||
// Wait for TinyMCE to initialize plus 1 sec. for any external css to finish loading,
|
||||
// then 'save' to the textarea before setting initialCompareString.
|
||||
// This avoids any insignificant differences between the initial textarea content and the content
|
||||
// extracted from the editor.
|
||||
$document.on( 'tinymce-editor-init.autosave', function( event, editor ) {
|
||||
if ( editor.id === 'content' ) {
|
||||
window.setTimeout( function() {
|
||||
editor.save();
|
||||
initialCompareString = getCompareString();
|
||||
}, 1000 );
|
||||
}
|
||||
}).ready( function() {
|
||||
// Set the initial compare string in case TinyMCE is not used or not loaded first
|
||||
initialCompareString = getCompareString();
|
||||
});
|
||||
|
||||
return {
|
||||
getPostData: getPostData,
|
||||
getCompareString: getCompareString,
|
||||
disableButtons: disableButtons,
|
||||
enableButtons: enableButtons,
|
||||
local: autosaveLocal(),
|
||||
server: autosaveServer()
|
||||
};
|
||||
}
|
||||
|
||||
window.wp = window.wp || {};
|
||||
window.wp.autosave = autosave();
|
||||
|
||||
}( jQuery, window ));
|
||||
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/autosave.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/autosave.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/backbone.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/backbone.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
707
Kapitel_7/Lektion_4/wordpress/wp-includes/js/colorpicker.js
Executable file
707
Kapitel_7/Lektion_4/wordpress/wp-includes/js/colorpicker.js
Executable 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
Kapitel_7/Lektion_4/wordpress/wp-includes/js/colorpicker.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/colorpicker.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
96
Kapitel_7/Lektion_4/wordpress/wp-includes/js/comment-reply.js
Executable file
96
Kapitel_7/Lektion_4/wordpress/wp-includes/js/comment-reply.js
Executable file
@@ -0,0 +1,96 @@
|
||||
var addComment = {
|
||||
moveForm: function( commId, parentId, respondId, postId ) {
|
||||
var div, element, style, cssHidden,
|
||||
t = this,
|
||||
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' ),
|
||||
commentForm = respond.getElementsByTagName( 'form' )[0];
|
||||
|
||||
if ( ! comm || ! respond || ! cancel || ! parent || ! commentForm ) {
|
||||
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;
|
||||
};
|
||||
|
||||
/*
|
||||
* Set initial focus to the first form focusable element.
|
||||
* Try/catch used just to avoid errors in IE 7- which return visibility
|
||||
* 'inherit' when the visibility value is inherited from an ancestor.
|
||||
*/
|
||||
try {
|
||||
for ( var i = 0; i < commentForm.elements.length; i++ ) {
|
||||
element = commentForm.elements[i];
|
||||
cssHidden = false;
|
||||
|
||||
// Modern browsers.
|
||||
if ( 'getComputedStyle' in window ) {
|
||||
style = window.getComputedStyle( element );
|
||||
// IE 8.
|
||||
} else if ( document.documentElement.currentStyle ) {
|
||||
style = element.currentStyle;
|
||||
}
|
||||
|
||||
/*
|
||||
* For display none, do the same thing jQuery does. For visibility,
|
||||
* check the element computed style since browsers are already doing
|
||||
* the job for us. In fact, the visibility computed style is the actual
|
||||
* computed value and already takes into account the element ancestors.
|
||||
*/
|
||||
if ( ( element.offsetWidth <= 0 && element.offsetHeight <= 0 ) || style.visibility === 'hidden' ) {
|
||||
cssHidden = true;
|
||||
}
|
||||
|
||||
// Skip form elements that are hidden or disabled.
|
||||
if ( 'hidden' === element.type || element.disabled || cssHidden ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
element.focus();
|
||||
// Stop after the first focusable element.
|
||||
break;
|
||||
}
|
||||
|
||||
} catch( er ) {}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
I: function( id ) {
|
||||
return document.getElementById( id );
|
||||
}
|
||||
};
|
||||
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/comment-reply.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/comment-reply.min.js
vendored
Executable file
@@ -0,0 +1 @@
|
||||
var addComment={moveForm:function(a,b,c,d){var e,f,g,h,i=this,j=i.I(a),k=i.I(c),l=i.I("cancel-comment-reply-link"),m=i.I("comment_parent"),n=i.I("comment_post_ID"),o=k.getElementsByTagName("form")[0];if(j&&k&&l&&m&&o){i.respondId=c,d=d||!1,i.I("wp-temp-form-div")||(e=document.createElement("div"),e.id="wp-temp-form-div",e.style.display="none",k.parentNode.insertBefore(e,k)),j.parentNode.insertBefore(k,j.nextSibling),n&&d&&(n.value=d),m.value=b,l.style.display="",l.onclick=function(){var a=addComment,b=a.I("wp-temp-form-div"),c=a.I(a.respondId);if(b&&c)return a.I("comment_parent").value="0",b.parentNode.insertBefore(c,b),b.parentNode.removeChild(b),this.style.display="none",this.onclick=null,!1};try{for(var p=0;p<o.elements.length;p++)if(f=o.elements[p],h=!1,"getComputedStyle"in window?g=window.getComputedStyle(f):document.documentElement.currentStyle&&(g=f.currentStyle),(f.offsetWidth<=0&&f.offsetHeight<=0||"hidden"===g.visibility)&&(h=!0),"hidden"!==f.type&&!f.disabled&&!h){f.focus();break}}catch(q){}return!1}},I:function(a){return document.getElementById(a)}};
|
||||
165
Kapitel_7/Lektion_4/wordpress/wp-includes/js/crop/cropper.css
Executable file
165
Kapitel_7/Lektion_4/wordpress/wp-includes/js/crop/cropper.css
Executable 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 its 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
Kapitel_7/Lektion_4/wordpress/wp-includes/js/crop/cropper.js
Executable file
516
Kapitel_7/Lektion_4/wordpress/wp-includes/js/crop/cropper.js
Executable 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
Kapitel_7/Lektion_4/wordpress/wp-includes/js/crop/marqueeHoriz.gif
Executable file
BIN
Kapitel_7/Lektion_4/wordpress/wp-includes/js/crop/marqueeHoriz.gif
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 277 B |
BIN
Kapitel_7/Lektion_4/wordpress/wp-includes/js/crop/marqueeVert.gif
Executable file
BIN
Kapitel_7/Lektion_4/wordpress/wp-includes/js/crop/marqueeVert.gif
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 293 B |
778
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-base.js
Executable file
778
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-base.js
Executable file
@@ -0,0 +1,778 @@
|
||||
window.wp = window.wp || {};
|
||||
|
||||
(function( exports, $ ){
|
||||
var api = {}, ctor, inherits,
|
||||
slice = Array.prototype.slice;
|
||||
|
||||
// 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.
|
||||
*
|
||||
* @param object parent Parent class constructor to inherit from.
|
||||
* @param object protoProps Properties to apply to the prototype for use as class instance properties.
|
||||
* @param object staticProps Properties to apply directly to the class constructor.
|
||||
* @return child The subclassed constructor.
|
||||
*/
|
||||
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;
|
||||
};
|
||||
|
||||
/**
|
||||
* Base class for object inheritance.
|
||||
*/
|
||||
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 the class has a method called "instance",
|
||||
* the return value from the class' constructor will be a function that
|
||||
* calls the "instance" method.
|
||||
*
|
||||
* It is also an object that has properties and methods inside it.
|
||||
*/
|
||||
if ( this.instance ) {
|
||||
magic = function() {
|
||||
return magic.instance.apply( magic, arguments );
|
||||
};
|
||||
|
||||
$.extend( magic, this );
|
||||
}
|
||||
|
||||
magic.initialize.apply( magic, args );
|
||||
return magic;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a subclass of the class.
|
||||
*
|
||||
* @param object protoProps Properties to apply to the prototype.
|
||||
* @param object staticProps Properties to apply directly to the class.
|
||||
* @return child The subclass.
|
||||
*/
|
||||
api.Class.extend = function( protoProps, classProps ) {
|
||||
var child = inherits( this, protoProps, classProps );
|
||||
child.extend = this.extend;
|
||||
return child;
|
||||
};
|
||||
|
||||
api.Class.applicator = {};
|
||||
|
||||
/**
|
||||
* Initialize a class instance.
|
||||
*
|
||||
* Override this function in a subclass as needed.
|
||||
*/
|
||||
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;
|
||||
};
|
||||
|
||||
/**
|
||||
* An events manager object, offering the ability to bind to and trigger events.
|
||||
*
|
||||
* Used as a 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 ) {
|
||||
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 ) {
|
||||
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.
|
||||
*
|
||||
* @constuctor
|
||||
*/
|
||||
api.Value = api.Class.extend({
|
||||
/**
|
||||
* @param {mixed} initial The initial value.
|
||||
* @param {object} options
|
||||
*/
|
||||
initialize: function( initial, options ) {
|
||||
this._value = initial; // @todo: potentially change this to a this.set() call.
|
||||
this.callbacks = $.Callbacks();
|
||||
this._dirty = false;
|
||||
|
||||
$.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 the value.
|
||||
*
|
||||
* @return {mixed}
|
||||
*/
|
||||
get: function() {
|
||||
return this._value;
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the value and trigger all bound callbacks.
|
||||
*
|
||||
* @param {object} to New 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 || _.isEqual( from, to ) ) {
|
||||
return this;
|
||||
}
|
||||
|
||||
this._value = to;
|
||||
this._dirty = true;
|
||||
|
||||
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 a function to be invoked whenever the value changes.
|
||||
*
|
||||
* @param {...Function} A function, or multiple functions, to add to the callback stack.
|
||||
*/
|
||||
bind: function() {
|
||||
this.callbacks.add.apply( this.callbacks, arguments );
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Unbind a previously bound function.
|
||||
*
|
||||
* @param {...Function} A function, or multiple functions, to remove from the callback stack.
|
||||
*/
|
||||
unbind: function() {
|
||||
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.
|
||||
*
|
||||
* @constuctor
|
||||
* @augments wp.customize.Class
|
||||
* @mixes wp.customize.Events
|
||||
*/
|
||||
api.Values = api.Class.extend({
|
||||
|
||||
/**
|
||||
* The default constructor for items of the collection.
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
defaultConstructor: api.Value,
|
||||
|
||||
initialize: function( options ) {
|
||||
$.extend( this, options || {} );
|
||||
|
||||
this._value = {};
|
||||
this._deferreds = {};
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the instance of an item from the collection if only ID is specified.
|
||||
*
|
||||
* If more than one argument is supplied, all are expected to be IDs and
|
||||
* the last to be a function callback that will be invoked when the requested
|
||||
* items are available.
|
||||
*
|
||||
* @see {api.Values.when}
|
||||
*
|
||||
* @param {string} id ID of the item.
|
||||
* @param {...} Zero or more IDs of items to wait for and a callback
|
||||
* function to invoke when they're available. Optional.
|
||||
* @return {mixed} The item instance if only one ID was supplied.
|
||||
* A Deferred Promise object if a callback function is supplied.
|
||||
*/
|
||||
instance: function( id ) {
|
||||
if ( arguments.length === 1 )
|
||||
return this.value( id );
|
||||
|
||||
return this.when.apply( this, arguments );
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the instance of an item.
|
||||
*
|
||||
* @param {string} id The ID of the item.
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
value: function( id ) {
|
||||
return this._value[ id ];
|
||||
},
|
||||
|
||||
/**
|
||||
* Whether the collection has an item with the given ID.
|
||||
*
|
||||
* @param {string} id The ID of the item to look for.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
has: function( id ) {
|
||||
return typeof this._value[ id ] !== 'undefined';
|
||||
},
|
||||
|
||||
/**
|
||||
* Add an item to the collection.
|
||||
*
|
||||
* @param {string} id The ID of the item.
|
||||
* @param {mixed} value The item instance.
|
||||
* @return {mixed} The new item's instance.
|
||||
*/
|
||||
add: function( id, value ) {
|
||||
if ( this.has( id ) )
|
||||
return this.value( id );
|
||||
|
||||
this._value[ id ] = value;
|
||||
value.parent = this;
|
||||
|
||||
// Propagate a 'change' event on an item up to the collection.
|
||||
if ( value.extended( api.Value ) )
|
||||
value.bind( this._change );
|
||||
|
||||
this.trigger( 'add', value );
|
||||
|
||||
// If a deferred object exists for this item,
|
||||
// resolve it.
|
||||
if ( this._deferreds[ id ] )
|
||||
this._deferreds[ id ].resolve();
|
||||
|
||||
return this._value[ id ];
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a new item of the collection using the collection's default constructor
|
||||
* and store it in the collection.
|
||||
*
|
||||
* @param {string} id The ID of the item.
|
||||
* @param {mixed} value Any extra arguments are passed into the item's initialize method.
|
||||
* @return {mixed} The new item's instance.
|
||||
*/
|
||||
create: function( id ) {
|
||||
return this.add( id, new this.defaultConstructor( api.Class.applicator, slice.call( arguments, 1 ) ) );
|
||||
},
|
||||
|
||||
/**
|
||||
* Iterate over all items in the collection invoking the provided callback.
|
||||
*
|
||||
* @param {Function} callback Function to invoke.
|
||||
* @param {object} context Object context to invoke the function with. Optional.
|
||||
*/
|
||||
each: function( callback, context ) {
|
||||
context = typeof context === 'undefined' ? this : context;
|
||||
|
||||
$.each( this._value, function( key, obj ) {
|
||||
callback.call( context, obj, key );
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove an item from the collection.
|
||||
*
|
||||
* @param {string} id The ID of the item to remove.
|
||||
*/
|
||||
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() );
|
||||
|
||||
/*
|
||||
* Create a stack of deferred objects for each item that is not
|
||||
* yet available, and invoke the supplied callback when they are.
|
||||
*/
|
||||
$.when.apply( $, $.map( ids, function( id ) {
|
||||
if ( self.has( id ) )
|
||||
return;
|
||||
|
||||
/*
|
||||
* The requested item is not available yet, create a deferred
|
||||
* object to resolve when it becomes available.
|
||||
*/
|
||||
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();
|
||||
},
|
||||
|
||||
/**
|
||||
* A helper function to propagate a 'change' event from an item
|
||||
* to the collection itself.
|
||||
*/
|
||||
_change: function() {
|
||||
this.parent.trigger( 'change', this );
|
||||
}
|
||||
});
|
||||
|
||||
// Create a global events bus on the Customizer.
|
||||
$.extend( api.Values.prototype, api.Events );
|
||||
|
||||
|
||||
/**
|
||||
* Cast a string to a jQuery collection if it isn't already.
|
||||
*
|
||||
* @param {string|jQuery collection} element
|
||||
*/
|
||||
api.ensure = function( element ) {
|
||||
return typeof element == 'string' ? $( element ) : element;
|
||||
};
|
||||
|
||||
/**
|
||||
* An observable value that syncs with an element.
|
||||
*
|
||||
* Handles inputs, selects, and textareas by default.
|
||||
*
|
||||
* @constuctor
|
||||
* @augments wp.customize.Value
|
||||
* @augments wp.customize.Class
|
||||
*/
|
||||
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 ( 'range' === type ) {
|
||||
this.events += ' input propertychange';
|
||||
}
|
||||
} 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( index, 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();
|
||||
}
|
||||
};
|
||||
|
||||
$.support.postMessage = !! window.postMessage;
|
||||
|
||||
/**
|
||||
* A communicator for sending data from one window to another over postMessage.
|
||||
*
|
||||
* @constuctor
|
||||
* @augments wp.customize.Class
|
||||
* @mixes wp.customize.Events
|
||||
*/
|
||||
api.Messenger = api.Class.extend({
|
||||
/**
|
||||
* Create a new Value.
|
||||
*
|
||||
* @param {string} key Unique identifier.
|
||||
* @param {mixed} initial Initial value.
|
||||
* @param {mixed} options Options hash. Optional.
|
||||
* @return {Value} Class instance of the Value.
|
||||
*/
|
||||
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( 'origin', this.url() ).link( this.url ).setter( function( to ) {
|
||||
return to.replace( /([^:]+:\/\/[^\/]+).*/, '$1' );
|
||||
});
|
||||
|
||||
// first add with no value
|
||||
this.add( 'targetWindow', null );
|
||||
// This avoids SecurityErrors when setting a window object in x-origin iframe'd scenarios.
|
||||
this.targetWindow.set = function( to ) {
|
||||
var from = this._value;
|
||||
|
||||
to = this._setter.apply( this, arguments );
|
||||
to = this.validate( to );
|
||||
|
||||
if ( null === to || from === to ) {
|
||||
return this;
|
||||
}
|
||||
|
||||
this._value = to;
|
||||
this._dirty = true;
|
||||
|
||||
this.callbacks.fireWith( this, [ to, from ] );
|
||||
|
||||
return this;
|
||||
};
|
||||
// now set it
|
||||
this.targetWindow( params.targetWindow || defaultTarget );
|
||||
|
||||
|
||||
// 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 data from the other window.
|
||||
*
|
||||
* @param {jQuery.Event} event Event with embedded data.
|
||||
*/
|
||||
receive: function( event ) {
|
||||
var message;
|
||||
|
||||
event = event.originalEvent;
|
||||
|
||||
if ( ! this.targetWindow || ! this.targetWindow() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check to make sure the origin is valid.
|
||||
if ( this.origin() && event.origin !== this.origin() )
|
||||
return;
|
||||
|
||||
// Ensure we have a string that's JSON.parse-able
|
||||
if ( typeof event.data !== 'string' || event.data[0] !== '{' ) {
|
||||
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 data to the other window.
|
||||
*
|
||||
* @param {string} id The event name.
|
||||
* @param {object} data 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 );
|
||||
|
||||
// The main API object is also a collection of all customizer settings.
|
||||
api = $.extend( new api.Values(), api );
|
||||
|
||||
/**
|
||||
* Get all customize settings.
|
||||
*
|
||||
* @return {object}
|
||||
*/
|
||||
api.get = function() {
|
||||
var result = {};
|
||||
|
||||
this.each( function( obj, key ) {
|
||||
result[ key ] = obj.get();
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
// Expose the API publicly on window.wp.customize
|
||||
exports.customize = api;
|
||||
})( wp, jQuery );
|
||||
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-base.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-base.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
267
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-loader.js
Executable file
267
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-loader.js
Executable file
@@ -0,0 +1,267 @@
|
||||
/* global _wpCustomizeLoaderSettings, confirm */
|
||||
/*
|
||||
* Expose a public API that allows the customizer to be
|
||||
* loaded on any page.
|
||||
*/
|
||||
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)
|
||||
});
|
||||
|
||||
/**
|
||||
* Allows the Customizer to be overlayed on any page.
|
||||
*
|
||||
* By default, any element in the body with the load-customize class will open
|
||||
* an iframe overlay with the URL specified.
|
||||
*
|
||||
* e.g. <a class="load-customize" href="<?php echo wp_customize_url(); ?>">Open Customizer</a>
|
||||
*
|
||||
* @augments wp.customize.Events
|
||||
*/
|
||||
Loader = $.extend( {}, api.Events, {
|
||||
/**
|
||||
* Setup the Loader; triggered on document#ready.
|
||||
*/
|
||||
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 );
|
||||
|
||||
// Bind events for opening and closing the overlay.
|
||||
this.bind( 'open', this.overlay.show );
|
||||
this.bind( 'close', this.overlay.hide );
|
||||
|
||||
// Any element in the body with the `load-customize` class opens
|
||||
// the Customizer.
|
||||
$('#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() {
|
||||
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();
|
||||
}
|
||||
},
|
||||
|
||||
beforeunload: function () {
|
||||
if ( ! Loader.saved() ) {
|
||||
return Loader.settings.l10n.saveAlert;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Open the Customizer overlay for a specific URL.
|
||||
*
|
||||
* @param string src URL to load in the Customizer.
|
||||
*/
|
||||
open: function( src ) {
|
||||
|
||||
if ( this.active ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load the full page on mobile devices.
|
||||
if ( Loader.settings.browser.mobile ) {
|
||||
return window.location = src;
|
||||
}
|
||||
|
||||
// Store the document title prior to opening the Live Preview
|
||||
this.originalDocumentTitle = document.title;
|
||||
|
||||
this.active = true;
|
||||
this.body.addClass('customize-loading');
|
||||
|
||||
/*
|
||||
* Track the dirtiness state (whether the drafted changes have been published)
|
||||
* of the Customizer in the iframe. This is used to decide whether to display
|
||||
* an AYS alert if the user tries to close the window before saving changes.
|
||||
*/
|
||||
this.saved = new api.Value( true );
|
||||
|
||||
this.iframe = $( '<iframe />', { 'src': src, 'title': Loader.settings.l10n.mainIframeTitle } ).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();
|
||||
}
|
||||
});
|
||||
|
||||
// Prompt AYS dialog when navigating away
|
||||
$( window ).on( 'beforeunload', this.beforeunload );
|
||||
|
||||
this.messenger.bind( 'activated', function( location ) {
|
||||
if ( location ) {
|
||||
window.location = location;
|
||||
}
|
||||
});
|
||||
|
||||
this.messenger.bind( 'saved', function () {
|
||||
Loader.saved( true );
|
||||
} );
|
||||
this.messenger.bind( 'change', function () {
|
||||
Loader.saved( false );
|
||||
} );
|
||||
|
||||
this.messenger.bind( 'title', function( newTitle ){
|
||||
window.document.title = newTitle;
|
||||
});
|
||||
|
||||
this.pushState( src );
|
||||
|
||||
this.trigger( 'open' );
|
||||
},
|
||||
|
||||
pushState: function ( src ) {
|
||||
var 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' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback after the Customizer has been opened.
|
||||
*/
|
||||
opened: function() {
|
||||
Loader.body.addClass( 'customize-active full-overlay-active' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Close the Customizer overlay and return focus to the link that opened it.
|
||||
*/
|
||||
close: function() {
|
||||
if ( ! this.active ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Display AYS dialog if Customizer is dirty
|
||||
if ( ! this.saved() && ! confirm( Loader.settings.l10n.saveAlert ) ) {
|
||||
// Go forward since Customizer is exited by history.back()
|
||||
history.forward();
|
||||
return;
|
||||
}
|
||||
|
||||
this.active = false;
|
||||
|
||||
this.trigger( 'close' );
|
||||
|
||||
// Restore document title prior to opening the Live Preview
|
||||
if ( this.originalDocumentTitle ) {
|
||||
document.title = this.originalDocumentTitle;
|
||||
}
|
||||
|
||||
// Return focus to link that was originally clicked.
|
||||
if ( this.link ) {
|
||||
this.link.focus();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback after the Customizer has been closed.
|
||||
*/
|
||||
closed: function() {
|
||||
Loader.iframe.remove();
|
||||
Loader.messenger.destroy();
|
||||
Loader.iframe = null;
|
||||
Loader.messenger = null;
|
||||
Loader.saved = null;
|
||||
Loader.body.removeClass( 'customize-active full-overlay-active' ).removeClass( 'customize-loading' );
|
||||
$( window ).off( 'beforeunload', Loader.beforeunload );
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback for the `load` event on the Customizer iframe.
|
||||
*/
|
||||
loaded: function() {
|
||||
Loader.body.removeClass('customize-loading');
|
||||
},
|
||||
|
||||
/**
|
||||
* Overlay hide/show utility methods.
|
||||
*/
|
||||
overlay: {
|
||||
show: function() {
|
||||
this.element.fadeIn( 200, Loader.opened );
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.element.fadeOut( 200, Loader.closed );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Bootstrap the Loader on document#ready.
|
||||
$( function() {
|
||||
Loader.settings = _wpCustomizeLoaderSettings;
|
||||
Loader.initialize();
|
||||
});
|
||||
|
||||
// Expose the API publicly on window.wp.customize.Loader
|
||||
api.Loader = Loader;
|
||||
})( wp, jQuery );
|
||||
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-loader.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-loader.min.js
vendored
Executable file
@@ -0,0 +1 @@
|
||||
window.wp=window.wp||{},function(a,b){var c,d=wp.customize;b.extend(b.support,{history:!(!window.history||!history.pushState),hashchange:"onhashchange"in window&&(void 0===document.documentMode||document.documentMode>7)}),c=b.extend({},d.Events,{initialize:function(){this.body=b(document.body),c.settings&&b.support.postMessage&&(b.support.cors||!c.settings.isCrossDomain)&&(this.window=b(window),this.element=b('<div id="customize-container" />').appendTo(this.body),this.bind("open",this.overlay.show),this.bind("close",this.overlay.hide),b("#wpbody").on("click",".load-customize",function(a){a.preventDefault(),c.link=b(this),c.open(c.link.attr("href"))}),b.support.history&&this.window.on("popstate",c.popstate),b.support.hashchange&&(this.window.on("hashchange",c.hashchange),this.window.triggerHandler("hashchange")))},popstate:function(a){var b=a.originalEvent.state;b&&b.customize?c.open(b.customize):c.active&&c.close()},hashchange:function(){var a=window.location.toString().split("#")[1];a&&0===a.indexOf("wp_customize=on")&&c.open(c.settings.url+"?"+a),a||b.support.history||c.close()},beforeunload:function(){return c.saved()?void 0:c.settings.l10n.saveAlert},open:function(a){if(!this.active){if(c.settings.browser.mobile)return window.location=a;this.originalDocumentTitle=document.title,this.active=!0,this.body.addClass("customize-loading"),this.saved=new d.Value(!0),this.iframe=b("<iframe />",{src:a,title:c.settings.l10n.mainIframeTitle}).appendTo(this.element),this.iframe.one("load",this.loaded),this.messenger=new d.Messenger({url:a,channel:"loader",targetWindow:this.iframe[0].contentWindow}),this.messenger.bind("ready",function(){c.messenger.send("back")}),this.messenger.bind("close",function(){b.support.history?history.back():b.support.hashchange?window.location.hash="":c.close()}),b(window).on("beforeunload",this.beforeunload),this.messenger.bind("activated",function(a){a&&(window.location=a)}),this.messenger.bind("saved",function(){c.saved(!0)}),this.messenger.bind("change",function(){c.saved(!1)}),this.messenger.bind("title",function(a){window.document.title=a}),this.pushState(a),this.trigger("open")}},pushState:function(a){var c=a.split("?")[1];b.support.history&&window.location.href!==a?history.pushState({customize:a},"",a):!b.support.history&&b.support.hashchange&&c&&(window.location.hash="wp_customize=on&"+c),this.trigger("open")},opened:function(){c.body.addClass("customize-active full-overlay-active")},close:function(){if(this.active){if(!this.saved()&&!confirm(c.settings.l10n.saveAlert))return void history.forward();this.active=!1,this.trigger("close"),this.originalDocumentTitle&&(document.title=this.originalDocumentTitle),this.link&&this.link.focus()}},closed:function(){c.iframe.remove(),c.messenger.destroy(),c.iframe=null,c.messenger=null,c.saved=null,c.body.removeClass("customize-active full-overlay-active").removeClass("customize-loading"),b(window).off("beforeunload",c.beforeunload)},loaded:function(){c.body.removeClass("customize-loading")},overlay:{show:function(){this.element.fadeIn(200,c.opened)},hide:function(){this.element.fadeOut(200,c.closed)}}}),b(function(){c.settings=_wpCustomizeLoaderSettings,c.initialize()}),d.Loader=c}(wp,jQuery);
|
||||
247
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-models.js
Executable file
247
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-models.js
Executable file
@@ -0,0 +1,247 @@
|
||||
/* global _wpCustomizeHeader */
|
||||
(function( $, wp ) {
|
||||
var api = wp.customize;
|
||||
api.HeaderTool = {};
|
||||
|
||||
|
||||
/**
|
||||
* wp.customize.HeaderTool.ImageModel
|
||||
*
|
||||
* A header image. This is where saves via the Customizer API are
|
||||
* abstracted away, plus our own AJAX calls to add images to and remove
|
||||
* images from the user's recently uploaded images setting on the server.
|
||||
* These calls are made regardless of whether the user actually saves new
|
||||
* Customizer settings.
|
||||
*
|
||||
* @constructor
|
||||
* @augments Backbone.Model
|
||||
*/
|
||||
api.HeaderTool.ImageModel = Backbone.Model.extend({
|
||||
defaults: function() {
|
||||
return {
|
||||
header: {
|
||||
attachment_id: 0,
|
||||
url: '',
|
||||
timestamp: _.now(),
|
||||
thumbnail_url: ''
|
||||
},
|
||||
choice: '',
|
||||
selected: false,
|
||||
random: false
|
||||
};
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
this.on('hide', this.hide, this);
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.set('choice', '');
|
||||
api('header_image').set('remove-header');
|
||||
api('header_image_data').set('remove-header');
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
var data = this.get('header'),
|
||||
curr = api.HeaderTool.currentHeader.get('header').attachment_id;
|
||||
|
||||
// If the image we're removing is also the current header, unset
|
||||
// the latter
|
||||
if (curr && data.attachment_id === curr) {
|
||||
api.HeaderTool.currentHeader.trigger('hide');
|
||||
}
|
||||
|
||||
wp.ajax.post( 'custom-header-remove', {
|
||||
nonce: _wpCustomizeHeader.nonces.remove,
|
||||
wp_customize: 'on',
|
||||
theme: api.settings.theme.stylesheet,
|
||||
attachment_id: data.attachment_id
|
||||
});
|
||||
|
||||
this.trigger('destroy', this, this.collection);
|
||||
},
|
||||
|
||||
save: function() {
|
||||
if (this.get('random')) {
|
||||
api('header_image').set(this.get('header').random);
|
||||
api('header_image_data').set(this.get('header').random);
|
||||
} else {
|
||||
if (this.get('header').defaultName) {
|
||||
api('header_image').set(this.get('header').url);
|
||||
api('header_image_data').set(this.get('header').defaultName);
|
||||
} else {
|
||||
api('header_image').set(this.get('header').url);
|
||||
api('header_image_data').set(this.get('header'));
|
||||
}
|
||||
}
|
||||
|
||||
api.HeaderTool.combinedList.trigger('control:setImage', this);
|
||||
},
|
||||
|
||||
importImage: function() {
|
||||
var data = this.get('header');
|
||||
if (data.attachment_id === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp.ajax.post( 'custom-header-add', {
|
||||
nonce: _wpCustomizeHeader.nonces.add,
|
||||
wp_customize: 'on',
|
||||
theme: api.settings.theme.stylesheet,
|
||||
attachment_id: data.attachment_id
|
||||
} );
|
||||
},
|
||||
|
||||
shouldBeCropped: function() {
|
||||
if (this.get('themeFlexWidth') === true &&
|
||||
this.get('themeFlexHeight') === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.get('themeFlexWidth') === true &&
|
||||
this.get('themeHeight') === this.get('imageHeight')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.get('themeFlexHeight') === true &&
|
||||
this.get('themeWidth') === this.get('imageWidth')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.get('themeWidth') === this.get('imageWidth') &&
|
||||
this.get('themeHeight') === this.get('imageHeight')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.get('imageWidth') <= this.get('themeWidth')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* wp.customize.HeaderTool.ChoiceList
|
||||
*
|
||||
* @constructor
|
||||
* @augments Backbone.Collection
|
||||
*/
|
||||
api.HeaderTool.ChoiceList = Backbone.Collection.extend({
|
||||
model: api.HeaderTool.ImageModel,
|
||||
|
||||
// Ordered from most recently used to least
|
||||
comparator: function(model) {
|
||||
return -model.get('header').timestamp;
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
var current = api.HeaderTool.currentHeader.get('choice').replace(/^https?:\/\//, ''),
|
||||
isRandom = this.isRandomChoice(api.get().header_image);
|
||||
|
||||
// Overridable by an extending class
|
||||
if (!this.type) {
|
||||
this.type = 'uploaded';
|
||||
}
|
||||
|
||||
// Overridable by an extending class
|
||||
if (typeof this.data === 'undefined') {
|
||||
this.data = _wpCustomizeHeader.uploads;
|
||||
}
|
||||
|
||||
if (isRandom) {
|
||||
// So that when adding data we don't hide regular images
|
||||
current = api.get().header_image;
|
||||
}
|
||||
|
||||
this.on('control:setImage', this.setImage, this);
|
||||
this.on('control:removeImage', this.removeImage, this);
|
||||
this.on('add', this.maybeAddRandomChoice, this);
|
||||
|
||||
_.each(this.data, function(elt, index) {
|
||||
if (!elt.attachment_id) {
|
||||
elt.defaultName = index;
|
||||
}
|
||||
|
||||
if (typeof elt.timestamp === 'undefined') {
|
||||
elt.timestamp = 0;
|
||||
}
|
||||
|
||||
this.add({
|
||||
header: elt,
|
||||
choice: elt.url.split('/').pop(),
|
||||
selected: current === elt.url.replace(/^https?:\/\//, '')
|
||||
}, { silent: true });
|
||||
}, this);
|
||||
|
||||
if (this.size() > 0) {
|
||||
this.addRandomChoice(current);
|
||||
}
|
||||
},
|
||||
|
||||
maybeAddRandomChoice: function() {
|
||||
if (this.size() === 1) {
|
||||
this.addRandomChoice();
|
||||
}
|
||||
},
|
||||
|
||||
addRandomChoice: function(initialChoice) {
|
||||
var isRandomSameType = RegExp(this.type).test(initialChoice),
|
||||
randomChoice = 'random-' + this.type + '-image';
|
||||
|
||||
this.add({
|
||||
header: {
|
||||
timestamp: 0,
|
||||
random: randomChoice,
|
||||
width: 245,
|
||||
height: 41
|
||||
},
|
||||
choice: randomChoice,
|
||||
random: true,
|
||||
selected: isRandomSameType
|
||||
});
|
||||
},
|
||||
|
||||
isRandomChoice: function(choice) {
|
||||
return (/^random-(uploaded|default)-image$/).test(choice);
|
||||
},
|
||||
|
||||
shouldHideTitle: function() {
|
||||
return this.size() < 2;
|
||||
},
|
||||
|
||||
setImage: function(model) {
|
||||
this.each(function(m) {
|
||||
m.set('selected', false);
|
||||
});
|
||||
|
||||
if (model) {
|
||||
model.set('selected', true);
|
||||
}
|
||||
},
|
||||
|
||||
removeImage: function() {
|
||||
this.each(function(m) {
|
||||
m.set('selected', false);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* wp.customize.HeaderTool.DefaultsList
|
||||
*
|
||||
* @constructor
|
||||
* @augments wp.customize.HeaderTool.ChoiceList
|
||||
* @augments Backbone.Collection
|
||||
*/
|
||||
api.HeaderTool.DefaultsList = api.HeaderTool.ChoiceList.extend({
|
||||
initialize: function() {
|
||||
this.type = 'default';
|
||||
this.data = _wpCustomizeHeader.defaults;
|
||||
api.HeaderTool.ChoiceList.prototype.initialize.apply(this);
|
||||
}
|
||||
});
|
||||
|
||||
})( jQuery, window.wp );
|
||||
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-models.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-models.min.js
vendored
Executable file
@@ -0,0 +1 @@
|
||||
!function(a,b){var c=b.customize;c.HeaderTool={},c.HeaderTool.ImageModel=Backbone.Model.extend({defaults:function(){return{header:{attachment_id:0,url:"",timestamp:_.now(),thumbnail_url:""},choice:"",selected:!1,random:!1}},initialize:function(){this.on("hide",this.hide,this)},hide:function(){this.set("choice",""),c("header_image").set("remove-header"),c("header_image_data").set("remove-header")},destroy:function(){var a=this.get("header"),d=c.HeaderTool.currentHeader.get("header").attachment_id;d&&a.attachment_id===d&&c.HeaderTool.currentHeader.trigger("hide"),b.ajax.post("custom-header-remove",{nonce:_wpCustomizeHeader.nonces.remove,wp_customize:"on",theme:c.settings.theme.stylesheet,attachment_id:a.attachment_id}),this.trigger("destroy",this,this.collection)},save:function(){this.get("random")?(c("header_image").set(this.get("header").random),c("header_image_data").set(this.get("header").random)):this.get("header").defaultName?(c("header_image").set(this.get("header").url),c("header_image_data").set(this.get("header").defaultName)):(c("header_image").set(this.get("header").url),c("header_image_data").set(this.get("header"))),c.HeaderTool.combinedList.trigger("control:setImage",this)},importImage:function(){var a=this.get("header");void 0!==a.attachment_id&&b.ajax.post("custom-header-add",{nonce:_wpCustomizeHeader.nonces.add,wp_customize:"on",theme:c.settings.theme.stylesheet,attachment_id:a.attachment_id})},shouldBeCropped:function(){return this.get("themeFlexWidth")===!0&&this.get("themeFlexHeight")===!0?!1:this.get("themeFlexWidth")===!0&&this.get("themeHeight")===this.get("imageHeight")?!1:this.get("themeFlexHeight")===!0&&this.get("themeWidth")===this.get("imageWidth")?!1:this.get("themeWidth")===this.get("imageWidth")&&this.get("themeHeight")===this.get("imageHeight")?!1:this.get("imageWidth")<=this.get("themeWidth")?!1:!0}}),c.HeaderTool.ChoiceList=Backbone.Collection.extend({model:c.HeaderTool.ImageModel,comparator:function(a){return-a.get("header").timestamp},initialize:function(){var a=c.HeaderTool.currentHeader.get("choice").replace(/^https?:\/\//,""),b=this.isRandomChoice(c.get().header_image);this.type||(this.type="uploaded"),"undefined"==typeof this.data&&(this.data=_wpCustomizeHeader.uploads),b&&(a=c.get().header_image),this.on("control:setImage",this.setImage,this),this.on("control:removeImage",this.removeImage,this),this.on("add",this.maybeAddRandomChoice,this),_.each(this.data,function(b,c){b.attachment_id||(b.defaultName=c),"undefined"==typeof b.timestamp&&(b.timestamp=0),this.add({header:b,choice:b.url.split("/").pop(),selected:a===b.url.replace(/^https?:\/\//,"")},{silent:!0})},this),this.size()>0&&this.addRandomChoice(a)},maybeAddRandomChoice:function(){1===this.size()&&this.addRandomChoice()},addRandomChoice:function(a){var b=RegExp(this.type).test(a),c="random-"+this.type+"-image";this.add({header:{timestamp:0,random:c,width:245,height:41},choice:c,random:!0,selected:b})},isRandomChoice:function(a){return/^random-(uploaded|default)-image$/.test(a)},shouldHideTitle:function(){return this.size()<2},setImage:function(a){this.each(function(a){a.set("selected",!1)}),a&&a.set("selected",!0)},removeImage:function(){this.each(function(a){a.set("selected",!1)})}}),c.HeaderTool.DefaultsList=c.HeaderTool.ChoiceList.extend({initialize:function(){this.type="default",this.data=_wpCustomizeHeader.defaults,c.HeaderTool.ChoiceList.prototype.initialize.apply(this)}})}(jQuery,window.wp);
|
||||
390
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-preview-nav-menus.js
Executable file
390
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-preview-nav-menus.js
Executable file
@@ -0,0 +1,390 @@
|
||||
/* global _wpCustomizePreviewNavMenusExports */
|
||||
wp.customize.navMenusPreview = wp.customize.MenusCustomizerPreview = ( function( $, _, wp, api ) {
|
||||
'use strict';
|
||||
|
||||
var self = {
|
||||
data: {
|
||||
navMenuInstanceArgs: {}
|
||||
}
|
||||
};
|
||||
if ( 'undefined' !== typeof _wpCustomizePreviewNavMenusExports ) {
|
||||
_.extend( self.data, _wpCustomizePreviewNavMenusExports );
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize nav menus preview.
|
||||
*/
|
||||
self.init = function() {
|
||||
var self = this;
|
||||
|
||||
if ( api.selectiveRefresh ) {
|
||||
// Listen for changes to settings related to nav menus.
|
||||
api.each( function( setting ) {
|
||||
self.bindSettingListener( setting );
|
||||
} );
|
||||
api.bind( 'add', function( setting ) {
|
||||
self.bindSettingListener( setting, { fire: true } );
|
||||
} );
|
||||
api.bind( 'remove', function( setting ) {
|
||||
self.unbindSettingListener( setting );
|
||||
} );
|
||||
|
||||
/*
|
||||
* Ensure that wp_nav_menu() instances nested inside of other partials
|
||||
* will be recognized as being present on the page.
|
||||
*/
|
||||
api.selectiveRefresh.bind( 'render-partials-response', function( response ) {
|
||||
if ( response.nav_menu_instance_args ) {
|
||||
_.extend( self.data.navMenuInstanceArgs, response.nav_menu_instance_args );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
api.preview.bind( 'active', function() {
|
||||
self.highlightControls();
|
||||
} );
|
||||
};
|
||||
|
||||
if ( api.selectiveRefresh ) {
|
||||
|
||||
/**
|
||||
* Partial representing an invocation of wp_nav_menu().
|
||||
*
|
||||
* @class
|
||||
* @augments wp.customize.selectiveRefresh.Partial
|
||||
* @since 4.5.0
|
||||
*/
|
||||
self.NavMenuInstancePartial = api.selectiveRefresh.Partial.extend({
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @param {string} id - Partial ID.
|
||||
* @param {Object} options
|
||||
* @param {Object} options.params
|
||||
* @param {Object} options.params.navMenuArgs
|
||||
* @param {string} options.params.navMenuArgs.args_hmac
|
||||
* @param {string} [options.params.navMenuArgs.theme_location]
|
||||
* @param {number} [options.params.navMenuArgs.menu]
|
||||
* @param {object} [options.constructingContainerContext]
|
||||
*/
|
||||
initialize: function( id, options ) {
|
||||
var partial = this, matches, argsHmac;
|
||||
matches = id.match( /^nav_menu_instance\[([0-9a-f]{32})]$/ );
|
||||
if ( ! matches ) {
|
||||
throw new Error( 'Illegal id for nav_menu_instance partial. The key corresponds with the args HMAC.' );
|
||||
}
|
||||
argsHmac = matches[1];
|
||||
|
||||
options = options || {};
|
||||
options.params = _.extend(
|
||||
{
|
||||
selector: '[data-customize-partial-id="' + id + '"]',
|
||||
navMenuArgs: options.constructingContainerContext || {},
|
||||
containerInclusive: true
|
||||
},
|
||||
options.params || {}
|
||||
);
|
||||
api.selectiveRefresh.Partial.prototype.initialize.call( partial, id, options );
|
||||
|
||||
if ( ! _.isObject( partial.params.navMenuArgs ) ) {
|
||||
throw new Error( 'Missing navMenuArgs' );
|
||||
}
|
||||
if ( partial.params.navMenuArgs.args_hmac !== argsHmac ) {
|
||||
throw new Error( 'args_hmac mismatch with id' );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Return whether the setting is related to this partial.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @param {wp.customize.Value|string} setting - Object or ID.
|
||||
* @param {number|object|false|null} newValue - New value, or null if the setting was just removed.
|
||||
* @param {number|object|false|null} oldValue - Old value, or null if the setting was just added.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isRelatedSetting: function( setting, newValue, oldValue ) {
|
||||
var partial = this, navMenuLocationSetting, navMenuId, isNavMenuItemSetting;
|
||||
if ( _.isString( setting ) ) {
|
||||
setting = api( setting );
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent nav_menu_item changes only containing type_label differences triggering a refresh.
|
||||
* These settings in the preview do not include type_label property, and so if one of these
|
||||
* nav_menu_item settings is dirty, after a refresh the nav menu instance would do a selective
|
||||
* refresh immediately because the setting from the pane would have the type_label whereas
|
||||
* the setting in the preview would not, thus triggering a change event. The following
|
||||
* condition short-circuits this unnecessary selective refresh and also prevents an infinite
|
||||
* loop in the case where a nav_menu_instance partial had done a fallback refresh.
|
||||
* @todo Nav menu item settings should not include a type_label property to begin with.
|
||||
*/
|
||||
isNavMenuItemSetting = /^nav_menu_item\[/.test( setting.id );
|
||||
if ( isNavMenuItemSetting && _.isObject( newValue ) && _.isObject( oldValue ) ) {
|
||||
delete newValue.type_label;
|
||||
delete oldValue.type_label;
|
||||
if ( _.isEqual( oldValue, newValue ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( partial.params.navMenuArgs.theme_location ) {
|
||||
if ( 'nav_menu_locations[' + partial.params.navMenuArgs.theme_location + ']' === setting.id ) {
|
||||
return true;
|
||||
}
|
||||
navMenuLocationSetting = api( 'nav_menu_locations[' + partial.params.navMenuArgs.theme_location + ']' );
|
||||
}
|
||||
|
||||
navMenuId = partial.params.navMenuArgs.menu;
|
||||
if ( ! navMenuId && navMenuLocationSetting ) {
|
||||
navMenuId = navMenuLocationSetting();
|
||||
}
|
||||
|
||||
if ( ! navMenuId ) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
( 'nav_menu[' + navMenuId + ']' === setting.id ) ||
|
||||
( isNavMenuItemSetting && (
|
||||
( newValue && newValue.nav_menu_term_id === navMenuId ) ||
|
||||
( oldValue && oldValue.nav_menu_term_id === navMenuId )
|
||||
) )
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Make sure that partial fallback behavior is invoked if there is no associated menu.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @returns {Promise}
|
||||
*/
|
||||
refresh: function() {
|
||||
var partial = this, menuId, deferred = $.Deferred();
|
||||
|
||||
// Make sure the fallback behavior is invoked when the partial is no longer associated with a menu.
|
||||
if ( _.isNumber( partial.params.navMenuArgs.menu ) ) {
|
||||
menuId = partial.params.navMenuArgs.menu;
|
||||
} else if ( partial.params.navMenuArgs.theme_location && api.has( 'nav_menu_locations[' + partial.params.navMenuArgs.theme_location + ']' ) ) {
|
||||
menuId = api( 'nav_menu_locations[' + partial.params.navMenuArgs.theme_location + ']' ).get();
|
||||
}
|
||||
if ( ! menuId ) {
|
||||
partial.fallback();
|
||||
deferred.reject();
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
return api.selectiveRefresh.Partial.prototype.refresh.call( partial );
|
||||
},
|
||||
|
||||
/**
|
||||
* Render content.
|
||||
*
|
||||
* @inheritdoc
|
||||
* @param {wp.customize.selectiveRefresh.Placement} placement
|
||||
*/
|
||||
renderContent: function( placement ) {
|
||||
var partial = this, previousContainer = placement.container;
|
||||
|
||||
// Do fallback behavior to refresh preview if menu is now empty.
|
||||
if ( '' === placement.addedContent ) {
|
||||
placement.partial.fallback();
|
||||
}
|
||||
|
||||
if ( api.selectiveRefresh.Partial.prototype.renderContent.call( partial, placement ) ) {
|
||||
|
||||
// Trigger deprecated event.
|
||||
$( document ).trigger( 'customize-preview-menu-refreshed', [ {
|
||||
instanceNumber: null, // @deprecated
|
||||
wpNavArgs: placement.context, // @deprecated
|
||||
wpNavMenuArgs: placement.context,
|
||||
oldContainer: previousContainer,
|
||||
newContainer: placement.container
|
||||
} ] );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
api.selectiveRefresh.partialConstructor.nav_menu_instance = self.NavMenuInstancePartial;
|
||||
|
||||
/**
|
||||
* Request full refresh if there are nav menu instances that lack partials which also match the supplied args.
|
||||
*
|
||||
* @param {object} navMenuInstanceArgs
|
||||
*/
|
||||
self.handleUnplacedNavMenuInstances = function( navMenuInstanceArgs ) {
|
||||
var unplacedNavMenuInstances;
|
||||
unplacedNavMenuInstances = _.filter( _.values( self.data.navMenuInstanceArgs ), function( args ) {
|
||||
return ! api.selectiveRefresh.partial.has( 'nav_menu_instance[' + args.args_hmac + ']' );
|
||||
} );
|
||||
if ( _.findWhere( unplacedNavMenuInstances, navMenuInstanceArgs ) ) {
|
||||
api.selectiveRefresh.requestFullRefresh();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add change listener for a nav_menu[], nav_menu_item[], or nav_menu_locations[] setting.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {wp.customize.Value} setting
|
||||
* @param {object} [options]
|
||||
* @param {boolean} options.fire Whether to invoke the callback after binding.
|
||||
* This is used when a dynamic setting is added.
|
||||
* @return {boolean} Whether the setting was bound.
|
||||
*/
|
||||
self.bindSettingListener = function( setting, options ) {
|
||||
var matches;
|
||||
options = options || {};
|
||||
|
||||
matches = setting.id.match( /^nav_menu\[(-?\d+)]$/ );
|
||||
if ( matches ) {
|
||||
setting._navMenuId = parseInt( matches[1], 10 );
|
||||
setting.bind( this.onChangeNavMenuSetting );
|
||||
if ( options.fire ) {
|
||||
this.onChangeNavMenuSetting.call( setting, setting(), false );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
matches = setting.id.match( /^nav_menu_item\[(-?\d+)]$/ );
|
||||
if ( matches ) {
|
||||
setting._navMenuItemId = parseInt( matches[1], 10 );
|
||||
setting.bind( this.onChangeNavMenuItemSetting );
|
||||
if ( options.fire ) {
|
||||
this.onChangeNavMenuItemSetting.call( setting, setting(), false );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
matches = setting.id.match( /^nav_menu_locations\[(.+?)]/ );
|
||||
if ( matches ) {
|
||||
setting._navMenuThemeLocation = matches[1];
|
||||
setting.bind( this.onChangeNavMenuLocationsSetting );
|
||||
if ( options.fire ) {
|
||||
this.onChangeNavMenuLocationsSetting.call( setting, setting(), false );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove change listeners for nav_menu[], nav_menu_item[], or nav_menu_locations[] setting.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {wp.customize.Value} setting
|
||||
*/
|
||||
self.unbindSettingListener = function( setting ) {
|
||||
setting.unbind( this.onChangeNavMenuSetting );
|
||||
setting.unbind( this.onChangeNavMenuItemSetting );
|
||||
setting.unbind( this.onChangeNavMenuLocationsSetting );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle change for nav_menu[] setting for nav menu instances lacking partials.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @this {wp.customize.Value}
|
||||
*/
|
||||
self.onChangeNavMenuSetting = function() {
|
||||
var setting = this;
|
||||
|
||||
self.handleUnplacedNavMenuInstances( {
|
||||
menu: setting._navMenuId
|
||||
} );
|
||||
|
||||
// Ensure all nav menu instances with a theme_location assigned to this menu are handled.
|
||||
api.each( function( otherSetting ) {
|
||||
if ( ! otherSetting._navMenuThemeLocation ) {
|
||||
return;
|
||||
}
|
||||
if ( setting._navMenuId === otherSetting() ) {
|
||||
self.handleUnplacedNavMenuInstances( {
|
||||
theme_location: otherSetting._navMenuThemeLocation
|
||||
} );
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle change for nav_menu_item[] setting for nav menu instances lacking partials.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {object} newItem New value for nav_menu_item[] setting.
|
||||
* @param {object} oldItem Old value for nav_menu_item[] setting.
|
||||
* @this {wp.customize.Value}
|
||||
*/
|
||||
self.onChangeNavMenuItemSetting = function( newItem, oldItem ) {
|
||||
var item = newItem || oldItem, navMenuSetting;
|
||||
navMenuSetting = api( 'nav_menu[' + String( item.nav_menu_term_id ) + ']' );
|
||||
if ( navMenuSetting ) {
|
||||
self.onChangeNavMenuSetting.call( navMenuSetting );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle change for nav_menu_locations[] setting for nav menu instances lacking partials.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @this {wp.customize.Value}
|
||||
*/
|
||||
self.onChangeNavMenuLocationsSetting = function() {
|
||||
var setting = this, hasNavMenuInstance;
|
||||
self.handleUnplacedNavMenuInstances( {
|
||||
theme_location: setting._navMenuThemeLocation
|
||||
} );
|
||||
|
||||
// If there are no wp_nav_menu() instances that refer to the theme location, do full refresh.
|
||||
hasNavMenuInstance = !! _.findWhere( _.values( self.data.navMenuInstanceArgs ), {
|
||||
theme_location: setting._navMenuThemeLocation
|
||||
} );
|
||||
if ( ! hasNavMenuInstance ) {
|
||||
api.selectiveRefresh.requestFullRefresh();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect nav menu items with their corresponding controls in the pane.
|
||||
*
|
||||
* Setup shift-click on nav menu items which are more granular than the nav menu partial itself.
|
||||
* Also this applies even if a nav menu is not partial-refreshable.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*/
|
||||
self.highlightControls = function() {
|
||||
var selector = '.menu-item';
|
||||
|
||||
// Focus on the menu item control when shift+clicking the menu item.
|
||||
$( document ).on( 'click', selector, function( e ) {
|
||||
var navMenuItemParts;
|
||||
if ( ! e.shiftKey ) {
|
||||
return;
|
||||
}
|
||||
|
||||
navMenuItemParts = $( this ).attr( 'class' ).match( /(?:^|\s)menu-item-(\d+)(?:\s|$)/ );
|
||||
if ( navMenuItemParts ) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation(); // Make sure a sub-nav menu item will get focused instead of parent items.
|
||||
api.preview.send( 'focus-nav-menu-item-control', parseInt( navMenuItemParts[1], 10 ) );
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
api.bind( 'preview-ready', function() {
|
||||
self.init();
|
||||
} );
|
||||
|
||||
return self;
|
||||
|
||||
}( jQuery, _, wp, wp.customize ) );
|
||||
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-preview-nav-menus.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-preview-nav-menus.min.js
vendored
Executable file
@@ -0,0 +1 @@
|
||||
wp.customize.navMenusPreview=wp.customize.MenusCustomizerPreview=function(a,b,c,d){"use strict";var e={data:{navMenuInstanceArgs:{}}};return"undefined"!=typeof _wpCustomizePreviewNavMenusExports&&b.extend(e.data,_wpCustomizePreviewNavMenusExports),e.init=function(){var a=this;d.selectiveRefresh&&(d.each(function(b){a.bindSettingListener(b)}),d.bind("add",function(b){a.bindSettingListener(b,{fire:!0})}),d.bind("remove",function(b){a.unbindSettingListener(b)}),d.selectiveRefresh.bind("render-partials-response",function(c){c.nav_menu_instance_args&&b.extend(a.data.navMenuInstanceArgs,c.nav_menu_instance_args)})),d.preview.bind("active",function(){a.highlightControls()})},d.selectiveRefresh&&(e.NavMenuInstancePartial=d.selectiveRefresh.Partial.extend({initialize:function(a,c){var e,f,g=this;if(e=a.match(/^nav_menu_instance\[([0-9a-f]{32})]$/),!e)throw new Error("Illegal id for nav_menu_instance partial. The key corresponds with the args HMAC.");if(f=e[1],c=c||{},c.params=b.extend({selector:'[data-customize-partial-id="'+a+'"]',navMenuArgs:c.constructingContainerContext||{},containerInclusive:!0},c.params||{}),d.selectiveRefresh.Partial.prototype.initialize.call(g,a,c),!b.isObject(g.params.navMenuArgs))throw new Error("Missing navMenuArgs");if(g.params.navMenuArgs.args_hmac!==f)throw new Error("args_hmac mismatch with id")},isRelatedSetting:function(a,c,e){var f,g,h,i=this;if(b.isString(a)&&(a=d(a)),h=/^nav_menu_item\[/.test(a.id),h&&b.isObject(c)&&b.isObject(e)&&(delete c.type_label,delete e.type_label,b.isEqual(e,c)))return!1;if(i.params.navMenuArgs.theme_location){if("nav_menu_locations["+i.params.navMenuArgs.theme_location+"]"===a.id)return!0;f=d("nav_menu_locations["+i.params.navMenuArgs.theme_location+"]")}return g=i.params.navMenuArgs.menu,!g&&f&&(g=f()),g?"nav_menu["+g+"]"===a.id||h&&(c&&c.nav_menu_term_id===g||e&&e.nav_menu_term_id===g):!1},refresh:function(){var c,e=this,f=a.Deferred();return b.isNumber(e.params.navMenuArgs.menu)?c=e.params.navMenuArgs.menu:e.params.navMenuArgs.theme_location&&d.has("nav_menu_locations["+e.params.navMenuArgs.theme_location+"]")&&(c=d("nav_menu_locations["+e.params.navMenuArgs.theme_location+"]").get()),c?d.selectiveRefresh.Partial.prototype.refresh.call(e):(e.fallback(),f.reject(),f.promise())},renderContent:function(b){var c=this,e=b.container;""===b.addedContent&&b.partial.fallback(),d.selectiveRefresh.Partial.prototype.renderContent.call(c,b)&&a(document).trigger("customize-preview-menu-refreshed",[{instanceNumber:null,wpNavArgs:b.context,wpNavMenuArgs:b.context,oldContainer:e,newContainer:b.container}])}}),d.selectiveRefresh.partialConstructor.nav_menu_instance=e.NavMenuInstancePartial,e.handleUnplacedNavMenuInstances=function(a){var c;return c=b.filter(b.values(e.data.navMenuInstanceArgs),function(a){return!d.selectiveRefresh.partial.has("nav_menu_instance["+a.args_hmac+"]")}),b.findWhere(c,a)?(d.selectiveRefresh.requestFullRefresh(),!0):!1},e.bindSettingListener=function(a,b){var c;return b=b||{},(c=a.id.match(/^nav_menu\[(-?\d+)]$/))?(a._navMenuId=parseInt(c[1],10),a.bind(this.onChangeNavMenuSetting),b.fire&&this.onChangeNavMenuSetting.call(a,a(),!1),!0):(c=a.id.match(/^nav_menu_item\[(-?\d+)]$/))?(a._navMenuItemId=parseInt(c[1],10),a.bind(this.onChangeNavMenuItemSetting),b.fire&&this.onChangeNavMenuItemSetting.call(a,a(),!1),!0):(c=a.id.match(/^nav_menu_locations\[(.+?)]/),c?(a._navMenuThemeLocation=c[1],a.bind(this.onChangeNavMenuLocationsSetting),b.fire&&this.onChangeNavMenuLocationsSetting.call(a,a(),!1),!0):!1)},e.unbindSettingListener=function(a){a.unbind(this.onChangeNavMenuSetting),a.unbind(this.onChangeNavMenuItemSetting),a.unbind(this.onChangeNavMenuLocationsSetting)},e.onChangeNavMenuSetting=function(){var a=this;e.handleUnplacedNavMenuInstances({menu:a._navMenuId}),d.each(function(b){b._navMenuThemeLocation&&a._navMenuId===b()&&e.handleUnplacedNavMenuInstances({theme_location:b._navMenuThemeLocation})})},e.onChangeNavMenuItemSetting=function(a,b){var c,f=a||b;c=d("nav_menu["+String(f.nav_menu_term_id)+"]"),c&&e.onChangeNavMenuSetting.call(c)},e.onChangeNavMenuLocationsSetting=function(){var a,c=this;e.handleUnplacedNavMenuInstances({theme_location:c._navMenuThemeLocation}),a=!!b.findWhere(b.values(e.data.navMenuInstanceArgs),{theme_location:c._navMenuThemeLocation}),a||d.selectiveRefresh.requestFullRefresh()}),e.highlightControls=function(){var b=".menu-item";a(document).on("click",b,function(b){var c;b.shiftKey&&(c=a(this).attr("class").match(/(?:^|\s)menu-item-(\d+)(?:\s|$)/),c&&(b.preventDefault(),b.stopPropagation(),d.preview.send("focus-nav-menu-item-control",parseInt(c[1],10))))})},d.bind("preview-ready",function(){e.init()}),e}(jQuery,_,wp,wp.customize);
|
||||
661
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-preview-widgets.js
Executable file
661
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-preview-widgets.js
Executable file
@@ -0,0 +1,661 @@
|
||||
/* global _wpWidgetCustomizerPreviewSettings */
|
||||
wp.customize.widgetsPreview = wp.customize.WidgetCustomizerPreview = (function( $, _, wp, api ) {
|
||||
|
||||
var self;
|
||||
|
||||
self = {
|
||||
renderedSidebars: {},
|
||||
renderedWidgets: {},
|
||||
registeredSidebars: [],
|
||||
registeredWidgets: {},
|
||||
widgetSelectors: [],
|
||||
preview: null,
|
||||
l10n: {
|
||||
widgetTooltip: ''
|
||||
},
|
||||
selectiveRefreshableWidgets: {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Init widgets preview.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*/
|
||||
self.init = function() {
|
||||
var self = this;
|
||||
|
||||
self.preview = api.preview;
|
||||
if ( ! _.isEmpty( self.selectiveRefreshableWidgets ) ) {
|
||||
self.addPartials();
|
||||
}
|
||||
|
||||
self.buildWidgetSelectors();
|
||||
self.highlightControls();
|
||||
|
||||
self.preview.bind( 'highlight-widget', self.highlightWidget );
|
||||
|
||||
api.preview.bind( 'active', function() {
|
||||
self.highlightControls();
|
||||
} );
|
||||
};
|
||||
|
||||
/**
|
||||
* Partial representing a widget instance.
|
||||
*
|
||||
* @class
|
||||
* @augments wp.customize.selectiveRefresh.Partial
|
||||
* @since 4.5.0
|
||||
*/
|
||||
self.WidgetPartial = api.selectiveRefresh.Partial.extend({
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @param {string} id - Partial ID.
|
||||
* @param {Object} options
|
||||
* @param {Object} options.params
|
||||
*/
|
||||
initialize: function( id, options ) {
|
||||
var partial = this, matches;
|
||||
matches = id.match( /^widget\[(.+)]$/ );
|
||||
if ( ! matches ) {
|
||||
throw new Error( 'Illegal id for widget partial.' );
|
||||
}
|
||||
|
||||
partial.widgetId = matches[1];
|
||||
partial.widgetIdParts = self.parseWidgetId( partial.widgetId );
|
||||
options = options || {};
|
||||
options.params = _.extend(
|
||||
{
|
||||
settings: [ self.getWidgetSettingId( partial.widgetId ) ],
|
||||
containerInclusive: true
|
||||
},
|
||||
options.params || {}
|
||||
);
|
||||
|
||||
api.selectiveRefresh.Partial.prototype.initialize.call( partial, id, options );
|
||||
},
|
||||
|
||||
/**
|
||||
* Refresh widget partial.
|
||||
*
|
||||
* @returns {Promise}
|
||||
*/
|
||||
refresh: function() {
|
||||
var partial = this, refreshDeferred;
|
||||
if ( ! self.selectiveRefreshableWidgets[ partial.widgetIdParts.idBase ] ) {
|
||||
refreshDeferred = $.Deferred();
|
||||
refreshDeferred.reject();
|
||||
partial.fallback();
|
||||
return refreshDeferred.promise();
|
||||
} else {
|
||||
return api.selectiveRefresh.Partial.prototype.refresh.call( partial );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Send widget-updated message to parent so spinner will get removed from widget control.
|
||||
*
|
||||
* @inheritdoc
|
||||
* @param {wp.customize.selectiveRefresh.Placement} placement
|
||||
*/
|
||||
renderContent: function( placement ) {
|
||||
var partial = this;
|
||||
if ( api.selectiveRefresh.Partial.prototype.renderContent.call( partial, placement ) ) {
|
||||
api.preview.send( 'widget-updated', partial.widgetId );
|
||||
api.selectiveRefresh.trigger( 'widget-updated', partial );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Partial representing a widget area.
|
||||
*
|
||||
* @class
|
||||
* @augments wp.customize.selectiveRefresh.Partial
|
||||
* @since 4.5.0
|
||||
*/
|
||||
self.SidebarPartial = api.selectiveRefresh.Partial.extend({
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @param {string} id - Partial ID.
|
||||
* @param {Object} options
|
||||
* @param {Object} options.params
|
||||
*/
|
||||
initialize: function( id, options ) {
|
||||
var partial = this, matches;
|
||||
matches = id.match( /^sidebar\[(.+)]$/ );
|
||||
if ( ! matches ) {
|
||||
throw new Error( 'Illegal id for sidebar partial.' );
|
||||
}
|
||||
partial.sidebarId = matches[1];
|
||||
|
||||
options = options || {};
|
||||
options.params = _.extend(
|
||||
{
|
||||
settings: [ 'sidebars_widgets[' + partial.sidebarId + ']' ]
|
||||
},
|
||||
options.params || {}
|
||||
);
|
||||
|
||||
api.selectiveRefresh.Partial.prototype.initialize.call( partial, id, options );
|
||||
|
||||
if ( ! partial.params.sidebarArgs ) {
|
||||
throw new Error( 'The sidebarArgs param was not provided.' );
|
||||
}
|
||||
if ( partial.params.settings.length > 1 ) {
|
||||
throw new Error( 'Expected SidebarPartial to only have one associated setting' );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Set up the partial.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*/
|
||||
ready: function() {
|
||||
var sidebarPartial = this;
|
||||
|
||||
// Watch for changes to the sidebar_widgets setting.
|
||||
_.each( sidebarPartial.settings(), function( settingId ) {
|
||||
api( settingId ).bind( _.bind( sidebarPartial.handleSettingChange, sidebarPartial ) );
|
||||
} );
|
||||
|
||||
// Trigger an event for this sidebar being updated whenever a widget inside is rendered.
|
||||
api.selectiveRefresh.bind( 'partial-content-rendered', function( placement ) {
|
||||
var isAssignedWidgetPartial = (
|
||||
placement.partial.extended( self.WidgetPartial ) &&
|
||||
( -1 !== _.indexOf( sidebarPartial.getWidgetIds(), placement.partial.widgetId ) )
|
||||
);
|
||||
if ( isAssignedWidgetPartial ) {
|
||||
api.selectiveRefresh.trigger( 'sidebar-updated', sidebarPartial );
|
||||
}
|
||||
} );
|
||||
|
||||
// Make sure that a widget partial has a container in the DOM prior to a refresh.
|
||||
api.bind( 'change', function( widgetSetting ) {
|
||||
var widgetId, parsedId;
|
||||
parsedId = self.parseWidgetSettingId( widgetSetting.id );
|
||||
if ( ! parsedId ) {
|
||||
return;
|
||||
}
|
||||
widgetId = parsedId.idBase;
|
||||
if ( parsedId.number ) {
|
||||
widgetId += '-' + String( parsedId.number );
|
||||
}
|
||||
if ( -1 !== _.indexOf( sidebarPartial.getWidgetIds(), widgetId ) ) {
|
||||
sidebarPartial.ensureWidgetPlacementContainers( widgetId );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the before/after boundary nodes for all instances of this sidebar (usually one).
|
||||
*
|
||||
* Note that TreeWalker is not implemented in IE8.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @returns {Array.<{before: Comment, after: Comment, instanceNumber: number}>}
|
||||
*/
|
||||
findDynamicSidebarBoundaryNodes: function() {
|
||||
var partial = this, regExp, boundaryNodes = {}, recursiveCommentTraversal;
|
||||
regExp = /^(dynamic_sidebar_before|dynamic_sidebar_after):(.+):(\d+)$/;
|
||||
recursiveCommentTraversal = function( childNodes ) {
|
||||
_.each( childNodes, function( node ) {
|
||||
var matches;
|
||||
if ( 8 === node.nodeType ) {
|
||||
matches = node.nodeValue.match( regExp );
|
||||
if ( ! matches || matches[2] !== partial.sidebarId ) {
|
||||
return;
|
||||
}
|
||||
if ( _.isUndefined( boundaryNodes[ matches[3] ] ) ) {
|
||||
boundaryNodes[ matches[3] ] = {
|
||||
before: null,
|
||||
after: null,
|
||||
instanceNumber: parseInt( matches[3], 10 )
|
||||
};
|
||||
}
|
||||
if ( 'dynamic_sidebar_before' === matches[1] ) {
|
||||
boundaryNodes[ matches[3] ].before = node;
|
||||
} else {
|
||||
boundaryNodes[ matches[3] ].after = node;
|
||||
}
|
||||
} else if ( 1 === node.nodeType ) {
|
||||
recursiveCommentTraversal( node.childNodes );
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
recursiveCommentTraversal( document.body.childNodes );
|
||||
return _.values( boundaryNodes );
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the placements for this partial.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @returns {Array}
|
||||
*/
|
||||
placements: function() {
|
||||
var partial = this;
|
||||
return _.map( partial.findDynamicSidebarBoundaryNodes(), function( boundaryNodes ) {
|
||||
return new api.selectiveRefresh.Placement( {
|
||||
partial: partial,
|
||||
container: null,
|
||||
startNode: boundaryNodes.before,
|
||||
endNode: boundaryNodes.after,
|
||||
context: {
|
||||
instanceNumber: boundaryNodes.instanceNumber
|
||||
}
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the list of widget IDs associated with this widget area.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @returns {Array}
|
||||
*/
|
||||
getWidgetIds: function() {
|
||||
var sidebarPartial = this, settingId, widgetIds;
|
||||
settingId = sidebarPartial.settings()[0];
|
||||
if ( ! settingId ) {
|
||||
throw new Error( 'Missing associated setting.' );
|
||||
}
|
||||
if ( ! api.has( settingId ) ) {
|
||||
throw new Error( 'Setting does not exist.' );
|
||||
}
|
||||
widgetIds = api( settingId ).get();
|
||||
if ( ! _.isArray( widgetIds ) ) {
|
||||
throw new Error( 'Expected setting to be array of widget IDs' );
|
||||
}
|
||||
return widgetIds.slice( 0 );
|
||||
},
|
||||
|
||||
/**
|
||||
* Reflow widgets in the sidebar, ensuring they have the proper position in the DOM.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @return {Array.<wp.customize.selectiveRefresh.Placement>} List of placements that were reflowed.
|
||||
*/
|
||||
reflowWidgets: function() {
|
||||
var sidebarPartial = this, sidebarPlacements, widgetIds, widgetPartials, sortedSidebarContainers = [];
|
||||
widgetIds = sidebarPartial.getWidgetIds();
|
||||
sidebarPlacements = sidebarPartial.placements();
|
||||
|
||||
widgetPartials = {};
|
||||
_.each( widgetIds, function( widgetId ) {
|
||||
var widgetPartial = api.selectiveRefresh.partial( 'widget[' + widgetId + ']' );
|
||||
if ( widgetPartial ) {
|
||||
widgetPartials[ widgetId ] = widgetPartial;
|
||||
}
|
||||
} );
|
||||
|
||||
_.each( sidebarPlacements, function( sidebarPlacement ) {
|
||||
var sidebarWidgets = [], needsSort = false, thisPosition, lastPosition = -1;
|
||||
|
||||
// Gather list of widget partial containers in this sidebar, and determine if a sort is needed.
|
||||
_.each( widgetPartials, function( widgetPartial ) {
|
||||
_.each( widgetPartial.placements(), function( widgetPlacement ) {
|
||||
|
||||
if ( sidebarPlacement.context.instanceNumber === widgetPlacement.context.sidebar_instance_number ) {
|
||||
thisPosition = widgetPlacement.container.index();
|
||||
sidebarWidgets.push( {
|
||||
partial: widgetPartial,
|
||||
placement: widgetPlacement,
|
||||
position: thisPosition
|
||||
} );
|
||||
if ( thisPosition < lastPosition ) {
|
||||
needsSort = true;
|
||||
}
|
||||
lastPosition = thisPosition;
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
if ( needsSort ) {
|
||||
_.each( sidebarWidgets, function( sidebarWidget ) {
|
||||
sidebarPlacement.endNode.parentNode.insertBefore(
|
||||
sidebarWidget.placement.container[0],
|
||||
sidebarPlacement.endNode
|
||||
);
|
||||
|
||||
// @todo Rename partial-placement-moved?
|
||||
api.selectiveRefresh.trigger( 'partial-content-moved', sidebarWidget.placement );
|
||||
} );
|
||||
|
||||
sortedSidebarContainers.push( sidebarPlacement );
|
||||
}
|
||||
} );
|
||||
|
||||
if ( sortedSidebarContainers.length > 0 ) {
|
||||
api.selectiveRefresh.trigger( 'sidebar-updated', sidebarPartial );
|
||||
}
|
||||
|
||||
return sortedSidebarContainers;
|
||||
},
|
||||
|
||||
/**
|
||||
* Make sure there is a widget instance container in this sidebar for the given widget ID.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {string} widgetId
|
||||
* @returns {wp.customize.selectiveRefresh.Partial} Widget instance partial.
|
||||
*/
|
||||
ensureWidgetPlacementContainers: function( widgetId ) {
|
||||
var sidebarPartial = this, widgetPartial, wasInserted = false, partialId = 'widget[' + widgetId + ']';
|
||||
widgetPartial = api.selectiveRefresh.partial( partialId );
|
||||
if ( ! widgetPartial ) {
|
||||
widgetPartial = new self.WidgetPartial( partialId, {
|
||||
params: {}
|
||||
} );
|
||||
api.selectiveRefresh.partial.add( widgetPartial.id, widgetPartial );
|
||||
}
|
||||
|
||||
// Make sure that there is a container element for the widget in the sidebar, if at least a placeholder.
|
||||
_.each( sidebarPartial.placements(), function( sidebarPlacement ) {
|
||||
var foundWidgetPlacement, widgetContainerElement;
|
||||
|
||||
foundWidgetPlacement = _.find( widgetPartial.placements(), function( widgetPlacement ) {
|
||||
return ( widgetPlacement.context.sidebar_instance_number === sidebarPlacement.context.instanceNumber );
|
||||
} );
|
||||
if ( foundWidgetPlacement ) {
|
||||
return;
|
||||
}
|
||||
|
||||
widgetContainerElement = $(
|
||||
sidebarPartial.params.sidebarArgs.before_widget.replace( '%1$s', widgetId ).replace( '%2$s', 'widget' ) +
|
||||
sidebarPartial.params.sidebarArgs.after_widget
|
||||
);
|
||||
|
||||
widgetContainerElement.attr( 'data-customize-partial-id', widgetPartial.id );
|
||||
widgetContainerElement.attr( 'data-customize-partial-type', 'widget' );
|
||||
widgetContainerElement.attr( 'data-customize-widget-id', widgetId );
|
||||
|
||||
/*
|
||||
* Make sure the widget container element has the customize-container context data.
|
||||
* The sidebar_instance_number is used to disambiguate multiple instances of the
|
||||
* same sidebar are rendered onto the template, and so the same widget is embedded
|
||||
* multiple times.
|
||||
*/
|
||||
widgetContainerElement.data( 'customize-partial-placement-context', {
|
||||
'sidebar_id': sidebarPartial.sidebarId,
|
||||
'sidebar_instance_number': sidebarPlacement.context.instanceNumber
|
||||
} );
|
||||
|
||||
sidebarPlacement.endNode.parentNode.insertBefore( widgetContainerElement[0], sidebarPlacement.endNode );
|
||||
wasInserted = true;
|
||||
} );
|
||||
|
||||
if ( wasInserted ) {
|
||||
sidebarPartial.reflowWidgets();
|
||||
}
|
||||
|
||||
return widgetPartial;
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle change to the sidebars_widgets[] setting.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {Array} newWidgetIds New widget ids.
|
||||
* @param {Array} oldWidgetIds Old widget ids.
|
||||
*/
|
||||
handleSettingChange: function( newWidgetIds, oldWidgetIds ) {
|
||||
var sidebarPartial = this, needsRefresh, widgetsRemoved, widgetsAdded, addedWidgetPartials = [];
|
||||
|
||||
needsRefresh = (
|
||||
( oldWidgetIds.length > 0 && 0 === newWidgetIds.length ) ||
|
||||
( newWidgetIds.length > 0 && 0 === oldWidgetIds.length )
|
||||
);
|
||||
if ( needsRefresh ) {
|
||||
sidebarPartial.fallback();
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle removal of widgets.
|
||||
widgetsRemoved = _.difference( oldWidgetIds, newWidgetIds );
|
||||
_.each( widgetsRemoved, function( removedWidgetId ) {
|
||||
var widgetPartial = api.selectiveRefresh.partial( 'widget[' + removedWidgetId + ']' );
|
||||
if ( widgetPartial ) {
|
||||
_.each( widgetPartial.placements(), function( placement ) {
|
||||
var isRemoved = (
|
||||
placement.context.sidebar_id === sidebarPartial.sidebarId ||
|
||||
( placement.context.sidebar_args && placement.context.sidebar_args.id === sidebarPartial.sidebarId )
|
||||
);
|
||||
if ( isRemoved ) {
|
||||
placement.container.remove();
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
// Handle insertion of widgets.
|
||||
widgetsAdded = _.difference( newWidgetIds, oldWidgetIds );
|
||||
_.each( widgetsAdded, function( addedWidgetId ) {
|
||||
var widgetPartial = sidebarPartial.ensureWidgetPlacementContainers( addedWidgetId );
|
||||
addedWidgetPartials.push( widgetPartial );
|
||||
} );
|
||||
|
||||
_.each( addedWidgetPartials, function( widgetPartial ) {
|
||||
widgetPartial.refresh();
|
||||
} );
|
||||
|
||||
api.selectiveRefresh.trigger( 'sidebar-updated', sidebarPartial );
|
||||
},
|
||||
|
||||
/**
|
||||
* Note that the meat is handled in handleSettingChange because it has the context of which widgets were removed.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*/
|
||||
refresh: function() {
|
||||
var partial = this, deferred = $.Deferred();
|
||||
|
||||
deferred.fail( function() {
|
||||
partial.fallback();
|
||||
} );
|
||||
|
||||
if ( 0 === partial.placements().length ) {
|
||||
deferred.reject();
|
||||
} else {
|
||||
_.each( partial.reflowWidgets(), function( sidebarPlacement ) {
|
||||
api.selectiveRefresh.trigger( 'partial-content-rendered', sidebarPlacement );
|
||||
} );
|
||||
deferred.resolve();
|
||||
}
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
});
|
||||
|
||||
api.selectiveRefresh.partialConstructor.sidebar = self.SidebarPartial;
|
||||
api.selectiveRefresh.partialConstructor.widget = self.WidgetPartial;
|
||||
|
||||
/**
|
||||
* Add partials for the registered widget areas (sidebars).
|
||||
*
|
||||
* @since 4.5.0
|
||||
*/
|
||||
self.addPartials = function() {
|
||||
_.each( self.registeredSidebars, function( registeredSidebar ) {
|
||||
var partial, partialId = 'sidebar[' + registeredSidebar.id + ']';
|
||||
partial = api.selectiveRefresh.partial( partialId );
|
||||
if ( ! partial ) {
|
||||
partial = new self.SidebarPartial( partialId, {
|
||||
params: {
|
||||
sidebarArgs: registeredSidebar
|
||||
}
|
||||
} );
|
||||
api.selectiveRefresh.partial.add( partial.id, partial );
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate the selector for the sidebar's widgets based on the registered sidebar's info.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
self.buildWidgetSelectors = function() {
|
||||
var self = this;
|
||||
|
||||
$.each( self.registeredSidebars, function( i, sidebar ) {
|
||||
var widgetTpl = [
|
||||
sidebar.before_widget.replace( '%1$s', '' ).replace( '%2$s', '' ),
|
||||
sidebar.before_title,
|
||||
sidebar.after_title,
|
||||
sidebar.after_widget
|
||||
].join( '' ),
|
||||
emptyWidget,
|
||||
widgetSelector,
|
||||
widgetClasses;
|
||||
|
||||
emptyWidget = $( widgetTpl );
|
||||
widgetSelector = emptyWidget.prop( 'tagName' );
|
||||
widgetClasses = emptyWidget.prop( 'className' );
|
||||
|
||||
// Prevent a rare case when before_widget, before_title, after_title and after_widget is empty.
|
||||
if ( ! widgetClasses ) {
|
||||
return;
|
||||
}
|
||||
|
||||
widgetClasses = widgetClasses.replace( /^\s+|\s+$/g, '' );
|
||||
|
||||
if ( widgetClasses ) {
|
||||
widgetSelector += '.' + widgetClasses.split( /\s+/ ).join( '.' );
|
||||
}
|
||||
self.widgetSelectors.push( widgetSelector );
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Highlight the widget on widget updates or widget control mouse overs.
|
||||
*
|
||||
* @since 3.9.0
|
||||
* @param {string} widgetId ID of the widget.
|
||||
*/
|
||||
self.highlightWidget = function( widgetId ) {
|
||||
var $body = $( document.body ),
|
||||
$widget = $( '#' + widgetId );
|
||||
|
||||
$body.find( '.widget-customizer-highlighted-widget' ).removeClass( 'widget-customizer-highlighted-widget' );
|
||||
|
||||
$widget.addClass( 'widget-customizer-highlighted-widget' );
|
||||
setTimeout( function() {
|
||||
$widget.removeClass( 'widget-customizer-highlighted-widget' );
|
||||
}, 500 );
|
||||
};
|
||||
|
||||
/**
|
||||
* Show a title and highlight widgets on hover. On shift+clicking
|
||||
* focus the widget control.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
self.highlightControls = function() {
|
||||
var self = this,
|
||||
selector = this.widgetSelectors.join( ',' );
|
||||
|
||||
$( selector ).attr( 'title', this.l10n.widgetTooltip );
|
||||
|
||||
$( document ).on( 'mouseenter', selector, function() {
|
||||
self.preview.send( 'highlight-widget-control', $( this ).prop( 'id' ) );
|
||||
});
|
||||
|
||||
// Open expand the widget control when shift+clicking the widget element
|
||||
$( document ).on( 'click', selector, function( e ) {
|
||||
if ( ! e.shiftKey ) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
|
||||
self.preview.send( 'focus-widget-control', $( this ).prop( 'id' ) );
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse a widget ID.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {string} widgetId Widget ID.
|
||||
* @returns {{idBase: string, number: number|null}}
|
||||
*/
|
||||
self.parseWidgetId = function( widgetId ) {
|
||||
var matches, parsed = {
|
||||
idBase: '',
|
||||
number: null
|
||||
};
|
||||
|
||||
matches = widgetId.match( /^(.+)-(\d+)$/ );
|
||||
if ( matches ) {
|
||||
parsed.idBase = matches[1];
|
||||
parsed.number = parseInt( matches[2], 10 );
|
||||
} else {
|
||||
parsed.idBase = widgetId; // Likely an old single widget.
|
||||
}
|
||||
|
||||
return parsed;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse a widget setting ID.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {string} settingId Widget setting ID.
|
||||
* @returns {{idBase: string, number: number|null}|null}
|
||||
*/
|
||||
self.parseWidgetSettingId = function( settingId ) {
|
||||
var matches, parsed = {
|
||||
idBase: '',
|
||||
number: null
|
||||
};
|
||||
|
||||
matches = settingId.match( /^widget_([^\[]+?)(?:\[(\d+)])?$/ );
|
||||
if ( ! matches ) {
|
||||
return null;
|
||||
}
|
||||
parsed.idBase = matches[1];
|
||||
if ( matches[2] ) {
|
||||
parsed.number = parseInt( matches[2], 10 );
|
||||
}
|
||||
return parsed;
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert a widget ID into a Customizer setting ID.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {string} widgetId Widget ID.
|
||||
* @returns {string} settingId Setting ID.
|
||||
*/
|
||||
self.getWidgetSettingId = function( widgetId ) {
|
||||
var parsed = this.parseWidgetId( widgetId ), settingId;
|
||||
|
||||
settingId = 'widget_' + parsed.idBase;
|
||||
if ( parsed.number ) {
|
||||
settingId += '[' + String( parsed.number ) + ']';
|
||||
}
|
||||
|
||||
return settingId;
|
||||
};
|
||||
|
||||
api.bind( 'preview-ready', function() {
|
||||
$.extend( self, _wpWidgetCustomizerPreviewSettings );
|
||||
self.init();
|
||||
});
|
||||
|
||||
return self;
|
||||
})( jQuery, _, wp, wp.customize );
|
||||
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-preview-widgets.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-preview-widgets.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
243
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-preview.js
Executable file
243
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-preview.js
Executable file
@@ -0,0 +1,243 @@
|
||||
/*
|
||||
* Script run inside a Customizer preview frame.
|
||||
*/
|
||||
(function( exports, $ ){
|
||||
var api = wp.customize,
|
||||
debounce;
|
||||
|
||||
/**
|
||||
* Returns a debounced version of the function.
|
||||
*
|
||||
* @todo Require Underscore.js for this file and retire this.
|
||||
*/
|
||||
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 );
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @augments wp.customize.Messenger
|
||||
* @augments wp.customize.Class
|
||||
* @mixes wp.customize.Events
|
||||
*/
|
||||
api.Preview = api.Messenger.extend({
|
||||
/**
|
||||
* @param {object} params - Parameters to configure the messenger.
|
||||
* @param {object} options - Extend any instance parameter or method with this object.
|
||||
*/
|
||||
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 ) {
|
||||
var link, isInternalJumpLink;
|
||||
link = $( this );
|
||||
isInternalJumpLink = ( '#' === link.attr( 'href' ).substr( 0, 1 ) );
|
||||
event.preventDefault();
|
||||
|
||||
if ( isInternalJumpLink && '#' !== link.attr( 'href' ) ) {
|
||||
$( link.attr( 'href' ) ).each( function() {
|
||||
this.scrollIntoView();
|
||||
} );
|
||||
}
|
||||
|
||||
/*
|
||||
* Note the shift key is checked so shift+click on widgets or
|
||||
* nav menu items can just result on focusing on the corresponding
|
||||
* control instead of also navigating to the URL linked to.
|
||||
*/
|
||||
if ( event.shiftKey || isInternalJumpLink ) {
|
||||
return;
|
||||
}
|
||||
self.send( 'scroll', 0 );
|
||||
self.send( 'url', link.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() {
|
||||
var bg, setValue;
|
||||
|
||||
api.settings = window._wpCustomizeSettings;
|
||||
if ( ! api.settings ) {
|
||||
return;
|
||||
}
|
||||
|
||||
api.preview = new api.Preview({
|
||||
url: window.location.href,
|
||||
channel: api.settings.channel
|
||||
});
|
||||
|
||||
/**
|
||||
* Create/update a setting value.
|
||||
*
|
||||
* @param {string} id - Setting ID.
|
||||
* @param {*} value - Setting value.
|
||||
* @param {boolean} [createDirty] - Whether to create a setting as dirty. Defaults to false.
|
||||
*/
|
||||
setValue = function( id, value, createDirty ) {
|
||||
var setting = api( id );
|
||||
if ( setting ) {
|
||||
setting.set( value );
|
||||
} else {
|
||||
createDirty = createDirty || false;
|
||||
setting = api.create( id, value, {
|
||||
id: id
|
||||
} );
|
||||
|
||||
// Mark dynamically-created settings as dirty so they will get posted.
|
||||
if ( createDirty ) {
|
||||
setting._dirty = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
api.preview.bind( 'settings', function( values ) {
|
||||
$.each( values, setValue );
|
||||
});
|
||||
|
||||
api.preview.trigger( 'settings', api.settings.values );
|
||||
|
||||
$.each( api.settings._dirty, function( i, id ) {
|
||||
var setting = api( id );
|
||||
if ( setting ) {
|
||||
setting._dirty = true;
|
||||
}
|
||||
} );
|
||||
|
||||
api.preview.bind( 'setting', function( args ) {
|
||||
var createDirty = true;
|
||||
setValue.apply( null, args.concat( createDirty ) );
|
||||
});
|
||||
|
||||
api.preview.bind( 'sync', function( events ) {
|
||||
$.each( events, function( event, args ) {
|
||||
api.preview.trigger( event, args );
|
||||
});
|
||||
api.preview.send( 'synced' );
|
||||
});
|
||||
|
||||
api.preview.bind( 'active', function() {
|
||||
api.preview.send( 'nonce', api.settings.nonce );
|
||||
|
||||
api.preview.send( 'documentTitle', document.title );
|
||||
});
|
||||
|
||||
api.preview.bind( 'saved', function( response ) {
|
||||
api.trigger( 'saved', response );
|
||||
} );
|
||||
|
||||
api.bind( 'saved', function() {
|
||||
api.each( function( setting ) {
|
||||
setting._dirty = false;
|
||||
} );
|
||||
} );
|
||||
|
||||
api.preview.bind( 'nonce-refresh', function( nonce ) {
|
||||
$.extend( api.settings.nonce, nonce );
|
||||
} );
|
||||
|
||||
/*
|
||||
* Send a message to the parent customize frame with a list of which
|
||||
* containers and controls are active.
|
||||
*/
|
||||
api.preview.send( 'ready', {
|
||||
activePanels: api.settings.activePanels,
|
||||
activeSections: api.settings.activeSections,
|
||||
activeControls: api.settings.activeControls
|
||||
} );
|
||||
|
||||
// Display a loading indicator when preview is reloading, and remove on failure.
|
||||
api.preview.bind( 'loading-initiated', function () {
|
||||
$( 'body' ).addClass( 'wp-customizer-unloading' );
|
||||
});
|
||||
api.preview.bind( 'loading-failed', function () {
|
||||
$( 'body' ).removeClass( 'wp-customizer-unloading' );
|
||||
});
|
||||
|
||||
/* 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;
|
||||
|
||||
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 );
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Custom Logo
|
||||
*
|
||||
* Toggle the wp-custom-logo body class when a logo is added or removed.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*/
|
||||
api( 'custom_logo', function( setting ) {
|
||||
$( 'body' ).toggleClass( 'wp-custom-logo', !! setting.get() );
|
||||
setting.bind( function( attachmentId ) {
|
||||
$( 'body' ).toggleClass( 'wp-custom-logo', !! attachmentId );
|
||||
} );
|
||||
} );
|
||||
|
||||
api.trigger( 'preview-ready' );
|
||||
});
|
||||
|
||||
})( wp, jQuery );
|
||||
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-preview.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-preview.min.js
vendored
Executable file
@@ -0,0 +1 @@
|
||||
!function(a,b){var c,d=wp.customize;c=function(a,b,c){var d;return function(){var e=arguments;c=c||this,clearTimeout(d),d=setTimeout(function(){d=null,a.apply(c,e)},b)}},d.Preview=d.Messenger.extend({initialize:function(a,e){var f=this;d.Messenger.prototype.initialize.call(this,a,e),this.body=b(document.body),this.body.on("click.preview","a",function(a){var c,d;c=b(this),d="#"===c.attr("href").substr(0,1),a.preventDefault(),d&&"#"!==c.attr("href")&&b(c.attr("href")).each(function(){this.scrollIntoView()}),a.shiftKey||d||(f.send("scroll",0),f.send("url",c.prop("href")))}),this.body.on("submit.preview","form",function(a){a.preventDefault()}),this.window=b(window),this.window.on("scroll.preview",c(function(){f.send("scroll",f.window.scrollTop())},200)),this.bind("scroll",function(a){f.window.scrollTop(a)})}}),b(function(){var a,c;d.settings=window._wpCustomizeSettings,d.settings&&(d.preview=new d.Preview({url:window.location.href,channel:d.settings.channel}),c=function(a,b,c){var e=d(a);e?e.set(b):(c=c||!1,e=d.create(a,b,{id:a}),c&&(e._dirty=!0))},d.preview.bind("settings",function(a){b.each(a,c)}),d.preview.trigger("settings",d.settings.values),b.each(d.settings._dirty,function(a,b){var c=d(b);c&&(c._dirty=!0)}),d.preview.bind("setting",function(a){var b=!0;c.apply(null,a.concat(b))}),d.preview.bind("sync",function(a){b.each(a,function(a,b){d.preview.trigger(a,b)}),d.preview.send("synced")}),d.preview.bind("active",function(){d.preview.send("nonce",d.settings.nonce),d.preview.send("documentTitle",document.title)}),d.preview.bind("saved",function(a){d.trigger("saved",a)}),d.bind("saved",function(){d.each(function(a){a._dirty=!1})}),d.preview.bind("nonce-refresh",function(a){b.extend(d.settings.nonce,a)}),d.preview.send("ready",{activePanels:d.settings.activePanels,activeSections:d.settings.activeSections,activeControls:d.settings.activeControls}),d.preview.bind("loading-initiated",function(){b("body").addClass("wp-customizer-unloading")}),d.preview.bind("loading-failed",function(){b("body").removeClass("wp-customizer-unloading")}),a=b.map(["color","image","position_x","repeat","attachment"],function(a){return"background_"+a}),d.when.apply(d,a).done(function(a,c,d,e,f){var g,h=b(document.body),i=b("head"),j=b("#custom-background-css");g=function(){var g="";h.toggleClass("custom-background",!(!a()&&!c())),a()&&(g+="background-color: "+a()+";"),c()&&(g+='background-image: url("'+c()+'");',g+="background-position: top "+d()+";",g+="background-repeat: "+e()+";",g+="background-attachment: "+f()+";"),j.remove(),j=b('<style type="text/css" id="custom-background-css">body.custom-background { '+g+" }</style>").appendTo(i)},b.each(arguments,function(){this.bind(g)})}),d("custom_logo",function(a){b("body").toggleClass("wp-custom-logo",!!a.get()),a.bind(function(a){b("body").toggleClass("wp-custom-logo",!!a)})}),d.trigger("preview-ready"))})}(wp,jQuery);
|
||||
866
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-selective-refresh.js
Executable file
866
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-selective-refresh.js
Executable file
@@ -0,0 +1,866 @@
|
||||
/* global jQuery, JSON, _customizePartialRefreshExports, console */
|
||||
|
||||
wp.customize.selectiveRefresh = ( function( $, api ) {
|
||||
'use strict';
|
||||
var self, Partial, Placement;
|
||||
|
||||
self = {
|
||||
ready: $.Deferred(),
|
||||
data: {
|
||||
partials: {},
|
||||
renderQueryVar: '',
|
||||
l10n: {
|
||||
shiftClickToEdit: ''
|
||||
},
|
||||
refreshBuffer: 250
|
||||
},
|
||||
currentRequest: null
|
||||
};
|
||||
|
||||
_.extend( self, api.Events );
|
||||
|
||||
/**
|
||||
* A Customizer Partial.
|
||||
*
|
||||
* A partial provides a rendering of one or more settings according to a template.
|
||||
*
|
||||
* @see PHP class WP_Customize_Partial.
|
||||
*
|
||||
* @class
|
||||
* @augments wp.customize.Class
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {string} id Unique identifier for the control instance.
|
||||
* @param {object} options Options hash for the control instance.
|
||||
* @param {object} options.params
|
||||
* @param {string} options.params.type Type of partial (e.g. nav_menu, widget, etc)
|
||||
* @param {string} options.params.selector jQuery selector to find the container element in the page.
|
||||
* @param {array} options.params.settings The IDs for the settings the partial relates to.
|
||||
* @param {string} options.params.primarySetting The ID for the primary setting the partial renders.
|
||||
* @param {bool} options.params.fallbackRefresh Whether to refresh the entire preview in case of a partial refresh failure.
|
||||
*/
|
||||
Partial = self.Partial = api.Class.extend({
|
||||
|
||||
id: null,
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {string} id - Partial ID.
|
||||
* @param {Object} options
|
||||
* @param {Object} options.params
|
||||
*/
|
||||
initialize: function( id, options ) {
|
||||
var partial = this;
|
||||
options = options || {};
|
||||
partial.id = id;
|
||||
|
||||
partial.params = _.extend(
|
||||
{
|
||||
selector: null,
|
||||
settings: [],
|
||||
primarySetting: null,
|
||||
containerInclusive: false,
|
||||
fallbackRefresh: true // Note this needs to be false in a front-end editing context.
|
||||
},
|
||||
options.params || {}
|
||||
);
|
||||
|
||||
partial.deferred = {};
|
||||
partial.deferred.ready = $.Deferred();
|
||||
|
||||
partial.deferred.ready.done( function() {
|
||||
partial.ready();
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Set up the partial.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*/
|
||||
ready: function() {
|
||||
var partial = this;
|
||||
_.each( _.pluck( partial.placements(), 'container' ), function( container ) {
|
||||
$( container ).attr( 'title', self.data.l10n.shiftClickToEdit );
|
||||
} );
|
||||
$( document ).on( 'click', partial.params.selector, function( e ) {
|
||||
if ( ! e.shiftKey ) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
_.each( partial.placements(), function( placement ) {
|
||||
if ( $( placement.container ).is( e.currentTarget ) ) {
|
||||
partial.showControl();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Find all placements for this partial int he document.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @return {Array.<Placement>}
|
||||
*/
|
||||
placements: function() {
|
||||
var partial = this, selector;
|
||||
|
||||
selector = partial.params.selector || '';
|
||||
if ( selector ) {
|
||||
selector += ', ';
|
||||
}
|
||||
selector += '[data-customize-partial-id="' + partial.id + '"]'; // @todo Consider injecting customize-partial-id-${id} classnames instead.
|
||||
|
||||
return $( selector ).map( function() {
|
||||
var container = $( this ), context;
|
||||
|
||||
context = container.data( 'customize-partial-placement-context' );
|
||||
if ( _.isString( context ) && '{' === context.substr( 0, 1 ) ) {
|
||||
throw new Error( 'context JSON parse error' );
|
||||
}
|
||||
|
||||
return new Placement( {
|
||||
partial: partial,
|
||||
container: container,
|
||||
context: context
|
||||
} );
|
||||
} ).get();
|
||||
},
|
||||
|
||||
/**
|
||||
* Get list of setting IDs related to this partial.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @return {String[]}
|
||||
*/
|
||||
settings: function() {
|
||||
var partial = this;
|
||||
if ( partial.params.settings && 0 !== partial.params.settings.length ) {
|
||||
return partial.params.settings;
|
||||
} else if ( partial.params.primarySetting ) {
|
||||
return [ partial.params.primarySetting ];
|
||||
} else {
|
||||
return [ partial.id ];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Return whether the setting is related to the partial.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {wp.customize.Value|string} setting ID or object for setting.
|
||||
* @return {boolean} Whether the setting is related to the partial.
|
||||
*/
|
||||
isRelatedSetting: function( setting /*... newValue, oldValue */ ) {
|
||||
var partial = this;
|
||||
if ( _.isString( setting ) ) {
|
||||
setting = api( setting );
|
||||
}
|
||||
if ( ! setting ) {
|
||||
return false;
|
||||
}
|
||||
return -1 !== _.indexOf( partial.settings(), setting.id );
|
||||
},
|
||||
|
||||
/**
|
||||
* Show the control to modify this partial's setting(s).
|
||||
*
|
||||
* This may be overridden for inline editing.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*/
|
||||
showControl: function() {
|
||||
var partial = this, settingId = partial.params.primarySetting;
|
||||
if ( ! settingId ) {
|
||||
settingId = _.first( partial.settings() );
|
||||
}
|
||||
api.preview.send( 'focus-control-for-setting', settingId );
|
||||
},
|
||||
|
||||
/**
|
||||
* Prepare container for selective refresh.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {Placement} placement
|
||||
*/
|
||||
preparePlacement: function( placement ) {
|
||||
$( placement.container ).addClass( 'customize-partial-refreshing' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Reference to the pending promise returned from self.requestPartial().
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @private
|
||||
*/
|
||||
_pendingRefreshPromise: null,
|
||||
|
||||
/**
|
||||
* Request the new partial and render it into the placements.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @this {wp.customize.selectiveRefresh.Partial}
|
||||
* @return {jQuery.Promise}
|
||||
*/
|
||||
refresh: function() {
|
||||
var partial = this, refreshPromise;
|
||||
|
||||
refreshPromise = self.requestPartial( partial );
|
||||
|
||||
if ( ! partial._pendingRefreshPromise ) {
|
||||
_.each( partial.placements(), function( placement ) {
|
||||
partial.preparePlacement( placement );
|
||||
} );
|
||||
|
||||
refreshPromise.done( function( placements ) {
|
||||
_.each( placements, function( placement ) {
|
||||
partial.renderContent( placement );
|
||||
} );
|
||||
} );
|
||||
|
||||
refreshPromise.fail( function( data, placements ) {
|
||||
partial.fallback( data, placements );
|
||||
} );
|
||||
|
||||
// Allow new request when this one finishes.
|
||||
partial._pendingRefreshPromise = refreshPromise;
|
||||
refreshPromise.always( function() {
|
||||
partial._pendingRefreshPromise = null;
|
||||
} );
|
||||
}
|
||||
|
||||
return refreshPromise;
|
||||
},
|
||||
|
||||
/**
|
||||
* Apply the addedContent in the placement to the document.
|
||||
*
|
||||
* Note the placement object will have its container and removedNodes
|
||||
* properties updated.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {Placement} placement
|
||||
* @param {Element|jQuery} [placement.container] - This param will be empty if there was no element matching the selector.
|
||||
* @param {string|object|boolean} placement.addedContent - Rendered HTML content, a data object for JS templates to render, or false if no render.
|
||||
* @param {object} [placement.context] - Optional context information about the container.
|
||||
* @returns {boolean} Whether the rendering was successful and the fallback was not invoked.
|
||||
*/
|
||||
renderContent: function( placement ) {
|
||||
var partial = this, content, newContainerElement;
|
||||
if ( ! placement.container ) {
|
||||
partial.fallback( new Error( 'no_container' ), [ placement ] );
|
||||
return false;
|
||||
}
|
||||
placement.container = $( placement.container );
|
||||
if ( false === placement.addedContent ) {
|
||||
partial.fallback( new Error( 'missing_render' ), [ placement ] );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Currently a subclass needs to override renderContent to handle partials returning data object.
|
||||
if ( ! _.isString( placement.addedContent ) ) {
|
||||
partial.fallback( new Error( 'non_string_content' ), [ placement ] );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* jshint ignore:start */
|
||||
self.orginalDocumentWrite = document.write;
|
||||
document.write = function() {
|
||||
throw new Error( self.data.l10n.badDocumentWrite );
|
||||
};
|
||||
/* jshint ignore:end */
|
||||
try {
|
||||
content = placement.addedContent;
|
||||
if ( wp.emoji && wp.emoji.parse && ! $.contains( document.head, placement.container[0] ) ) {
|
||||
content = wp.emoji.parse( content );
|
||||
}
|
||||
|
||||
if ( partial.params.containerInclusive ) {
|
||||
|
||||
// Note that content may be an empty string, and in this case jQuery will just remove the oldContainer
|
||||
newContainerElement = $( content );
|
||||
|
||||
// Merge the new context on top of the old context.
|
||||
placement.context = _.extend(
|
||||
placement.context,
|
||||
newContainerElement.data( 'customize-partial-placement-context' ) || {}
|
||||
);
|
||||
newContainerElement.data( 'customize-partial-placement-context', placement.context );
|
||||
|
||||
placement.removedNodes = placement.container;
|
||||
placement.container = newContainerElement;
|
||||
placement.removedNodes.replaceWith( placement.container );
|
||||
placement.container.attr( 'title', self.data.l10n.shiftClickToEdit );
|
||||
} else {
|
||||
placement.removedNodes = document.createDocumentFragment();
|
||||
while ( placement.container[0].firstChild ) {
|
||||
placement.removedNodes.appendChild( placement.container[0].firstChild );
|
||||
}
|
||||
|
||||
placement.container.html( content );
|
||||
}
|
||||
|
||||
placement.container.removeClass( 'customize-render-content-error' );
|
||||
} catch ( error ) {
|
||||
if ( 'undefined' !== typeof console && console.error ) {
|
||||
console.error( partial.id, error );
|
||||
}
|
||||
}
|
||||
/* jshint ignore:start */
|
||||
document.write = self.orginalDocumentWrite;
|
||||
self.orginalDocumentWrite = null;
|
||||
/* jshint ignore:end */
|
||||
|
||||
placement.container.removeClass( 'customize-partial-refreshing' );
|
||||
|
||||
// Prevent placement container from being being re-triggered as being rendered among nested partials.
|
||||
placement.container.data( 'customize-partial-content-rendered', true );
|
||||
|
||||
/**
|
||||
* Announce when a partial's placement has been rendered so that dynamic elements can be re-built.
|
||||
*/
|
||||
self.trigger( 'partial-content-rendered', placement );
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle fail to render partial.
|
||||
*
|
||||
* The first argument is either the failing jqXHR or an Error object, and the second argument is the array of containers.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*/
|
||||
fallback: function() {
|
||||
var partial = this;
|
||||
if ( partial.params.fallbackRefresh ) {
|
||||
self.requestFullRefresh();
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
/**
|
||||
* A Placement for a Partial.
|
||||
*
|
||||
* A partial placement is the actual physical representation of a partial for a given context.
|
||||
* It also may have information in relation to how a placement may have just changed.
|
||||
* The placement is conceptually similar to a DOM Range or MutationRecord.
|
||||
*
|
||||
* @class
|
||||
* @augments wp.customize.Class
|
||||
* @since 4.5.0
|
||||
*/
|
||||
self.Placement = Placement = api.Class.extend({
|
||||
|
||||
/**
|
||||
* The partial with which the container is associated.
|
||||
*
|
||||
* @param {wp.customize.selectiveRefresh.Partial}
|
||||
*/
|
||||
partial: null,
|
||||
|
||||
/**
|
||||
* DOM element which contains the placement's contents.
|
||||
*
|
||||
* This will be null if the startNode and endNode do not point to the same
|
||||
* DOM element, such as in the case of a sidebar partial.
|
||||
* This container element itself will be replaced for partials that
|
||||
* have containerInclusive param defined as true.
|
||||
*/
|
||||
container: null,
|
||||
|
||||
/**
|
||||
* DOM node for the initial boundary of the placement.
|
||||
*
|
||||
* This will normally be the same as endNode since most placements appear as elements.
|
||||
* This is primarily useful for widget sidebars which do not have intrinsic containers, but
|
||||
* for which an HTML comment is output before to mark the starting position.
|
||||
*/
|
||||
startNode: null,
|
||||
|
||||
/**
|
||||
* DOM node for the terminal boundary of the placement.
|
||||
*
|
||||
* This will normally be the same as startNode since most placements appear as elements.
|
||||
* This is primarily useful for widget sidebars which do not have intrinsic containers, but
|
||||
* for which an HTML comment is output before to mark the ending position.
|
||||
*/
|
||||
endNode: null,
|
||||
|
||||
/**
|
||||
* Context data.
|
||||
*
|
||||
* This provides information about the placement which is included in the request
|
||||
* in order to render the partial properly.
|
||||
*
|
||||
* @param {object}
|
||||
*/
|
||||
context: null,
|
||||
|
||||
/**
|
||||
* The content for the partial when refreshed.
|
||||
*
|
||||
* @param {string}
|
||||
*/
|
||||
addedContent: null,
|
||||
|
||||
/**
|
||||
* DOM node(s) removed when the partial is refreshed.
|
||||
*
|
||||
* If the partial is containerInclusive, then the removedNodes will be
|
||||
* the single Element that was the partial's former placement. If the
|
||||
* partial is not containerInclusive, then the removedNodes will be a
|
||||
* documentFragment containing the nodes removed.
|
||||
*
|
||||
* @param {Element|DocumentFragment}
|
||||
*/
|
||||
removedNodes: null,
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {object} args
|
||||
* @param {Partial} args.partial
|
||||
* @param {jQuery|Element} [args.container]
|
||||
* @param {Node} [args.startNode]
|
||||
* @param {Node} [args.endNode]
|
||||
* @param {object} [args.context]
|
||||
* @param {string} [args.addedContent]
|
||||
* @param {jQuery|DocumentFragment} [args.removedNodes]
|
||||
*/
|
||||
initialize: function( args ) {
|
||||
var placement = this;
|
||||
|
||||
args = _.extend( {}, args || {} );
|
||||
if ( ! args.partial || ! args.partial.extended( Partial ) ) {
|
||||
throw new Error( 'Missing partial' );
|
||||
}
|
||||
args.context = args.context || {};
|
||||
if ( args.container ) {
|
||||
args.container = $( args.container );
|
||||
}
|
||||
|
||||
_.extend( placement, args );
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Mapping of type names to Partial constructor subclasses.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @type {Object.<string, wp.customize.selectiveRefresh.Partial>}
|
||||
*/
|
||||
self.partialConstructor = {};
|
||||
|
||||
self.partial = new api.Values({ defaultConstructor: Partial });
|
||||
|
||||
/**
|
||||
* Get the POST vars for a Customizer preview request.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @see wp.customize.previewer.query()
|
||||
*
|
||||
* @return {object}
|
||||
*/
|
||||
self.getCustomizeQuery = function() {
|
||||
var dirtyCustomized = {};
|
||||
api.each( function( value, key ) {
|
||||
if ( value._dirty ) {
|
||||
dirtyCustomized[ key ] = value();
|
||||
}
|
||||
} );
|
||||
|
||||
return {
|
||||
wp_customize: 'on',
|
||||
nonce: api.settings.nonce.preview,
|
||||
theme: api.settings.theme.stylesheet,
|
||||
customized: JSON.stringify( dirtyCustomized )
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Currently-requested partials and their associated deferreds.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @type {Object<string, { deferred: jQuery.Promise, partial: wp.customize.selectiveRefresh.Partial }>}
|
||||
*/
|
||||
self._pendingPartialRequests = {};
|
||||
|
||||
/**
|
||||
* Timeout ID for the current requesr, or null if no request is current.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @type {number|null}
|
||||
* @private
|
||||
*/
|
||||
self._debouncedTimeoutId = null;
|
||||
|
||||
/**
|
||||
* Current jqXHR for the request to the partials.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @type {jQuery.jqXHR|null}
|
||||
* @private
|
||||
*/
|
||||
self._currentRequest = null;
|
||||
|
||||
/**
|
||||
* Request full page refresh.
|
||||
*
|
||||
* When selective refresh is embedded in the context of front-end editing, this request
|
||||
* must fail or else changes will be lost, unless transactions are implemented.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*/
|
||||
self.requestFullRefresh = function() {
|
||||
api.preview.send( 'refresh' );
|
||||
};
|
||||
|
||||
/**
|
||||
* Request a re-rendering of a partial.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {wp.customize.selectiveRefresh.Partial} partial
|
||||
* @return {jQuery.Promise}
|
||||
*/
|
||||
self.requestPartial = function( partial ) {
|
||||
var partialRequest;
|
||||
|
||||
if ( self._debouncedTimeoutId ) {
|
||||
clearTimeout( self._debouncedTimeoutId );
|
||||
self._debouncedTimeoutId = null;
|
||||
}
|
||||
if ( self._currentRequest ) {
|
||||
self._currentRequest.abort();
|
||||
self._currentRequest = null;
|
||||
}
|
||||
|
||||
partialRequest = self._pendingPartialRequests[ partial.id ];
|
||||
if ( ! partialRequest || 'pending' !== partialRequest.deferred.state() ) {
|
||||
partialRequest = {
|
||||
deferred: $.Deferred(),
|
||||
partial: partial
|
||||
};
|
||||
self._pendingPartialRequests[ partial.id ] = partialRequest;
|
||||
}
|
||||
|
||||
// Prevent leaking partial into debounced timeout callback.
|
||||
partial = null;
|
||||
|
||||
self._debouncedTimeoutId = setTimeout(
|
||||
function() {
|
||||
var data, partialPlacementContexts, partialsPlacements, request;
|
||||
|
||||
self._debouncedTimeoutId = null;
|
||||
data = self.getCustomizeQuery();
|
||||
|
||||
/*
|
||||
* It is key that the containers be fetched exactly at the point of the request being
|
||||
* made, because the containers need to be mapped to responses by array indices.
|
||||
*/
|
||||
partialsPlacements = {};
|
||||
|
||||
partialPlacementContexts = {};
|
||||
|
||||
_.each( self._pendingPartialRequests, function( pending, partialId ) {
|
||||
partialsPlacements[ partialId ] = pending.partial.placements();
|
||||
if ( ! self.partial.has( partialId ) ) {
|
||||
pending.deferred.rejectWith( pending.partial, [ new Error( 'partial_removed' ), partialsPlacements[ partialId ] ] );
|
||||
} else {
|
||||
/*
|
||||
* Note that this may in fact be an empty array. In that case, it is the responsibility
|
||||
* of the Partial subclass instance to know where to inject the response, or else to
|
||||
* just issue a refresh (default behavior). The data being returned with each container
|
||||
* is the context information that may be needed to render certain partials, such as
|
||||
* the contained sidebar for rendering widgets or what the nav menu args are for a menu.
|
||||
*/
|
||||
partialPlacementContexts[ partialId ] = _.map( partialsPlacements[ partialId ], function( placement ) {
|
||||
return placement.context || {};
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
data.partials = JSON.stringify( partialPlacementContexts );
|
||||
data[ self.data.renderQueryVar ] = '1';
|
||||
|
||||
request = self._currentRequest = wp.ajax.send( null, {
|
||||
data: data,
|
||||
url: api.settings.url.self
|
||||
} );
|
||||
|
||||
request.done( function( data ) {
|
||||
|
||||
/**
|
||||
* Announce the data returned from a request to render partials.
|
||||
*
|
||||
* The data is filtered on the server via customize_render_partials_response
|
||||
* so plugins can inject data from the server to be utilized
|
||||
* on the client via this event. Plugins may use this filter
|
||||
* to communicate script and style dependencies that need to get
|
||||
* injected into the page to support the rendered partials.
|
||||
* This is similar to the 'saved' event.
|
||||
*/
|
||||
self.trigger( 'render-partials-response', data );
|
||||
|
||||
// Relay errors (warnings) captured during rendering and relay to console.
|
||||
if ( data.errors && 'undefined' !== typeof console && console.warn ) {
|
||||
_.each( data.errors, function( error ) {
|
||||
console.warn( error );
|
||||
} );
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that data is an array of items that correspond to the array of
|
||||
* containers that were submitted in the request. So we zip up the
|
||||
* array of containers with the array of contents for those containers,
|
||||
* and send them into .
|
||||
*/
|
||||
_.each( self._pendingPartialRequests, function( pending, partialId ) {
|
||||
var placementsContents;
|
||||
if ( ! _.isArray( data.contents[ partialId ] ) ) {
|
||||
pending.deferred.rejectWith( pending.partial, [ new Error( 'unrecognized_partial' ), partialsPlacements[ partialId ] ] );
|
||||
} else {
|
||||
placementsContents = _.map( data.contents[ partialId ], function( content, i ) {
|
||||
var partialPlacement = partialsPlacements[ partialId ][ i ];
|
||||
if ( partialPlacement ) {
|
||||
partialPlacement.addedContent = content;
|
||||
} else {
|
||||
partialPlacement = new Placement( {
|
||||
partial: pending.partial,
|
||||
addedContent: content
|
||||
} );
|
||||
}
|
||||
return partialPlacement;
|
||||
} );
|
||||
pending.deferred.resolveWith( pending.partial, [ placementsContents ] );
|
||||
}
|
||||
} );
|
||||
self._pendingPartialRequests = {};
|
||||
} );
|
||||
|
||||
request.fail( function( data, statusText ) {
|
||||
|
||||
/*
|
||||
* Ignore failures caused by partial.currentRequest.abort()
|
||||
* The pending deferreds will remain in self._pendingPartialRequests
|
||||
* for re-use with the next request.
|
||||
*/
|
||||
if ( 'abort' === statusText ) {
|
||||
return;
|
||||
}
|
||||
|
||||
_.each( self._pendingPartialRequests, function( pending, partialId ) {
|
||||
pending.deferred.rejectWith( pending.partial, [ data, partialsPlacements[ partialId ] ] );
|
||||
} );
|
||||
self._pendingPartialRequests = {};
|
||||
} );
|
||||
},
|
||||
self.data.refreshBuffer
|
||||
);
|
||||
|
||||
return partialRequest.deferred.promise();
|
||||
};
|
||||
|
||||
/**
|
||||
* Add partials for any nav menu container elements in the document.
|
||||
*
|
||||
* This method may be called multiple times. Containers that already have been
|
||||
* seen will be skipped.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {jQuery|HTMLElement} [rootElement]
|
||||
* @param {object} [options]
|
||||
* @param {boolean=true} [options.triggerRendered]
|
||||
*/
|
||||
self.addPartials = function( rootElement, options ) {
|
||||
var containerElements;
|
||||
if ( ! rootElement ) {
|
||||
rootElement = document.documentElement;
|
||||
}
|
||||
rootElement = $( rootElement );
|
||||
options = _.extend(
|
||||
{
|
||||
triggerRendered: true
|
||||
},
|
||||
options || {}
|
||||
);
|
||||
|
||||
containerElements = rootElement.find( '[data-customize-partial-id]' );
|
||||
if ( rootElement.is( '[data-customize-partial-id]' ) ) {
|
||||
containerElements = containerElements.add( rootElement );
|
||||
}
|
||||
containerElements.each( function() {
|
||||
var containerElement = $( this ), partial, id, Constructor, partialOptions, containerContext;
|
||||
id = containerElement.data( 'customize-partial-id' );
|
||||
if ( ! id ) {
|
||||
return;
|
||||
}
|
||||
containerContext = containerElement.data( 'customize-partial-placement-context' ) || {};
|
||||
|
||||
partial = self.partial( id );
|
||||
if ( ! partial ) {
|
||||
partialOptions = containerElement.data( 'customize-partial-options' ) || {};
|
||||
partialOptions.constructingContainerContext = containerElement.data( 'customize-partial-placement-context' ) || {};
|
||||
Constructor = self.partialConstructor[ containerElement.data( 'customize-partial-type' ) ] || self.Partial;
|
||||
partial = new Constructor( id, partialOptions );
|
||||
self.partial.add( partial.id, partial );
|
||||
}
|
||||
|
||||
/*
|
||||
* Only trigger renders on (nested) partials that have been not been
|
||||
* handled yet. An example where this would apply is a nav menu
|
||||
* embedded inside of a custom menu widget. When the widget's title
|
||||
* is updated, the entire widget will re-render and then the event
|
||||
* will be triggered for the nested nav menu to do any initialization.
|
||||
*/
|
||||
if ( options.triggerRendered && ! containerElement.data( 'customize-partial-content-rendered' ) ) {
|
||||
|
||||
/**
|
||||
* Announce when a partial's nested placement has been re-rendered.
|
||||
*/
|
||||
self.trigger( 'partial-content-rendered', new Placement( {
|
||||
partial: partial,
|
||||
context: containerContext,
|
||||
container: containerElement
|
||||
} ) );
|
||||
}
|
||||
containerElement.data( 'customize-partial-content-rendered', true );
|
||||
} );
|
||||
};
|
||||
|
||||
api.bind( 'preview-ready', function() {
|
||||
var handleSettingChange, watchSettingChange, unwatchSettingChange;
|
||||
|
||||
// Polyfill for IE8 to support the document.head attribute.
|
||||
if ( ! document.head ) {
|
||||
document.head = $( 'head:first' )[0];
|
||||
}
|
||||
|
||||
_.extend( self.data, _customizePartialRefreshExports );
|
||||
|
||||
// Create the partial JS models.
|
||||
_.each( self.data.partials, function( data, id ) {
|
||||
var Constructor, partial = self.partial( id );
|
||||
if ( ! partial ) {
|
||||
Constructor = self.partialConstructor[ data.type ] || self.Partial;
|
||||
partial = new Constructor( id, { params: data } );
|
||||
self.partial.add( id, partial );
|
||||
} else {
|
||||
_.extend( partial.params, data );
|
||||
}
|
||||
} );
|
||||
|
||||
/**
|
||||
* Handle change to a setting.
|
||||
*
|
||||
* Note this is largely needed because adding a 'change' event handler to wp.customize
|
||||
* will only include the changed setting object as an argument, not including the
|
||||
* new value or the old value.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @this {wp.customize.Setting}
|
||||
*
|
||||
* @param {*|null} newValue New value, or null if the setting was just removed.
|
||||
* @param {*|null} oldValue Old value, or null if the setting was just added.
|
||||
*/
|
||||
handleSettingChange = function( newValue, oldValue ) {
|
||||
var setting = this;
|
||||
self.partial.each( function( partial ) {
|
||||
if ( partial.isRelatedSetting( setting, newValue, oldValue ) ) {
|
||||
partial.refresh();
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
/**
|
||||
* Trigger the initial change for the added setting, and watch for changes.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @this {wp.customize.Values}
|
||||
*
|
||||
* @param {wp.customize.Setting} setting
|
||||
*/
|
||||
watchSettingChange = function( setting ) {
|
||||
handleSettingChange.call( setting, setting(), null );
|
||||
setting.bind( handleSettingChange );
|
||||
};
|
||||
|
||||
/**
|
||||
* Trigger the final change for the removed setting, and unwatch for changes.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @this {wp.customize.Values}
|
||||
*
|
||||
* @param {wp.customize.Setting} setting
|
||||
*/
|
||||
unwatchSettingChange = function( setting ) {
|
||||
handleSettingChange.call( setting, null, setting() );
|
||||
setting.unbind( handleSettingChange );
|
||||
};
|
||||
|
||||
api.bind( 'add', watchSettingChange );
|
||||
api.bind( 'remove', unwatchSettingChange );
|
||||
api.each( function( setting ) {
|
||||
setting.bind( handleSettingChange );
|
||||
} );
|
||||
|
||||
// Add (dynamic) initial partials that are declared via data-* attributes.
|
||||
self.addPartials( document.documentElement, {
|
||||
triggerRendered: false
|
||||
} );
|
||||
|
||||
// Add new dynamic partials when the document changes.
|
||||
if ( 'undefined' !== typeof MutationObserver ) {
|
||||
self.mutationObserver = new MutationObserver( function( mutations ) {
|
||||
_.each( mutations, function( mutation ) {
|
||||
self.addPartials( $( mutation.target ) );
|
||||
} );
|
||||
} );
|
||||
self.mutationObserver.observe( document.documentElement, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle rendering of partials.
|
||||
*
|
||||
* @param {api.selectiveRefresh.Placement} placement
|
||||
*/
|
||||
api.selectiveRefresh.bind( 'partial-content-rendered', function( placement ) {
|
||||
if ( placement.container ) {
|
||||
self.addPartials( placement.container );
|
||||
}
|
||||
} );
|
||||
|
||||
api.preview.bind( 'active', function() {
|
||||
|
||||
// Make all partials ready.
|
||||
self.partial.each( function( partial ) {
|
||||
partial.deferred.ready.resolve();
|
||||
} );
|
||||
|
||||
// Make all partials added henceforth as ready upon add.
|
||||
self.partial.bind( 'add', function( partial ) {
|
||||
partial.deferred.ready.resolve();
|
||||
} );
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
return self;
|
||||
}( jQuery, wp.customize ) );
|
||||
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-selective-refresh.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-selective-refresh.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
228
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-views.js
Executable file
228
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-views.js
Executable file
@@ -0,0 +1,228 @@
|
||||
(function( $, wp, _ ) {
|
||||
|
||||
if ( ! wp || ! wp.customize ) { return; }
|
||||
var api = wp.customize;
|
||||
|
||||
/**
|
||||
* wp.customize.HeaderTool.CurrentView
|
||||
*
|
||||
* Displays the currently selected header image, or a placeholder in lack
|
||||
* thereof.
|
||||
*
|
||||
* Instantiate with model wp.customize.HeaderTool.currentHeader.
|
||||
*
|
||||
* @constructor
|
||||
* @augments wp.Backbone.View
|
||||
*/
|
||||
api.HeaderTool.CurrentView = wp.Backbone.View.extend({
|
||||
template: wp.template('header-current'),
|
||||
|
||||
initialize: function() {
|
||||
this.listenTo(this.model, 'change', this.render);
|
||||
this.render();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.html(this.template(this.model.toJSON()));
|
||||
this.setPlaceholder();
|
||||
this.setButtons();
|
||||
return this;
|
||||
},
|
||||
|
||||
getHeight: function() {
|
||||
var image = this.$el.find('img'),
|
||||
saved, height, headerImageData;
|
||||
|
||||
if (image.length) {
|
||||
this.$el.find('.inner').hide();
|
||||
} else {
|
||||
this.$el.find('.inner').show();
|
||||
return 40;
|
||||
}
|
||||
|
||||
saved = this.model.get('savedHeight');
|
||||
height = image.height() || saved;
|
||||
|
||||
// happens at ready
|
||||
if (!height) {
|
||||
headerImageData = api.get().header_image_data;
|
||||
|
||||
if (headerImageData && headerImageData.width && headerImageData.height) {
|
||||
// hardcoded container width
|
||||
height = 260 / headerImageData.width * headerImageData.height;
|
||||
}
|
||||
else {
|
||||
// fallback for when no image is set
|
||||
height = 40;
|
||||
}
|
||||
}
|
||||
|
||||
return height;
|
||||
},
|
||||
|
||||
setPlaceholder: function(_height) {
|
||||
var height = _height || this.getHeight();
|
||||
this.model.set('savedHeight', height);
|
||||
this.$el.height(height);
|
||||
},
|
||||
|
||||
setButtons: function() {
|
||||
var elements = $('#customize-control-header_image .actions .remove');
|
||||
if (this.model.get('choice')) {
|
||||
elements.show();
|
||||
} else {
|
||||
elements.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* wp.customize.HeaderTool.ChoiceView
|
||||
*
|
||||
* Represents a choosable header image, be it user-uploaded,
|
||||
* theme-suggested or a special Randomize choice.
|
||||
*
|
||||
* Takes a wp.customize.HeaderTool.ImageModel.
|
||||
*
|
||||
* Manually changes model wp.customize.HeaderTool.currentHeader via the
|
||||
* `select` method.
|
||||
*
|
||||
* @constructor
|
||||
* @augments wp.Backbone.View
|
||||
*/
|
||||
api.HeaderTool.ChoiceView = wp.Backbone.View.extend({
|
||||
template: wp.template('header-choice'),
|
||||
|
||||
className: 'header-view',
|
||||
|
||||
events: {
|
||||
'click .choice,.random': 'select',
|
||||
'click .close': 'removeImage'
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
var properties = [
|
||||
this.model.get('header').url,
|
||||
this.model.get('choice')
|
||||
];
|
||||
|
||||
this.listenTo(this.model, 'change:selected', this.toggleSelected);
|
||||
|
||||
if (_.contains(properties, api.get().header_image)) {
|
||||
api.HeaderTool.currentHeader.set(this.extendedModel());
|
||||
}
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.html(this.template(this.extendedModel()));
|
||||
|
||||
this.toggleSelected();
|
||||
return this;
|
||||
},
|
||||
|
||||
toggleSelected: function() {
|
||||
this.$el.toggleClass('selected', this.model.get('selected'));
|
||||
},
|
||||
|
||||
extendedModel: function() {
|
||||
var c = this.model.get('collection');
|
||||
return _.extend(this.model.toJSON(), {
|
||||
type: c.type
|
||||
});
|
||||
},
|
||||
|
||||
getHeight: api.HeaderTool.CurrentView.prototype.getHeight,
|
||||
|
||||
setPlaceholder: api.HeaderTool.CurrentView.prototype.setPlaceholder,
|
||||
|
||||
select: function() {
|
||||
this.preventJump();
|
||||
this.model.save();
|
||||
api.HeaderTool.currentHeader.set(this.extendedModel());
|
||||
},
|
||||
|
||||
preventJump: function() {
|
||||
var container = $('.wp-full-overlay-sidebar-content'),
|
||||
scroll = container.scrollTop();
|
||||
|
||||
_.defer(function() {
|
||||
container.scrollTop(scroll);
|
||||
});
|
||||
},
|
||||
|
||||
removeImage: function(e) {
|
||||
e.stopPropagation();
|
||||
this.model.destroy();
|
||||
this.remove();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* wp.customize.HeaderTool.ChoiceListView
|
||||
*
|
||||
* A container for ChoiceViews. These choices should be of one same type:
|
||||
* user-uploaded headers or theme-defined ones.
|
||||
*
|
||||
* Takes a wp.customize.HeaderTool.ChoiceList.
|
||||
*
|
||||
* @constructor
|
||||
* @augments wp.Backbone.View
|
||||
*/
|
||||
api.HeaderTool.ChoiceListView = wp.Backbone.View.extend({
|
||||
initialize: function() {
|
||||
this.listenTo(this.collection, 'add', this.addOne);
|
||||
this.listenTo(this.collection, 'remove', this.render);
|
||||
this.listenTo(this.collection, 'sort', this.render);
|
||||
this.listenTo(this.collection, 'change', this.toggleList);
|
||||
this.render();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.empty();
|
||||
this.collection.each(this.addOne, this);
|
||||
this.toggleList();
|
||||
},
|
||||
|
||||
addOne: function(choice) {
|
||||
var view;
|
||||
choice.set({ collection: this.collection });
|
||||
view = new api.HeaderTool.ChoiceView({ model: choice });
|
||||
this.$el.append(view.render().el);
|
||||
},
|
||||
|
||||
toggleList: function() {
|
||||
var title = this.$el.parents().prev('.customize-control-title'),
|
||||
randomButton = this.$el.find('.random').parent();
|
||||
if (this.collection.shouldHideTitle()) {
|
||||
title.add(randomButton).hide();
|
||||
} else {
|
||||
title.add(randomButton).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* wp.customize.HeaderTool.CombinedList
|
||||
*
|
||||
* Aggregates wp.customize.HeaderTool.ChoiceList collections (or any
|
||||
* Backbone object, really) and acts as a bus to feed them events.
|
||||
*
|
||||
* @constructor
|
||||
* @augments wp.Backbone.View
|
||||
*/
|
||||
api.HeaderTool.CombinedList = wp.Backbone.View.extend({
|
||||
initialize: function(collections) {
|
||||
this.collections = collections;
|
||||
this.on('all', this.propagate, this);
|
||||
},
|
||||
propagate: function(event, arg) {
|
||||
_.each(this.collections, function(collection) {
|
||||
collection.trigger(event, arg);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
})( jQuery, window.wp, _ );
|
||||
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-views.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/customize-views.min.js
vendored
Executable file
@@ -0,0 +1 @@
|
||||
!function(a,b,c){if(b&&b.customize){var d=b.customize;d.HeaderTool.CurrentView=b.Backbone.View.extend({template:b.template("header-current"),initialize:function(){this.listenTo(this.model,"change",this.render),this.render()},render:function(){return this.$el.html(this.template(this.model.toJSON())),this.setPlaceholder(),this.setButtons(),this},getHeight:function(){var a,b,c,e=this.$el.find("img");return e.length?(this.$el.find(".inner").hide(),a=this.model.get("savedHeight"),b=e.height()||a,b||(c=d.get().header_image_data,b=c&&c.width&&c.height?260/c.width*c.height:40),b):(this.$el.find(".inner").show(),40)},setPlaceholder:function(a){var b=a||this.getHeight();this.model.set("savedHeight",b),this.$el.height(b)},setButtons:function(){var b=a("#customize-control-header_image .actions .remove");this.model.get("choice")?b.show():b.hide()}}),d.HeaderTool.ChoiceView=b.Backbone.View.extend({template:b.template("header-choice"),className:"header-view",events:{"click .choice,.random":"select","click .close":"removeImage"},initialize:function(){var a=[this.model.get("header").url,this.model.get("choice")];this.listenTo(this.model,"change:selected",this.toggleSelected),c.contains(a,d.get().header_image)&&d.HeaderTool.currentHeader.set(this.extendedModel())},render:function(){return this.$el.html(this.template(this.extendedModel())),this.toggleSelected(),this},toggleSelected:function(){this.$el.toggleClass("selected",this.model.get("selected"))},extendedModel:function(){var a=this.model.get("collection");return c.extend(this.model.toJSON(),{type:a.type})},getHeight:d.HeaderTool.CurrentView.prototype.getHeight,setPlaceholder:d.HeaderTool.CurrentView.prototype.setPlaceholder,select:function(){this.preventJump(),this.model.save(),d.HeaderTool.currentHeader.set(this.extendedModel())},preventJump:function(){var b=a(".wp-full-overlay-sidebar-content"),d=b.scrollTop();c.defer(function(){b.scrollTop(d)})},removeImage:function(a){a.stopPropagation(),this.model.destroy(),this.remove()}}),d.HeaderTool.ChoiceListView=b.Backbone.View.extend({initialize:function(){this.listenTo(this.collection,"add",this.addOne),this.listenTo(this.collection,"remove",this.render),this.listenTo(this.collection,"sort",this.render),this.listenTo(this.collection,"change",this.toggleList),this.render()},render:function(){this.$el.empty(),this.collection.each(this.addOne,this),this.toggleList()},addOne:function(a){var b;a.set({collection:this.collection}),b=new d.HeaderTool.ChoiceView({model:a}),this.$el.append(b.render().el)},toggleList:function(){var a=this.$el.parents().prev(".customize-control-title"),b=this.$el.find(".random").parent();this.collection.shouldHideTitle()?a.add(b).hide():a.add(b).show()}}),d.HeaderTool.CombinedList=b.Backbone.View.extend({initialize:function(a){this.collections=a,this.on("all",this.propagate,this)},propagate:function(a,b){c.each(this.collections,function(c){c.trigger(a,b)})}})}}(jQuery,window.wp,_);
|
||||
749
Kapitel_7/Lektion_4/wordpress/wp-includes/js/heartbeat.js
Executable file
749
Kapitel_7/Lektion_4/wordpress/wp-includes/js/heartbeat.js
Executable file
@@ -0,0 +1,749 @@
|
||||
/**
|
||||
* Heartbeat API
|
||||
*
|
||||
* Heartbeat is a simple server polling API that sends XHR requests to
|
||||
* the server every 15 - 60 seconds and triggers events (or callbacks) upon
|
||||
* receiving data. Currently these 'ticks' handle transports for post locking,
|
||||
* login-expiration warnings, autosave, and related tasks while a user is logged in.
|
||||
*
|
||||
* Available PHP filters (in ajax-actions.php):
|
||||
* - heartbeat_received
|
||||
* - heartbeat_send
|
||||
* - heartbeat_tick
|
||||
* - heartbeat_nopriv_received
|
||||
* - heartbeat_nopriv_send
|
||||
* - heartbeat_nopriv_tick
|
||||
* @see wp_ajax_nopriv_heartbeat(), wp_ajax_heartbeat()
|
||||
*
|
||||
* Custom jQuery events:
|
||||
* - heartbeat-send
|
||||
* - heartbeat-tick
|
||||
* - heartbeat-error
|
||||
* - heartbeat-connection-lost
|
||||
* - heartbeat-connection-restored
|
||||
* - heartbeat-nonces-expired
|
||||
*
|
||||
* @since 3.6.0
|
||||
*/
|
||||
|
||||
( function( $, window, undefined ) {
|
||||
var Heartbeat = function() {
|
||||
var $document = $(document),
|
||||
settings = {
|
||||
// Suspend/resume
|
||||
suspend: false,
|
||||
|
||||
// Whether suspending is enabled
|
||||
suspendEnabled: true,
|
||||
|
||||
// Current screen id, defaults to the JS global 'pagenow' when present (in the admin) or 'front'
|
||||
screenId: '',
|
||||
|
||||
// XHR request URL, defaults to the JS global 'ajaxurl' when present
|
||||
url: '',
|
||||
|
||||
// Timestamp, start of the last connection request
|
||||
lastTick: 0,
|
||||
|
||||
// Container for the enqueued items
|
||||
queue: {},
|
||||
|
||||
// Connect interval (in seconds)
|
||||
mainInterval: 60,
|
||||
|
||||
// Used when the interval is set to 5 sec. temporarily
|
||||
tempInterval: 0,
|
||||
|
||||
// Used when the interval is reset
|
||||
originalInterval: 0,
|
||||
|
||||
// Used to limit the number of AJAX requests.
|
||||
minimalInterval: 0,
|
||||
|
||||
// Used together with tempInterval
|
||||
countdown: 0,
|
||||
|
||||
// Whether a connection is currently in progress
|
||||
connecting: false,
|
||||
|
||||
// Whether a connection error occurred
|
||||
connectionError: false,
|
||||
|
||||
// Used to track non-critical errors
|
||||
errorcount: 0,
|
||||
|
||||
// Whether at least one connection has completed successfully
|
||||
hasConnected: false,
|
||||
|
||||
// Whether the current browser window is in focus and the user is active
|
||||
hasFocus: true,
|
||||
|
||||
// Timestamp, last time the user was active. Checked every 30 sec.
|
||||
userActivity: 0,
|
||||
|
||||
// Flags whether events tracking user activity were set
|
||||
userActivityEvents: false,
|
||||
|
||||
checkFocusTimer: 0,
|
||||
beatTimer: 0
|
||||
};
|
||||
|
||||
/**
|
||||
* Set local vars and events, then start
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initialize() {
|
||||
var options, hidden, visibilityState, visibilitychange;
|
||||
|
||||
if ( typeof window.pagenow === 'string' ) {
|
||||
settings.screenId = window.pagenow;
|
||||
}
|
||||
|
||||
if ( typeof window.ajaxurl === 'string' ) {
|
||||
settings.url = window.ajaxurl;
|
||||
}
|
||||
|
||||
// Pull in options passed from PHP
|
||||
if ( typeof window.heartbeatSettings === 'object' ) {
|
||||
options = window.heartbeatSettings;
|
||||
|
||||
// The XHR URL can be passed as option when window.ajaxurl is not set
|
||||
if ( ! settings.url && options.ajaxurl ) {
|
||||
settings.url = options.ajaxurl;
|
||||
}
|
||||
|
||||
// The interval can be from 15 to 120 sec. and can be set temporarily to 5 sec.
|
||||
// It can be set in the initial options or changed later from JS and/or from PHP.
|
||||
if ( options.interval ) {
|
||||
settings.mainInterval = options.interval;
|
||||
|
||||
if ( settings.mainInterval < 15 ) {
|
||||
settings.mainInterval = 15;
|
||||
} else if ( settings.mainInterval > 120 ) {
|
||||
settings.mainInterval = 120;
|
||||
}
|
||||
}
|
||||
|
||||
// Used to limit the number of AJAX requests. Overrides all other intervals if they are shorter.
|
||||
// Needed for some hosts that cannot handle frequent requests and the user may exceed the allocated server CPU time, etc.
|
||||
// The minimal interval can be up to 600 sec. however setting it to longer than 120 sec. will limit or disable
|
||||
// some of the functionality (like post locks).
|
||||
// Once set at initialization, minimalInterval cannot be changed/overriden.
|
||||
if ( options.minimalInterval ) {
|
||||
options.minimalInterval = parseInt( options.minimalInterval, 10 );
|
||||
settings.minimalInterval = options.minimalInterval > 0 && options.minimalInterval <= 600 ? options.minimalInterval * 1000 : 0;
|
||||
}
|
||||
|
||||
if ( settings.minimalInterval && settings.mainInterval < settings.minimalInterval ) {
|
||||
settings.mainInterval = settings.minimalInterval;
|
||||
}
|
||||
|
||||
// 'screenId' can be added from settings on the front end where the JS global 'pagenow' is not set
|
||||
if ( ! settings.screenId ) {
|
||||
settings.screenId = options.screenId || 'front';
|
||||
}
|
||||
|
||||
if ( options.suspension === 'disable' ) {
|
||||
settings.suspendEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert to milliseconds
|
||||
settings.mainInterval = settings.mainInterval * 1000;
|
||||
settings.originalInterval = settings.mainInterval;
|
||||
|
||||
// Switch the interval to 120 sec. by using the Page Visibility API.
|
||||
// If the browser doesn't support it (Safari < 7, Android < 4.4, IE < 10), the interval
|
||||
// will be increased to 120 sec. after 5 min. of mouse and keyboard inactivity.
|
||||
if ( typeof document.hidden !== 'undefined' ) {
|
||||
hidden = 'hidden';
|
||||
visibilitychange = 'visibilitychange';
|
||||
visibilityState = 'visibilityState';
|
||||
} else if ( typeof document.msHidden !== 'undefined' ) { // IE10
|
||||
hidden = 'msHidden';
|
||||
visibilitychange = 'msvisibilitychange';
|
||||
visibilityState = 'msVisibilityState';
|
||||
} else if ( typeof document.webkitHidden !== 'undefined' ) { // Android
|
||||
hidden = 'webkitHidden';
|
||||
visibilitychange = 'webkitvisibilitychange';
|
||||
visibilityState = 'webkitVisibilityState';
|
||||
}
|
||||
|
||||
if ( hidden ) {
|
||||
if ( document[hidden] ) {
|
||||
settings.hasFocus = false;
|
||||
}
|
||||
|
||||
$document.on( visibilitychange + '.wp-heartbeat', function() {
|
||||
if ( document[visibilityState] === 'hidden' ) {
|
||||
blurred();
|
||||
window.clearInterval( settings.checkFocusTimer );
|
||||
} else {
|
||||
focused();
|
||||
if ( document.hasFocus ) {
|
||||
settings.checkFocusTimer = window.setInterval( checkFocus, 10000 );
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Use document.hasFocus() if available.
|
||||
if ( document.hasFocus ) {
|
||||
settings.checkFocusTimer = window.setInterval( checkFocus, 10000 );
|
||||
}
|
||||
|
||||
$(window).on( 'unload.wp-heartbeat', function() {
|
||||
// Don't connect any more
|
||||
settings.suspend = true;
|
||||
|
||||
// Abort the last request if not completed
|
||||
if ( settings.xhr && settings.xhr.readyState !== 4 ) {
|
||||
settings.xhr.abort();
|
||||
}
|
||||
});
|
||||
|
||||
// Check for user activity every 30 seconds.
|
||||
window.setInterval( checkUserActivity, 30000 );
|
||||
|
||||
// Start one tick after DOM ready
|
||||
$document.ready( function() {
|
||||
settings.lastTick = time();
|
||||
scheduleNextTick();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current time according to the browser
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function time() {
|
||||
return (new Date()).getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the iframe is from the same origin
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function isLocalFrame( frame ) {
|
||||
var origin, src = frame.src;
|
||||
|
||||
// Need to compare strings as WebKit doesn't throw JS errors when iframes have different origin.
|
||||
// It throws uncatchable exceptions.
|
||||
if ( src && /^https?:\/\//.test( src ) ) {
|
||||
origin = window.location.origin ? window.location.origin : window.location.protocol + '//' + window.location.host;
|
||||
|
||||
if ( src.indexOf( origin ) !== 0 ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if ( frame.contentWindow.document ) {
|
||||
return true;
|
||||
}
|
||||
} catch(e) {}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the document's focus has changed
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function checkFocus() {
|
||||
if ( settings.hasFocus && ! document.hasFocus() ) {
|
||||
blurred();
|
||||
} else if ( ! settings.hasFocus && document.hasFocus() ) {
|
||||
focused();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set error state and fire an event on XHR errors or timeout
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @param string error The error type passed from the XHR
|
||||
* @param int status The HTTP status code passed from jqXHR (200, 404, 500, etc.)
|
||||
* @return void
|
||||
*/
|
||||
function setErrorState( error, status ) {
|
||||
var trigger;
|
||||
|
||||
if ( error ) {
|
||||
switch ( error ) {
|
||||
case 'abort':
|
||||
// do nothing
|
||||
break;
|
||||
case 'timeout':
|
||||
// no response for 30 sec.
|
||||
trigger = true;
|
||||
break;
|
||||
case 'error':
|
||||
if ( 503 === status && settings.hasConnected ) {
|
||||
trigger = true;
|
||||
break;
|
||||
}
|
||||
/* falls through */
|
||||
case 'parsererror':
|
||||
case 'empty':
|
||||
case 'unknown':
|
||||
settings.errorcount++;
|
||||
|
||||
if ( settings.errorcount > 2 && settings.hasConnected ) {
|
||||
trigger = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ( trigger && ! hasConnectionError() ) {
|
||||
settings.connectionError = true;
|
||||
$document.trigger( 'heartbeat-connection-lost', [error, status] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the error state and fire an event
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function clearErrorState() {
|
||||
// Has connected successfully
|
||||
settings.hasConnected = true;
|
||||
|
||||
if ( hasConnectionError() ) {
|
||||
settings.errorcount = 0;
|
||||
settings.connectionError = false;
|
||||
$document.trigger( 'heartbeat-connection-restored' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gather the data and connect to the server
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function connect() {
|
||||
var ajaxData, heartbeatData;
|
||||
|
||||
// If the connection to the server is slower than the interval,
|
||||
// heartbeat connects as soon as the previous connection's response is received.
|
||||
if ( settings.connecting || settings.suspend ) {
|
||||
return;
|
||||
}
|
||||
|
||||
settings.lastTick = time();
|
||||
|
||||
heartbeatData = $.extend( {}, settings.queue );
|
||||
// Clear the data queue, anything added after this point will be send on the next tick
|
||||
settings.queue = {};
|
||||
|
||||
$document.trigger( 'heartbeat-send', [ heartbeatData ] );
|
||||
|
||||
ajaxData = {
|
||||
data: heartbeatData,
|
||||
interval: settings.tempInterval ? settings.tempInterval / 1000 : settings.mainInterval / 1000,
|
||||
_nonce: typeof window.heartbeatSettings === 'object' ? window.heartbeatSettings.nonce : '',
|
||||
action: 'heartbeat',
|
||||
screen_id: settings.screenId,
|
||||
has_focus: settings.hasFocus
|
||||
};
|
||||
|
||||
settings.connecting = true;
|
||||
settings.xhr = $.ajax({
|
||||
url: settings.url,
|
||||
type: 'post',
|
||||
timeout: 30000, // throw an error if not completed after 30 sec.
|
||||
data: ajaxData,
|
||||
dataType: 'json'
|
||||
}).always( function() {
|
||||
settings.connecting = false;
|
||||
scheduleNextTick();
|
||||
}).done( function( response, textStatus, jqXHR ) {
|
||||
var newInterval;
|
||||
|
||||
if ( ! response ) {
|
||||
setErrorState( 'empty' );
|
||||
return;
|
||||
}
|
||||
|
||||
clearErrorState();
|
||||
|
||||
if ( response.nonces_expired ) {
|
||||
$document.trigger( 'heartbeat-nonces-expired' );
|
||||
}
|
||||
|
||||
// Change the interval from PHP
|
||||
if ( response.heartbeat_interval ) {
|
||||
newInterval = response.heartbeat_interval;
|
||||
delete response.heartbeat_interval;
|
||||
}
|
||||
|
||||
$document.trigger( 'heartbeat-tick', [response, textStatus, jqXHR] );
|
||||
|
||||
// Do this last, can trigger the next XHR if connection time > 5 sec. and newInterval == 'fast'
|
||||
if ( newInterval ) {
|
||||
interval( newInterval );
|
||||
}
|
||||
}).fail( function( jqXHR, textStatus, error ) {
|
||||
setErrorState( textStatus || 'unknown', jqXHR.status );
|
||||
$document.trigger( 'heartbeat-error', [jqXHR, textStatus, error] );
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule the next connection
|
||||
*
|
||||
* Fires immediately if the connection time is longer than the interval.
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function scheduleNextTick() {
|
||||
var delta = time() - settings.lastTick,
|
||||
interval = settings.mainInterval;
|
||||
|
||||
if ( settings.suspend ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! settings.hasFocus ) {
|
||||
interval = 120000; // 120 sec. Post locks expire after 150 sec.
|
||||
} else if ( settings.countdown > 0 && settings.tempInterval ) {
|
||||
interval = settings.tempInterval;
|
||||
settings.countdown--;
|
||||
|
||||
if ( settings.countdown < 1 ) {
|
||||
settings.tempInterval = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( settings.minimalInterval && interval < settings.minimalInterval ) {
|
||||
interval = settings.minimalInterval;
|
||||
}
|
||||
|
||||
window.clearTimeout( settings.beatTimer );
|
||||
|
||||
if ( delta < interval ) {
|
||||
settings.beatTimer = window.setTimeout(
|
||||
function() {
|
||||
connect();
|
||||
},
|
||||
interval - delta
|
||||
);
|
||||
} else {
|
||||
connect();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the internal state when the browser window becomes hidden or loses focus
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function blurred() {
|
||||
settings.hasFocus = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the internal state when the browser window becomes visible or is in focus
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function focused() {
|
||||
settings.userActivity = time();
|
||||
|
||||
// Resume if suspended
|
||||
settings.suspend = false;
|
||||
|
||||
if ( ! settings.hasFocus ) {
|
||||
settings.hasFocus = true;
|
||||
scheduleNextTick();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs when the user becomes active after a period of inactivity
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function userIsActive() {
|
||||
settings.userActivityEvents = false;
|
||||
$document.off( '.wp-heartbeat-active' );
|
||||
|
||||
$('iframe').each( function( i, frame ) {
|
||||
if ( isLocalFrame( frame ) ) {
|
||||
$( frame.contentWindow ).off( '.wp-heartbeat-active' );
|
||||
}
|
||||
});
|
||||
|
||||
focused();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for user activity
|
||||
*
|
||||
* Runs every 30 sec.
|
||||
* Sets 'hasFocus = true' if user is active and the window is in the background.
|
||||
* Set 'hasFocus = false' if the user has been inactive (no mouse or keyboard activity)
|
||||
* for 5 min. even when the window has focus.
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function checkUserActivity() {
|
||||
var lastActive = settings.userActivity ? time() - settings.userActivity : 0;
|
||||
|
||||
// Throttle down when no mouse or keyboard activity for 5 min.
|
||||
if ( lastActive > 300000 && settings.hasFocus ) {
|
||||
blurred();
|
||||
}
|
||||
|
||||
// Suspend after 10 min. of inactivity when suspending is enabled.
|
||||
// Always suspend after 60 min. of inactivity. This will release the post lock, etc.
|
||||
if ( ( settings.suspendEnabled && lastActive > 600000 ) || lastActive > 3600000 ) {
|
||||
settings.suspend = true;
|
||||
}
|
||||
|
||||
if ( ! settings.userActivityEvents ) {
|
||||
$document.on( 'mouseover.wp-heartbeat-active keyup.wp-heartbeat-active touchend.wp-heartbeat-active', function() {
|
||||
userIsActive();
|
||||
});
|
||||
|
||||
$('iframe').each( function( i, frame ) {
|
||||
if ( isLocalFrame( frame ) ) {
|
||||
$( frame.contentWindow ).on( 'mouseover.wp-heartbeat-active keyup.wp-heartbeat-active touchend.wp-heartbeat-active', function() {
|
||||
userIsActive();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
settings.userActivityEvents = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Whether the window (or any local iframe in it) has focus, or the user is active
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function hasFocus() {
|
||||
return settings.hasFocus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether there is a connection error
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function hasConnectionError() {
|
||||
return settings.connectionError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect asap regardless of 'hasFocus'
|
||||
*
|
||||
* Will not open two concurrent connections. If a connection is in progress,
|
||||
* will connect again immediately after the current connection completes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function connectNow() {
|
||||
settings.lastTick = 0;
|
||||
scheduleNextTick();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable suspending
|
||||
*
|
||||
* Should be used only when Heartbeat is performing critical tasks like autosave, post-locking, etc.
|
||||
* Using this on many screens may overload the user's hosting account if several
|
||||
* browser windows/tabs are left open for a long time.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function disableSuspend() {
|
||||
settings.suspendEnabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get/Set the interval
|
||||
*
|
||||
* When setting to 'fast' or 5, by default interval is 5 sec. for the next 30 ticks (for 2 min and 30 sec).
|
||||
* In this case the number of 'ticks' can be passed as second argument.
|
||||
* If the window doesn't have focus, the interval slows down to 2 min.
|
||||
*
|
||||
* @param mixed speed Interval: 'fast' or 5, 15, 30, 60, 120
|
||||
* @param string ticks Used with speed = 'fast' or 5, how many ticks before the interval reverts back
|
||||
* @return int Current interval in seconds
|
||||
*/
|
||||
function interval( speed, ticks ) {
|
||||
var newInterval,
|
||||
oldInterval = settings.tempInterval ? settings.tempInterval : settings.mainInterval;
|
||||
|
||||
if ( speed ) {
|
||||
switch ( speed ) {
|
||||
case 'fast':
|
||||
case 5:
|
||||
newInterval = 5000;
|
||||
break;
|
||||
case 15:
|
||||
newInterval = 15000;
|
||||
break;
|
||||
case 30:
|
||||
newInterval = 30000;
|
||||
break;
|
||||
case 60:
|
||||
newInterval = 60000;
|
||||
break;
|
||||
case 120:
|
||||
newInterval = 120000;
|
||||
break;
|
||||
case 'long-polling':
|
||||
// Allow long polling, (experimental)
|
||||
settings.mainInterval = 0;
|
||||
return 0;
|
||||
default:
|
||||
newInterval = settings.originalInterval;
|
||||
}
|
||||
|
||||
if ( settings.minimalInterval && newInterval < settings.minimalInterval ) {
|
||||
newInterval = settings.minimalInterval;
|
||||
}
|
||||
|
||||
if ( 5000 === newInterval ) {
|
||||
ticks = parseInt( ticks, 10 ) || 30;
|
||||
ticks = ticks < 1 || ticks > 30 ? 30 : ticks;
|
||||
|
||||
settings.countdown = ticks;
|
||||
settings.tempInterval = newInterval;
|
||||
} else {
|
||||
settings.countdown = 0;
|
||||
settings.tempInterval = 0;
|
||||
settings.mainInterval = newInterval;
|
||||
}
|
||||
|
||||
// Change the next connection time if new interval has been set.
|
||||
// Will connect immediately if the time since the last connection
|
||||
// is greater than the new interval.
|
||||
if ( newInterval !== oldInterval ) {
|
||||
scheduleNextTick();
|
||||
}
|
||||
}
|
||||
|
||||
return settings.tempInterval ? settings.tempInterval / 1000 : settings.mainInterval / 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue data to send with the next XHR
|
||||
*
|
||||
* As the data is send asynchronously, this function doesn't return the XHR response.
|
||||
* To see the response, use the custom jQuery event 'heartbeat-tick' on the document, example:
|
||||
* $(document).on( 'heartbeat-tick.myname', function( event, data, textStatus, jqXHR ) {
|
||||
* // code
|
||||
* });
|
||||
* If the same 'handle' is used more than once, the data is not overwritten when the third argument is 'true'.
|
||||
* Use wp.heartbeat.isQueued('handle') to see if any data is already queued for that handle.
|
||||
*
|
||||
* $param string handle Unique handle for the data. The handle is used in PHP to receive the data.
|
||||
* $param mixed data The data to send.
|
||||
* $param bool noOverwrite Whether to overwrite existing data in the queue.
|
||||
* $return bool Whether the data was queued or not.
|
||||
*/
|
||||
function enqueue( handle, data, noOverwrite ) {
|
||||
if ( handle ) {
|
||||
if ( noOverwrite && this.isQueued( handle ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
settings.queue[handle] = data;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if data with a particular handle is queued
|
||||
*
|
||||
* $param string handle The handle for the data
|
||||
* $return bool Whether some data is queued with this handle
|
||||
*/
|
||||
function isQueued( handle ) {
|
||||
if ( handle ) {
|
||||
return settings.queue.hasOwnProperty( handle );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove data with a particular handle from the queue
|
||||
*
|
||||
* $param string handle The handle for the data
|
||||
* $return void
|
||||
*/
|
||||
function dequeue( handle ) {
|
||||
if ( handle ) {
|
||||
delete settings.queue[handle];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data that was enqueued with a particular handle
|
||||
*
|
||||
* $param string handle The handle for the data
|
||||
* $return mixed The data or undefined
|
||||
*/
|
||||
function getQueuedItem( handle ) {
|
||||
if ( handle ) {
|
||||
return this.isQueued( handle ) ? settings.queue[handle] : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
initialize();
|
||||
|
||||
// Expose public methods
|
||||
return {
|
||||
hasFocus: hasFocus,
|
||||
connectNow: connectNow,
|
||||
disableSuspend: disableSuspend,
|
||||
interval: interval,
|
||||
hasConnectionError: hasConnectionError,
|
||||
enqueue: enqueue,
|
||||
dequeue: dequeue,
|
||||
isQueued: isQueued,
|
||||
getQueuedItem: getQueuedItem
|
||||
};
|
||||
};
|
||||
|
||||
// Ensure the global `wp` object exists.
|
||||
window.wp = window.wp || {};
|
||||
window.wp.heartbeat = new Heartbeat();
|
||||
|
||||
}( jQuery, window ));
|
||||
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/heartbeat.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/heartbeat.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
115
Kapitel_7/Lektion_4/wordpress/wp-includes/js/hoverIntent.js
Executable file
115
Kapitel_7/Lektion_4/wordpress/wp-includes/js/hoverIntent.js
Executable file
@@ -0,0 +1,115 @@
|
||||
/*!
|
||||
* hoverIntent v1.8.1 // 2014.08.11 // jQuery v1.9.1+
|
||||
* http://cherne.net/brian/resources/jquery.hoverIntent.html
|
||||
*
|
||||
* You may use hoverIntent under the terms of the MIT license. Basically that
|
||||
* means you are free to use hoverIntent as long as this header is left intact.
|
||||
* Copyright 2007, 2014 Brian Cherne
|
||||
*/
|
||||
|
||||
/* hoverIntent is similar to jQuery's built-in "hover" method except that
|
||||
* instead of firing the handlerIn function immediately, hoverIntent checks
|
||||
* to see if the user's mouse has slowed down (beneath the sensitivity
|
||||
* threshold) before firing the event. The handlerOut function is only
|
||||
* called after a matching handlerIn.
|
||||
*
|
||||
* // basic usage ... just like .hover()
|
||||
* .hoverIntent( handlerIn, handlerOut )
|
||||
* .hoverIntent( handlerInOut )
|
||||
*
|
||||
* // basic usage ... with event delegation!
|
||||
* .hoverIntent( handlerIn, handlerOut, selector )
|
||||
* .hoverIntent( handlerInOut, selector )
|
||||
*
|
||||
* // using a basic configuration object
|
||||
* .hoverIntent( config )
|
||||
*
|
||||
* @param handlerIn function OR configuration object
|
||||
* @param handlerOut function OR selector for delegation OR undefined
|
||||
* @param selector selector OR undefined
|
||||
* @author Brian Cherne <brian(at)cherne(dot)net>
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.hoverIntent = function(handlerIn,handlerOut,selector) {
|
||||
|
||||
// default configuration values
|
||||
var cfg = {
|
||||
interval: 100,
|
||||
sensitivity: 6,
|
||||
timeout: 0
|
||||
};
|
||||
|
||||
if ( typeof handlerIn === "object" ) {
|
||||
cfg = $.extend(cfg, handlerIn );
|
||||
} else if ($.isFunction(handlerOut)) {
|
||||
cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector } );
|
||||
} else {
|
||||
cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } );
|
||||
}
|
||||
|
||||
// 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.sqrt( (pX-cX)*(pX-cX) + (pY-cY)*(pY-cY) ) < cfg.sensitivity ) {
|
||||
$(ob).off("mousemove.hoverIntent",track);
|
||||
// set hoverIntent state to true (so mouseOut can be called)
|
||||
ob.hoverIntent_s = true;
|
||||
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 = false;
|
||||
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 = $.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).on("mousemove.hoverIntent",track);
|
||||
// start polling interval (self-calling timeout) to compare mouse coordinates over time
|
||||
if (!ob.hoverIntent_s) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
|
||||
|
||||
// else e.type == "mouseleave"
|
||||
} else {
|
||||
// unbind expensive mousemove event
|
||||
$(ob).off("mousemove.hoverIntent",track);
|
||||
// if hoverIntent state is true, then call the mouseOut function after the specified delay
|
||||
if (ob.hoverIntent_s) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
|
||||
}
|
||||
};
|
||||
|
||||
// listen for mouseenter and mouseleave
|
||||
return this.on({'mouseenter.hoverIntent':handleHover,'mouseleave.hoverIntent':handleHover}, cfg.selector);
|
||||
};
|
||||
})(jQuery);
|
||||
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/hoverIntent.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/hoverIntent.min.js
vendored
Executable file
@@ -0,0 +1 @@
|
||||
!function(a){a.fn.hoverIntent=function(b,c,d){var e={interval:100,sensitivity:6,timeout:0};e="object"==typeof b?a.extend(e,b):a.isFunction(c)?a.extend(e,{over:b,out:c,selector:d}):a.extend(e,{over:b,out:b,selector:c});var f,g,h,i,j=function(a){f=a.pageX,g=a.pageY},k=function(b,c){return c.hoverIntent_t=clearTimeout(c.hoverIntent_t),Math.sqrt((h-f)*(h-f)+(i-g)*(i-g))<e.sensitivity?(a(c).off("mousemove.hoverIntent",j),c.hoverIntent_s=!0,e.over.apply(c,[b])):(h=f,i=g,c.hoverIntent_t=setTimeout(function(){k(b,c)},e.interval),void 0)},l=function(a,b){return b.hoverIntent_t=clearTimeout(b.hoverIntent_t),b.hoverIntent_s=!1,e.out.apply(b,[a])},m=function(b){var c=a.extend({},b),d=this;d.hoverIntent_t&&(d.hoverIntent_t=clearTimeout(d.hoverIntent_t)),"mouseenter"===b.type?(h=c.pageX,i=c.pageY,a(d).on("mousemove.hoverIntent",j),d.hoverIntent_s||(d.hoverIntent_t=setTimeout(function(){k(c,d)},e.interval))):(a(d).off("mousemove.hoverIntent",j),d.hoverIntent_s&&(d.hoverIntent_t=setTimeout(function(){l(c,d)},e.timeout)))};return this.on({"mouseenter.hoverIntent":m,"mouseleave.hoverIntent":m},e.selector)}}(jQuery);
|
||||
BIN
Kapitel_7/Lektion_4/wordpress/wp-includes/js/imgareaselect/border-anim-h.gif
Executable file
BIN
Kapitel_7/Lektion_4/wordpress/wp-includes/js/imgareaselect/border-anim-h.gif
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 178 B |
BIN
Kapitel_7/Lektion_4/wordpress/wp-includes/js/imgareaselect/border-anim-v.gif
Executable file
BIN
Kapitel_7/Lektion_4/wordpress/wp-includes/js/imgareaselect/border-anim-v.gif
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 178 B |
41
Kapitel_7/Lektion_4/wordpress/wp-includes/js/imgareaselect/imgareaselect.css
Executable file
41
Kapitel_7/Lektion_4/wordpress/wp-includes/js/imgareaselect/imgareaselect.css
Executable 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 {
|
||||
}
|
||||
1232
Kapitel_7/Lektion_4/wordpress/wp-includes/js/imgareaselect/jquery.imgareaselect.js
Executable file
1232
Kapitel_7/Lektion_4/wordpress/wp-includes/js/imgareaselect/jquery.imgareaselect.js
Executable file
File diff suppressed because it is too large
Load Diff
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/imgareaselect/jquery.imgareaselect.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/imgareaselect/jquery.imgareaselect.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
BIN
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jcrop/Jcrop.gif
Executable file
BIN
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jcrop/Jcrop.gif
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 323 B |
29
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jcrop/jquery.Jcrop.min.css
vendored
Executable file
29
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jcrop/jquery.Jcrop.min.css
vendored
Executable file
@@ -0,0 +1,29 @@
|
||||
/* jquery.Jcrop.min.css v0.9.12 (build:20130521) */
|
||||
.jcrop-holder{-ms-touch-action:none;direction:ltr;text-align:left;}
|
||||
.jcrop-vline,.jcrop-hline{background:#FFF url(Jcrop.gif);font-size:0;position:absolute;}
|
||||
.jcrop-vline{height:100%;width:1px!important;}
|
||||
.jcrop-vline.right{right:0;}
|
||||
.jcrop-hline{height:1px!important;width:100%;}
|
||||
.jcrop-hline.bottom{bottom:0;}
|
||||
.jcrop-tracker{-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;height:100%;width:100%;}
|
||||
.jcrop-handle{background-color:#333;border:1px #EEE solid;font-size:1px;height:7px;width:7px;}
|
||||
.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;}
|
||||
.solid-line .jcrop-vline,.solid-line .jcrop-hline{background:#FFF;}
|
||||
.jcrop-holder img,img.jcrop-preview{max-width:none;}
|
||||
22
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jcrop/jquery.Jcrop.min.js
vendored
Executable file
22
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jcrop/jquery.Jcrop.min.js
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* jquery.Jcrop.min.js v0.9.12 (build:20130202)
|
||||
* jQuery Image Cropping Plugin - released under MIT License
|
||||
* Copyright (c) 2008-2013 Tapmodo Interactive LLC
|
||||
* https://github.com/tapmodo/Jcrop
|
||||
*/
|
||||
(function(a){a.Jcrop=function(b,c){function i(a){return Math.round(a)+"px"}function j(a){return d.baseClass+"-"+a}function k(){return a.fx.step.hasOwnProperty("backgroundColor")}function l(b){var c=a(b).offset();return[c.left,c.top]}function m(a){return[a.pageX-e[0],a.pageY-e[1]]}function n(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 o(a,b,c){e=l(D),bc.setCursor(a==="move"?a:a+"-resize");if(a==="move")return bc.activateHandlers(q(b),v,c);var d=_.getFixed(),f=r(a),g=_.getCorner(r(f));_.setPressed(_.getCorner(f)),_.setCurrent(g),bc.activateHandlers(p(a,d),v,c)}function p(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}_.setCurrent(c),bb.update()}}function q(a){var b=a;return bd.watchKeys
|
||||
(),function(a){_.moveOffset([a[0]-b[0],a[1]-b[1]]),b=a,bb.update()}}function r(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 s(a){return function(b){return d.disabled?!1:a==="move"&&!d.allowMove?!1:(e=l(D),W=!0,o(a,m(b)),b.stopPropagation(),b.preventDefault(),!1)}}function t(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()),T=a.width()/d,U=a.height()/e,a.width(d).height(e)}function u(a){return{x:a.x*T,y:a.y*U,x2:a.x2*T,y2:a.y2*U,w:a.w*T,h:a.h*U}}function v(a){var b=_.getFixed();b.w>d.minSelect[0]&&b.h>d.minSelect[1]?(bb.enableHandles(),bb.done()):bb.release(),bc.setCursor(d.allowSelect?"crosshair":"default")}function w(a){if(d.disabled)return!1;if(!d.allowSelect)return!1;W=!0,e=l(D),bb.disableHandles(),bc.setCursor("crosshair");var b=m(a);return _.setPressed(b),bb.update(),bc.activateHandlers(x,v,a.type.substring
|
||||
(0,5)==="touch"),bd.watchKeys(),a.stopPropagation(),a.preventDefault(),!1}function x(a){_.setCurrent(a),bb.update()}function y(){var b=a("<div></div>").addClass(j("tracker"));return g&&b.css({opacity:0,backgroundColor:"white"}),b}function be(a){G.removeClass().addClass(j("holder")).addClass(a)}function bf(a,b){function t(){window.setTimeout(u,l)}var c=a[0]/T,e=a[1]/U,f=a[2]/T,g=a[3]/U;if(X)return;var h=_.flipCoords(c,e,f,g),i=_.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;c=k[0],e=k[1],f=k[2],g=k[3],bb.animMode(!0);var s,u=function(){return function(){q+=(100-q)/r,k[0]=Math.round(c+q/100*m),k[1]=Math.round(e+q/100*n),k[2]=Math.round(f+q/100*o),k[3]=Math.round(g+q/100*p),q>=99.8&&(q=100),q<100?(bh(k),t()):(bb.done(),bb.animMode(!1),typeof b=="function"&&b.call(bs))}}();t()}function bg(a){bh([a[0]/T,a[1]/U,a[2]/T,a[3]/U]),d.onSelect.call(bs,u(_.getFixed())),bb.enableHandles()}function bh(a){_.setPressed([a[0],a[1]]),_.setCurrent([a[2],
|
||||
a[3]]),bb.update()}function bi(){return u(_.getFixed())}function bj(){return _.getFixed()}function bk(a){n(a),br()}function bl(){d.disabled=!0,bb.disableHandles(),bb.setCursor("default"),bc.setCursor("default")}function bm(){d.disabled=!1,br()}function bn(){bb.done(),bc.activateHandlers(null,null)}function bo(){G.remove(),A.show(),A.css("visibility","visible"),a(b).removeData("Jcrop")}function bp(a,b){bb.release(),bl();var c=new Image;c.onload=function(){var e=c.width,f=c.height,g=d.boxWidth,h=d.boxHeight;D.width(e).height(f),D.attr("src",a),H.attr("src",a),t(D,g,h),E=D.width(),F=D.height(),H.width(E).height(F),M.width(E+L*2).height(F+L*2),G.width(E).height(F),ba.resize(E,F),bm(),typeof b=="function"&&b.call(bs)},c.src=a}function bq(a,b,c){var e=b||d.bgColor;d.bgFade&&k()&&d.fadeTime&&!c?a.animate({backgroundColor:e},{queue:!1,duration:d.fadeTime}):a.css("backgroundColor",e)}function br(a){d.allowResize?a?bb.enableOnly():bb.enableHandles():bb.disableHandles(),bc.setCursor(d.allowSelect?"crosshair":"default"),bb
|
||||
.setCursor(d.allowMove?"move":"default"),d.hasOwnProperty("trueSize")&&(T=d.trueSize[0]/E,U=d.trueSize[1]/F),d.hasOwnProperty("setSelect")&&(bg(d.setSelect),bb.done(),delete d.setSelect),ba.refresh(),d.bgColor!=N&&(bq(d.shade?ba.getShades():G,d.shade?d.shadeColor||d.bgColor:d.bgColor),N=d.bgColor),O!=d.bgOpacity&&(O=d.bgOpacity,d.shade?ba.refresh():bb.setBgOpacity(O)),P=d.maxSize[0]||0,Q=d.maxSize[1]||0,R=d.minSize[0]||0,S=d.minSize[1]||0,d.hasOwnProperty("outerImage")&&(D.attr("src",d.outerImage),delete d.outerImage),bb.refresh()}var d=a.extend({},a.Jcrop.defaults),e,f=navigator.userAgent.toLowerCase(),g=/msie/.test(f),h=/msie [1-6]\./.test(f);typeof b!="object"&&(b=a(b)[0]),typeof c!="object"&&(c={}),n(c);var z={border:"none",visibility:"visible",margin:0,padding:0,position:"absolute",top:0,left:0},A=a(b),B=!0;if(b.tagName=="IMG"){if(A[0].width!=0&&A[0].height!=0)A.width(A[0].width),A.height(A[0].height);else{var C=new Image;C.src=A[0].src,A.width(C.width),A.height(C.height)}var D=A.clone().removeAttr("id").
|
||||
css(z).show();D.width(A.width()),D.height(A.height()),A.after(D).hide()}else D=A.css(z).show(),B=!1,d.shade===null&&(d.shade=!0);t(D,d.boxWidth,d.boxHeight);var E=D.width(),F=D.height(),G=a("<div />").width(E).height(F).addClass(j("holder")).css({position:"relative",backgroundColor:d.bgColor}).insertAfter(A).append(D);d.addClass&&G.addClass(d.addClass);var H=a("<div />"),I=a("<div />").width("100%").height("100%").css({zIndex:310,position:"absolute",overflow:"hidden"}),J=a("<div />").width("100%").height("100%").css("zIndex",320),K=a("<div />").css({position:"absolute",zIndex:600}).dblclick(function(){var a=_.getFixed();d.onDblClick.call(bs,a)}).insertBefore(D).append(I,J);B&&(H=a("<img />").attr("src",D.attr("src")).css(z).width(E).height(F),I.append(H)),h&&K.css({overflowY:"hidden"});var L=d.boundary,M=y().width(E+L*2).height(F+L*2).css({position:"absolute",top:i(-L),left:i(-L),zIndex:290}).mousedown(w),N=d.bgColor,O=d.bgOpacity,P,Q,R,S,T,U,V=!0,W,X,Y;e=l(D);var Z=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 d.disabled?!1:a==="move"&&!d.allowMove?!1:(e=l(D),W=!0,o(a,m(Z.cfilter(b)),!0),b.stopPropagation(),b.preventDefault(),!1)}},newSelection:function(a){return w(Z.cfilter(a))},cfilter:function(a){return a.pageX=a.originalEvent.changedTouches[0].pageX,a.pageY=a.originalEvent.changedTouches[0].pageY,a},isSupported:a,support:b()}}(),_=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),F<e+g&&(g+=F-(e+g)),E<c+f&&(f+=E-(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]/T,h=d.maxSize[0]/T,i=d.maxSize[1]/U,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=E*10),i===0&&(i=F*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>E&&(r=E,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>F&&(s=F,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>E&&(a-=r-E,r=E),s<0?(b-=s,s=0):s>F&&(b-=s-F,s=F),q(o(a,b,r,s))}function n(a){return a[0]<0&&(a[0]=0),a[1]<0&&(a[1]=0),a[0]>E&&(a[0]=E),a[1]>F&&(a[1]=F),[Math.round(a[0]),Math.round(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 P&&Math.abs(d)>P&&(c=d>0?a+P:a-P),Q&&Math.abs
|
||||
(f)>Q&&(e=f>0?b+Q:b-Q),S/U&&Math.abs(f)<S/U&&(e=f>0?b+S/U:b-S/U),R/T&&Math.abs(d)<R/T&&(c=d>0?a+R/T:a-R/T),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>E&&(g=c-E,a-=g,c-=g),e>F&&(g=e-F,b-=g,e-=g),a>E&&(g=a-F,e-=g,b-=g),b>F&&(g=b-F,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}}(),ba=function(){function f(a,b){e.left.css({height:i(b)}),e.right.css({height:i(b)})}function g(){return h(_.getFixed())}function h(a){e.top.css({left:i(a.x),width:i(a.w),height:i(a.y)}),e.bottom.css({top:i(a.y2),left:i(a.x),width:i(a.w),height:i(F-a.y2)}),e.right.css({left:i(a.x2),width:i(E-a.x2)}),e.left.css({width:i(a.x)})}function j(){return a("<div />").css({position:"absolute",backgroundColor:d.shadeColor||d.bgColor}).appendTo(c)}function k(){b||(b=!0,c.insertBefore(D),g(),bb.setBgOpacity(1,0,1),H.hide(),l(d.shadeColor||d.bgColor,1),bb.
|
||||
isAwake()?n(d.bgOpacity,1):n(1,1))}function l(a,b){bq(p(),a,b)}function m(){b&&(c.remove(),H.show(),b=!1,bb.isAwake()?bb.setBgOpacity(d.bgOpacity,1,1):(bb.setBgOpacity(1,1,1),bb.disableHandles()),bq(G,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(),bb.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(F),right:j().height(F),bottom:j()};return{update:g,updateRaw:h,getShades:p,setBgColor:l,enable:k,disable:m,resize:f,refresh:o,opacity:n}}(),bb=function(){function k(b){var c=a("<div />").css({position:"absolute",opacity:d.borderOpacity}).addClass(j(b));return I.append(c),c}function l(b,c){var d=a("<div />").mousedown(s(b)).css({cursor:b+"-resize",position:"absolute",zIndex:c}).addClass("ord-"+b);return Z.support&&d.bind("touchstart.jcrop",Z.createDragger(b)),J.append(d),d}function m(a){var b=d.handleSize,e=l(a,c++
|
||||
).css({opacity:d.handleOpacity}).addClass(j("handle"));return b&&e.width(b).height(b),e}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 r(a,b){d.shade||H.css({top:i(-b),left:i(-a)}),K.css({top:i(b),left:i(a)})}function t(a,b){K.width(Math.round(a)).height(Math.round(b))}function v(){var a=_.getFixed();_.setPressed([a.x,a.y]),_.setCurrent([a.x2,a.y2]),w()}function w(a){if(b)return x(a)}function x(a){var c=_.getFixed();t(c.w,c.h),r(c.x,c.y),d.shade&&ba.updateRaw(c),b||A(),a?d.onSelect.call(bs,u(c)):d.onChange.call(bs,u(c))}function z(a,c,e){if(!b&&!c)return;d.bgFade&&!e?D.animate({opacity:a},{queue:!1,duration:d.fadeTime}):D.css("opacity",a)}function A(){K.show(),d.shade?ba.opacity(O):z(O,!0),b=!0}function B
|
||||
(){F(),K.hide(),d.shade?ba.opacity(1):z(1),b=!1,d.onRelease.call(bs)}function C(){h&&J.show()}function E(){h=!0;if(d.allowResize)return J.show(),!0}function F(){h=!1,J.hide()}function G(a){a?(X=!0,F()):(X=!1,E())}function L(){G(!1),v()}var b,c=370,e={},f={},g={},h=!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=y().mousedown(s("move")).css({cursor:"move",position:"absolute",zIndex:360});return Z.support&&M.bind("touchstart.jcrop",Z.createDragger("move")),I.append(M),F(),{updateVisible:w,update:x,release:B,refresh:v,isAwake:function(){return b},setCursor:function(a){M.css("cursor",a)},enableHandles:E,enableOnly:function(){h=!0},showHandles:C,disableHandles:F,animMode:G,setBgOpacity:z,done:L}}(),bc=function(){function f(b){M.css({zIndex:450}),b?a(document).bind("touchmove.jcrop"
|
||||
,k).bind("touchend.jcrop",l):e&&a(document).bind("mousemove.jcrop",h).bind("mouseup.jcrop",i)}function g(){M.css({zIndex:290}),a(document).unbind(".jcrop")}function h(a){return b(m(a)),!1}function i(a){return a.preventDefault(),a.stopPropagation(),W&&(W=!1,c(m(a)),bb.isAwake()&&d.onSelect.call(bs,u(_.getFixed())),g(),b=function(){},c=function(){}),!1}function j(a,d,e){return W=!0,b=a,c=d,f(e),!1}function k(a){return b(m(Z.cfilter(a))),!1}function l(a){return i(Z.cfilter(a))}function n(a){M.css("cursor",a)}var b=function(){},c=function(){},e=d.trackDocument;return e||M.mousemove(h).mouseup(i).mouseout(i),D.before(M),{activateHandlers:j,setCursor:n}}(),bd=function(){function e(){d.keySupport&&(b.show(),b.focus())}function f(a){b.hide()}function g(a,b,c){d.allowMove&&(_.moveOffset([b,c]),bb.updateVisible(!0)),a.preventDefault(),a.stopPropagation()}function i(a){if(a.ctrlKey||a.metaKey)return!0;Y=a.shiftKey?!0:!1;var b=Y?10:1;switch(a.keyCode){case 37:g(a,-b,0);break;case 39:g(a,b,0);break;case 38:g(a,0,-b);break;
|
||||
case 40:g(a,0,b);break;case 27:d.allowSelect&&bb.release();break;case 9:return!0}return!1}var b=a('<input type="radio" />').css({position:"fixed",left:"-120px",width:"12px"}).addClass("jcrop-keymgr"),c=a("<div />").css({position:"absolute",overflow:"hidden"}).append(b);return d.keySupport&&(b.keydown(i).blur(f),h||!d.fixedSupport?(b.css({position:"absolute",left:"-20px"}),c.append(b).insertBefore(D)):b.insertBefore(D)),{watchKeys:e}}();Z.support&&M.bind("touchstart.jcrop",Z.newSelection),J.hide(),br(!0);var bs={setImage:bp,animateTo:bf,setSelect:bg,setOptions:bk,tellSelect:bi,tellScaled:bj,setClass:be,disable:bl,enable:bm,cancel:bn,release:bb.release,destroy:bo,focus:bd.watchKeys,getBounds:function(){return[E*T,F*U]},getWidgetSize:function(){return[E,F]},getScaleFactor:function(){return[T,U]},getOptions:function(){return d},ui:{holder:G,selection:K}};return g&&G.bind("selectstart",function(){return!1}),A.data("Jcrop",bs),bs},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:null,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);
|
||||
752
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery-migrate.js
vendored
Executable file
752
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery-migrate.js
vendored
Executable file
@@ -0,0 +1,752 @@
|
||||
/*!
|
||||
* jQuery Migrate - v1.4.1 - 2016-05-19
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
*/
|
||||
(function( jQuery, window, undefined ) {
|
||||
// See http://bugs.jquery.com/ticket/13335
|
||||
// "use strict";
|
||||
|
||||
|
||||
jQuery.migrateVersion = "1.4.1";
|
||||
|
||||
|
||||
var warnedAbout = {};
|
||||
|
||||
// List of warnings already given; public read only
|
||||
jQuery.migrateWarnings = [];
|
||||
|
||||
// Set to true to prevent console output; migrateWarnings still maintained
|
||||
// jQuery.migrateMute = false;
|
||||
|
||||
// Show a message on the console so devs know we're active
|
||||
if ( window.console && window.console.log ) {
|
||||
window.console.log( "JQMIGRATE: Migrate is installed" +
|
||||
( jQuery.migrateMute ? "" : " with logging active" ) +
|
||||
", version " + jQuery.migrateVersion );
|
||||
}
|
||||
|
||||
// Set to false to disable traces that appear with warnings
|
||||
if ( jQuery.migrateTrace === undefined ) {
|
||||
jQuery.migrateTrace = true;
|
||||
}
|
||||
|
||||
// Forget any warnings we've already given; public
|
||||
jQuery.migrateReset = function() {
|
||||
warnedAbout = {};
|
||||
jQuery.migrateWarnings.length = 0;
|
||||
};
|
||||
|
||||
function migrateWarn( msg) {
|
||||
var console = window.console;
|
||||
if ( !warnedAbout[ msg ] ) {
|
||||
warnedAbout[ msg ] = true;
|
||||
jQuery.migrateWarnings.push( msg );
|
||||
if ( console && console.warn && !jQuery.migrateMute ) {
|
||||
console.warn( "JQMIGRATE: " + msg );
|
||||
if ( jQuery.migrateTrace && console.trace ) {
|
||||
console.trace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function migrateWarnProp( obj, prop, value, msg ) {
|
||||
if ( Object.defineProperty ) {
|
||||
// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
|
||||
// allow property to be overwritten in case some other plugin wants it
|
||||
try {
|
||||
Object.defineProperty( obj, prop, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
migrateWarn( msg );
|
||||
return value;
|
||||
},
|
||||
set: function( newValue ) {
|
||||
migrateWarn( msg );
|
||||
value = newValue;
|
||||
}
|
||||
});
|
||||
return;
|
||||
} catch( err ) {
|
||||
// IE8 is a dope about Object.defineProperty, can't warn there
|
||||
}
|
||||
}
|
||||
|
||||
// Non-ES5 (or broken) browser; just set the property
|
||||
jQuery._definePropertyBroken = true;
|
||||
obj[ prop ] = value;
|
||||
}
|
||||
|
||||
if ( document.compatMode === "BackCompat" ) {
|
||||
// jQuery has never supported or tested Quirks Mode
|
||||
migrateWarn( "jQuery is not compatible with Quirks Mode" );
|
||||
}
|
||||
|
||||
|
||||
var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
|
||||
oldAttr = jQuery.attr,
|
||||
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
|
||||
function() { return null; },
|
||||
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
|
||||
function() { return undefined; },
|
||||
rnoType = /^(?:input|button)$/i,
|
||||
rnoAttrNodeType = /^[238]$/,
|
||||
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
|
||||
ruseDefault = /^(?:checked|selected)$/i;
|
||||
|
||||
// jQuery.attrFn
|
||||
migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
|
||||
|
||||
jQuery.attr = function( elem, name, value, pass ) {
|
||||
var lowerName = name.toLowerCase(),
|
||||
nType = elem && elem.nodeType;
|
||||
|
||||
if ( pass ) {
|
||||
// Since pass is used internally, we only warn for new jQuery
|
||||
// versions where there isn't a pass arg in the formal params
|
||||
if ( oldAttr.length < 4 ) {
|
||||
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
|
||||
}
|
||||
if ( elem && !rnoAttrNodeType.test( nType ) &&
|
||||
(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
|
||||
return jQuery( elem )[ name ]( value );
|
||||
}
|
||||
}
|
||||
|
||||
// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
|
||||
// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
|
||||
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
|
||||
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
|
||||
}
|
||||
|
||||
// Restore boolHook for boolean property/attribute synchronization
|
||||
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
|
||||
jQuery.attrHooks[ lowerName ] = {
|
||||
get: function( elem, name ) {
|
||||
// Align boolean attributes with corresponding properties
|
||||
// Fall back to attribute presence where some booleans are not supported
|
||||
var attrNode,
|
||||
property = jQuery.prop( elem, name );
|
||||
return property === true || typeof property !== "boolean" &&
|
||||
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
|
||||
|
||||
name.toLowerCase() :
|
||||
undefined;
|
||||
},
|
||||
set: function( elem, value, name ) {
|
||||
var propName;
|
||||
if ( value === false ) {
|
||||
// Remove boolean attributes when set to false
|
||||
jQuery.removeAttr( elem, name );
|
||||
} else {
|
||||
// value is true since we know at this point it's type boolean and not false
|
||||
// Set boolean attributes to the same name and set the DOM property
|
||||
propName = jQuery.propFix[ name ] || name;
|
||||
if ( propName in elem ) {
|
||||
// Only set the IDL specifically if it already exists on the element
|
||||
elem[ propName ] = true;
|
||||
}
|
||||
|
||||
elem.setAttribute( name, name.toLowerCase() );
|
||||
}
|
||||
return name;
|
||||
}
|
||||
};
|
||||
|
||||
// Warn only for attributes that can remain distinct from their properties post-1.9
|
||||
if ( ruseDefault.test( lowerName ) ) {
|
||||
migrateWarn( "jQuery.fn.attr('" + lowerName + "') might use property instead of attribute" );
|
||||
}
|
||||
}
|
||||
|
||||
return oldAttr.call( jQuery, elem, name, value );
|
||||
};
|
||||
|
||||
// attrHooks: value
|
||||
jQuery.attrHooks.value = {
|
||||
get: function( elem, name ) {
|
||||
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
||||
if ( nodeName === "button" ) {
|
||||
return valueAttrGet.apply( this, arguments );
|
||||
}
|
||||
if ( nodeName !== "input" && nodeName !== "option" ) {
|
||||
migrateWarn("jQuery.fn.attr('value') no longer gets properties");
|
||||
}
|
||||
return name in elem ?
|
||||
elem.value :
|
||||
null;
|
||||
},
|
||||
set: function( elem, value ) {
|
||||
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
||||
if ( nodeName === "button" ) {
|
||||
return valueAttrSet.apply( this, arguments );
|
||||
}
|
||||
if ( nodeName !== "input" && nodeName !== "option" ) {
|
||||
migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
|
||||
}
|
||||
// Does not return so that setAttribute is also used
|
||||
elem.value = value;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var matched, browser,
|
||||
oldInit = jQuery.fn.init,
|
||||
oldFind = jQuery.find,
|
||||
oldParseJSON = jQuery.parseJSON,
|
||||
rspaceAngle = /^\s*</,
|
||||
rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
|
||||
rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,
|
||||
// Note: XSS check is done below after string is trimmed
|
||||
rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
|
||||
|
||||
// $(html) "looks like html" rule change
|
||||
jQuery.fn.init = function( selector, context, rootjQuery ) {
|
||||
var match, ret;
|
||||
|
||||
if ( selector && typeof selector === "string" ) {
|
||||
if ( !jQuery.isPlainObject( context ) &&
|
||||
(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
|
||||
|
||||
// This is an HTML string according to the "old" rules; is it still?
|
||||
if ( !rspaceAngle.test( selector ) ) {
|
||||
migrateWarn("$(html) HTML strings must start with '<' character");
|
||||
}
|
||||
if ( match[ 3 ] ) {
|
||||
migrateWarn("$(html) HTML text after last tag is ignored");
|
||||
}
|
||||
|
||||
// Consistently reject any HTML-like string starting with a hash (gh-9521)
|
||||
// Note that this may break jQuery 1.6.x code that otherwise would work.
|
||||
if ( match[ 0 ].charAt( 0 ) === "#" ) {
|
||||
migrateWarn("HTML string cannot start with a '#' character");
|
||||
jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
|
||||
}
|
||||
|
||||
// Now process using loose rules; let pre-1.8 play too
|
||||
// Is this a jQuery context? parseHTML expects a DOM element (#178)
|
||||
if ( context && context.context && context.context.nodeType ) {
|
||||
context = context.context;
|
||||
}
|
||||
|
||||
if ( jQuery.parseHTML ) {
|
||||
return oldInit.call( this,
|
||||
jQuery.parseHTML( match[ 2 ], context && context.ownerDocument ||
|
||||
context || document, true ), context, rootjQuery );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = oldInit.apply( this, arguments );
|
||||
|
||||
// Fill in selector and context properties so .live() works
|
||||
if ( selector && selector.selector !== undefined ) {
|
||||
// A jQuery object, copy its properties
|
||||
ret.selector = selector.selector;
|
||||
ret.context = selector.context;
|
||||
|
||||
} else {
|
||||
ret.selector = typeof selector === "string" ? selector : "";
|
||||
if ( selector ) {
|
||||
ret.context = selector.nodeType? selector : context || document;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
jQuery.fn.init.prototype = jQuery.fn;
|
||||
|
||||
jQuery.find = function( selector ) {
|
||||
var args = Array.prototype.slice.call( arguments );
|
||||
|
||||
// Support: PhantomJS 1.x
|
||||
// String#match fails to match when used with a //g RegExp, only on some strings
|
||||
if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
|
||||
|
||||
// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
|
||||
// First see if qS thinks it's a valid selector, if so avoid a false positive
|
||||
try {
|
||||
document.querySelector( selector );
|
||||
} catch ( err1 ) {
|
||||
|
||||
// Didn't *look* valid to qSA, warn and try quoting what we think is the value
|
||||
selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
|
||||
return "[" + attr + op + "\"" + value + "\"]";
|
||||
} );
|
||||
|
||||
// If the regexp *may* have created an invalid selector, don't update it
|
||||
// Note that there may be false alarms if selector uses jQuery extensions
|
||||
try {
|
||||
document.querySelector( selector );
|
||||
migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] );
|
||||
args[ 0 ] = selector;
|
||||
} catch ( err2 ) {
|
||||
migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return oldFind.apply( this, args );
|
||||
};
|
||||
|
||||
// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
|
||||
var findProp;
|
||||
for ( findProp in oldFind ) {
|
||||
if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
|
||||
jQuery.find[ findProp ] = oldFind[ findProp ];
|
||||
}
|
||||
}
|
||||
|
||||
// Let $.parseJSON(falsy_value) return null
|
||||
jQuery.parseJSON = function( json ) {
|
||||
if ( !json ) {
|
||||
migrateWarn("jQuery.parseJSON requires a valid JSON string");
|
||||
return null;
|
||||
}
|
||||
return oldParseJSON.apply( this, arguments );
|
||||
};
|
||||
|
||||
jQuery.uaMatch = function( ua ) {
|
||||
ua = ua.toLowerCase();
|
||||
|
||||
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(msie) ([\w.]+)/.exec( ua ) ||
|
||||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
|
||||
[];
|
||||
|
||||
return {
|
||||
browser: match[ 1 ] || "",
|
||||
version: match[ 2 ] || "0"
|
||||
};
|
||||
};
|
||||
|
||||
// Don't clobber any existing jQuery.browser in case it's different
|
||||
if ( !jQuery.browser ) {
|
||||
matched = jQuery.uaMatch( navigator.userAgent );
|
||||
browser = {};
|
||||
|
||||
if ( matched.browser ) {
|
||||
browser[ matched.browser ] = true;
|
||||
browser.version = matched.version;
|
||||
}
|
||||
|
||||
// Chrome is Webkit, but Webkit is also Safari.
|
||||
if ( browser.chrome ) {
|
||||
browser.webkit = true;
|
||||
} else if ( browser.webkit ) {
|
||||
browser.safari = true;
|
||||
}
|
||||
|
||||
jQuery.browser = browser;
|
||||
}
|
||||
|
||||
// Warn if the code tries to get jQuery.browser
|
||||
migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
|
||||
|
||||
// jQuery.boxModel deprecated in 1.3, jQuery.support.boxModel deprecated in 1.7
|
||||
jQuery.boxModel = jQuery.support.boxModel = (document.compatMode === "CSS1Compat");
|
||||
migrateWarnProp( jQuery, "boxModel", jQuery.boxModel, "jQuery.boxModel is deprecated" );
|
||||
migrateWarnProp( jQuery.support, "boxModel", jQuery.support.boxModel, "jQuery.support.boxModel is deprecated" );
|
||||
|
||||
jQuery.sub = function() {
|
||||
function jQuerySub( selector, context ) {
|
||||
return new jQuerySub.fn.init( selector, context );
|
||||
}
|
||||
jQuery.extend( true, jQuerySub, this );
|
||||
jQuerySub.superclass = this;
|
||||
jQuerySub.fn = jQuerySub.prototype = this();
|
||||
jQuerySub.fn.constructor = jQuerySub;
|
||||
jQuerySub.sub = this.sub;
|
||||
jQuerySub.fn.init = function init( selector, context ) {
|
||||
var instance = jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
||||
return instance instanceof jQuerySub ?
|
||||
instance :
|
||||
jQuerySub( instance );
|
||||
};
|
||||
jQuerySub.fn.init.prototype = jQuerySub.fn;
|
||||
var rootjQuerySub = jQuerySub(document);
|
||||
migrateWarn( "jQuery.sub() is deprecated" );
|
||||
return jQuerySub;
|
||||
};
|
||||
|
||||
// The number of elements contained in the matched element set
|
||||
jQuery.fn.size = function() {
|
||||
migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" );
|
||||
return this.length;
|
||||
};
|
||||
|
||||
|
||||
var internalSwapCall = false;
|
||||
|
||||
// If this version of jQuery has .swap(), don't false-alarm on internal uses
|
||||
if ( jQuery.swap ) {
|
||||
jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
|
||||
var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
|
||||
|
||||
if ( oldHook ) {
|
||||
jQuery.cssHooks[ name ].get = function() {
|
||||
var ret;
|
||||
|
||||
internalSwapCall = true;
|
||||
ret = oldHook.apply( this, arguments );
|
||||
internalSwapCall = false;
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
jQuery.swap = function( elem, options, callback, args ) {
|
||||
var ret, name,
|
||||
old = {};
|
||||
|
||||
if ( !internalSwapCall ) {
|
||||
migrateWarn( "jQuery.swap() is undocumented and deprecated" );
|
||||
}
|
||||
|
||||
// Remember the old values, and insert the new ones
|
||||
for ( name in options ) {
|
||||
old[ name ] = elem.style[ name ];
|
||||
elem.style[ name ] = options[ name ];
|
||||
}
|
||||
|
||||
ret = callback.apply( elem, args || [] );
|
||||
|
||||
// Revert the old values
|
||||
for ( name in options ) {
|
||||
elem.style[ name ] = old[ name ];
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
// Ensure that $.ajax gets the new parseJSON defined in core.js
|
||||
jQuery.ajaxSetup({
|
||||
converters: {
|
||||
"text json": jQuery.parseJSON
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var oldFnData = jQuery.fn.data;
|
||||
|
||||
jQuery.fn.data = function( name ) {
|
||||
var ret, evt,
|
||||
elem = this[0];
|
||||
|
||||
// Handles 1.7 which has this behavior and 1.8 which doesn't
|
||||
if ( elem && name === "events" && arguments.length === 1 ) {
|
||||
ret = jQuery.data( elem, name );
|
||||
evt = jQuery._data( elem, name );
|
||||
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
|
||||
migrateWarn("Use of jQuery.fn.data('events') is deprecated");
|
||||
return evt;
|
||||
}
|
||||
}
|
||||
return oldFnData.apply( this, arguments );
|
||||
};
|
||||
|
||||
|
||||
var rscriptType = /\/(java|ecma)script/i;
|
||||
|
||||
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
|
||||
if ( !jQuery.clean ) {
|
||||
jQuery.clean = function( elems, context, fragment, scripts ) {
|
||||
// Set context per 1.8 logic
|
||||
context = context || document;
|
||||
context = !context.nodeType && context[0] || context;
|
||||
context = context.ownerDocument || context;
|
||||
|
||||
migrateWarn("jQuery.clean() is deprecated");
|
||||
|
||||
var i, elem, handleScript, jsTags,
|
||||
ret = [];
|
||||
|
||||
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
|
||||
|
||||
// Complex logic lifted directly from jQuery 1.8
|
||||
if ( fragment ) {
|
||||
// Special handling of each script element
|
||||
handleScript = function( elem ) {
|
||||
// Check if we consider it executable
|
||||
if ( !elem.type || rscriptType.test( elem.type ) ) {
|
||||
// Detach the script and store it in the scripts array (if provided) or the fragment
|
||||
// Return truthy to indicate that it has been handled
|
||||
return scripts ?
|
||||
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
|
||||
fragment.appendChild( elem );
|
||||
}
|
||||
};
|
||||
|
||||
for ( i = 0; (elem = ret[i]) != null; i++ ) {
|
||||
// Check if we're done after handling an executable script
|
||||
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
|
||||
// Append to fragment and handle embedded scripts
|
||||
fragment.appendChild( elem );
|
||||
if ( typeof elem.getElementsByTagName !== "undefined" ) {
|
||||
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
|
||||
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
|
||||
|
||||
// Splice the scripts into ret after their former ancestor and advance our index beyond them
|
||||
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
|
||||
i += jsTags.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
var eventAdd = jQuery.event.add,
|
||||
eventRemove = jQuery.event.remove,
|
||||
eventTrigger = jQuery.event.trigger,
|
||||
oldToggle = jQuery.fn.toggle,
|
||||
oldLive = jQuery.fn.live,
|
||||
oldDie = jQuery.fn.die,
|
||||
oldLoad = jQuery.fn.load,
|
||||
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
|
||||
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
|
||||
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
|
||||
hoverHack = function( events ) {
|
||||
if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
|
||||
return events;
|
||||
}
|
||||
if ( rhoverHack.test( events ) ) {
|
||||
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
|
||||
}
|
||||
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
|
||||
};
|
||||
|
||||
// Event props removed in 1.9, put them back if needed; no practical way to warn them
|
||||
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
|
||||
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
|
||||
}
|
||||
|
||||
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
|
||||
if ( jQuery.event.dispatch ) {
|
||||
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
|
||||
}
|
||||
|
||||
// Support for 'hover' pseudo-event and ajax event warnings
|
||||
jQuery.event.add = function( elem, types, handler, data, selector ){
|
||||
if ( elem !== document && rajaxEvent.test( types ) ) {
|
||||
migrateWarn( "AJAX events should be attached to document: " + types );
|
||||
}
|
||||
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
|
||||
};
|
||||
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
|
||||
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
|
||||
};
|
||||
|
||||
jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
|
||||
|
||||
jQuery.fn[ name ] = function() {
|
||||
var args = Array.prototype.slice.call( arguments, 0 );
|
||||
|
||||
// If this is an ajax load() the first arg should be the string URL;
|
||||
// technically this could also be the "Anything" arg of the event .load()
|
||||
// which just goes to show why this dumb signature has been deprecated!
|
||||
// jQuery custom builds that exclude the Ajax module justifiably die here.
|
||||
if ( name === "load" && typeof args[ 0 ] === "string" ) {
|
||||
return oldLoad.apply( this, args );
|
||||
}
|
||||
|
||||
migrateWarn( "jQuery.fn." + name + "() is deprecated" );
|
||||
|
||||
args.splice( 0, 0, name );
|
||||
if ( arguments.length ) {
|
||||
return this.bind.apply( this, args );
|
||||
}
|
||||
|
||||
// Use .triggerHandler here because:
|
||||
// - load and unload events don't need to bubble, only applied to window or image
|
||||
// - error event should not bubble to window, although it does pre-1.7
|
||||
// See http://bugs.jquery.com/ticket/11820
|
||||
this.triggerHandler.apply( this, args );
|
||||
return this;
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
jQuery.fn.toggle = function( fn, fn2 ) {
|
||||
|
||||
// Don't mess with animation or css toggles
|
||||
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
|
||||
return oldToggle.apply( this, arguments );
|
||||
}
|
||||
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
|
||||
|
||||
// Save reference to arguments for access in closure
|
||||
var args = arguments,
|
||||
guid = fn.guid || jQuery.guid++,
|
||||
i = 0,
|
||||
toggler = function( event ) {
|
||||
// Figure out which function to execute
|
||||
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
|
||||
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
|
||||
|
||||
// Make sure that clicks stop
|
||||
event.preventDefault();
|
||||
|
||||
// and execute the function
|
||||
return args[ lastToggle ].apply( this, arguments ) || false;
|
||||
};
|
||||
|
||||
// link all the functions, so any of them can unbind this click handler
|
||||
toggler.guid = guid;
|
||||
while ( i < args.length ) {
|
||||
args[ i++ ].guid = guid;
|
||||
}
|
||||
|
||||
return this.click( toggler );
|
||||
};
|
||||
|
||||
jQuery.fn.live = function( types, data, fn ) {
|
||||
migrateWarn("jQuery.fn.live() is deprecated");
|
||||
if ( oldLive ) {
|
||||
return oldLive.apply( this, arguments );
|
||||
}
|
||||
jQuery( this.context ).on( types, this.selector, data, fn );
|
||||
return this;
|
||||
};
|
||||
|
||||
jQuery.fn.die = function( types, fn ) {
|
||||
migrateWarn("jQuery.fn.die() is deprecated");
|
||||
if ( oldDie ) {
|
||||
return oldDie.apply( this, arguments );
|
||||
}
|
||||
jQuery( this.context ).off( types, this.selector || "**", fn );
|
||||
return this;
|
||||
};
|
||||
|
||||
// Turn global events into document-triggered events
|
||||
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
|
||||
if ( !elem && !rajaxEvent.test( event ) ) {
|
||||
migrateWarn( "Global events are undocumented and deprecated" );
|
||||
}
|
||||
return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
|
||||
};
|
||||
jQuery.each( ajaxEvents.split("|"),
|
||||
function( _, name ) {
|
||||
jQuery.event.special[ name ] = {
|
||||
setup: function() {
|
||||
var elem = this;
|
||||
|
||||
// The document needs no shimming; must be !== for oldIE
|
||||
if ( elem !== document ) {
|
||||
jQuery.event.add( document, name + "." + jQuery.guid, function() {
|
||||
jQuery.event.trigger( name, Array.prototype.slice.call( arguments, 1 ), elem, true );
|
||||
});
|
||||
jQuery._data( this, name, jQuery.guid++ );
|
||||
}
|
||||
return false;
|
||||
},
|
||||
teardown: function() {
|
||||
if ( this !== document ) {
|
||||
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
jQuery.event.special.ready = {
|
||||
setup: function() {
|
||||
if ( this === document ) {
|
||||
migrateWarn( "'ready' event is deprecated" );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack,
|
||||
oldFnFind = jQuery.fn.find;
|
||||
|
||||
jQuery.fn.andSelf = function() {
|
||||
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
|
||||
return oldSelf.apply( this, arguments );
|
||||
};
|
||||
|
||||
jQuery.fn.find = function( selector ) {
|
||||
var ret = oldFnFind.apply( this, arguments );
|
||||
ret.context = this.context;
|
||||
ret.selector = this.selector ? this.selector + " " + selector : selector;
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
// jQuery 1.6 did not support Callbacks, do not warn there
|
||||
if ( jQuery.Callbacks ) {
|
||||
|
||||
var oldDeferred = jQuery.Deferred,
|
||||
tuples = [
|
||||
// action, add listener, callbacks, .then handlers, final state
|
||||
[ "resolve", "done", jQuery.Callbacks("once memory"),
|
||||
jQuery.Callbacks("once memory"), "resolved" ],
|
||||
[ "reject", "fail", jQuery.Callbacks("once memory"),
|
||||
jQuery.Callbacks("once memory"), "rejected" ],
|
||||
[ "notify", "progress", jQuery.Callbacks("memory"),
|
||||
jQuery.Callbacks("memory") ]
|
||||
];
|
||||
|
||||
jQuery.Deferred = function( func ) {
|
||||
var deferred = oldDeferred(),
|
||||
promise = deferred.promise();
|
||||
|
||||
deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
|
||||
var fns = arguments;
|
||||
|
||||
migrateWarn( "deferred.pipe() is deprecated" );
|
||||
|
||||
return jQuery.Deferred(function( newDefer ) {
|
||||
jQuery.each( tuples, function( i, tuple ) {
|
||||
var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
|
||||
// deferred.done(function() { bind to newDefer or newDefer.resolve })
|
||||
// deferred.fail(function() { bind to newDefer or newDefer.reject })
|
||||
// deferred.progress(function() { bind to newDefer or newDefer.notify })
|
||||
deferred[ tuple[1] ](function() {
|
||||
var returned = fn && fn.apply( this, arguments );
|
||||
if ( returned && jQuery.isFunction( returned.promise ) ) {
|
||||
returned.promise()
|
||||
.done( newDefer.resolve )
|
||||
.fail( newDefer.reject )
|
||||
.progress( newDefer.notify );
|
||||
} else {
|
||||
newDefer[ tuple[ 0 ] + "With" ](
|
||||
this === promise ? newDefer.promise() : this,
|
||||
fn ? [ returned ] : arguments
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
fns = null;
|
||||
}).promise();
|
||||
|
||||
};
|
||||
|
||||
deferred.isResolved = function() {
|
||||
migrateWarn( "deferred.isResolved is deprecated" );
|
||||
return deferred.state() === "resolved";
|
||||
};
|
||||
|
||||
deferred.isRejected = function() {
|
||||
migrateWarn( "deferred.isRejected is deprecated" );
|
||||
return deferred.state() === "rejected";
|
||||
};
|
||||
|
||||
if ( func ) {
|
||||
func.call( deferred, deferred );
|
||||
}
|
||||
|
||||
return deferred;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
})( jQuery, window );
|
||||
2
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery-migrate.min.js
vendored
Executable file
2
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery-migrate.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
2
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.color.min.js
vendored
Executable file
2
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.color.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
1193
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.form.js
Executable file
1193
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.form.js
Executable file
File diff suppressed because it is too large
Load Diff
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.form.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.form.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
134
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.hotkeys.js
Executable file
134
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.hotkeys.js
Executable file
@@ -0,0 +1,134 @@
|
||||
/******************************************************************************************************************************
|
||||
|
||||
* @ 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') ) &&
|
||||
( ! opt.noDisable || ! target.is( opt.noDisable ) ) ) {
|
||||
|
||||
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
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.hotkeys.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.hotkeys.min.js
vendored
Executable 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);
|
||||
6
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.js
vendored
Executable file
6
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.masonry.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.masonry.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
-/*!
|
||||
- * Masonry v2 shim
|
||||
- * to maintain backwards compatibility
|
||||
- * as of Masonry v3.1.2
|
||||
- *
|
||||
- * Cascading grid layout library
|
||||
- * http://masonry.desandro.com
|
||||
- * MIT License
|
||||
- * by David DeSandro
|
||||
- */
|
||||
!function(a){"use strict";var b=a.Masonry;b.prototype._remapV2Options=function(){this._remapOption("gutterWidth","gutter"),this._remapOption("isResizable","isResizeBound"),this._remapOption("isRTL","isOriginLeft",function(a){return!a});var a=this.options.isAnimated;if(void 0!==a&&(this.options.transitionDuration=a?b.prototype.options.transitionDuration:0),void 0===a||a){var c=this.options.animationOptions,d=c&&c.duration;d&&(this.options.transitionDuration="string"==typeof d?d:d+"ms")}},b.prototype._remapOption=function(a,b,c){var d=this.options[a];void 0!==d&&(this.options[b]=c?c(d):d)};var c=b.prototype._create;b.prototype._create=function(){var a=this;this._remapV2Options(),c.apply(this,arguments),setTimeout(function(){jQuery(a.element).addClass("masonry")},0)};var d=b.prototype.layout;b.prototype.layout=function(){this._remapV2Options(),d.apply(this,arguments)};var e=b.prototype.option;b.prototype.option=function(){e.apply(this,arguments),this._remapV2Options()};var f=b.prototype._itemize;b.prototype._itemize=function(a){var b=f.apply(this,arguments);return jQuery(a).addClass("masonry-brick"),b};var g=b.prototype.measureColumns;b.prototype.measureColumns=function(){var a=this.options.columnWidth;a&&"function"==typeof a&&(this.getContainerWidth(),this.columnWidth=a(this.containerWidth)),g.apply(this,arguments)},b.prototype.reload=function(){this.reloadItems.apply(this,arguments),this.layout.apply(this)};var h=b.prototype.destroy;b.prototype.destroy=function(){var a=this.getItemElements();jQuery(this.element).removeClass("masonry"),jQuery(a).removeClass("masonry-brick"),h.apply(this,arguments)}}(window);
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.query.js
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.query.js
Executable 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
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.schedule.js
Executable file
36
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.schedule.js
Executable 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);
|
||||
@@ -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
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.table-hotkeys.js
Executable file
99
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.table-hotkeys.js
Executable 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
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.table-hotkeys.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.table-hotkeys.min.js
vendored
Executable 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
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.ui.touch-punch.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/jquery.ui.touch-punch.js
vendored
Executable 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);
|
||||
316
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/suggest.js
vendored
Executable file
316
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/suggest.js
vendored
Executable file
@@ -0,0 +1,316 @@
|
||||
/*
|
||||
* 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 = $("<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)
|
||||
.on( 'load', resetPosition ) // just in case user is changing size of page while loading
|
||||
.on( 'resize', resetPosition );
|
||||
|
||||
$input.blur(function() {
|
||||
setTimeout(function() { $results.hide() }, 200);
|
||||
});
|
||||
|
||||
$input.keydown(processKey);
|
||||
|
||||
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();
|
||||
$input.trigger('change');
|
||||
|
||||
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
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/suggest.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/suggest.min.js
vendored
Executable file
@@ -0,0 +1 @@
|
||||
!function(a){a.suggest=function(b,c){function d(){var a=o.offset();p.css({top:a.top+b.offsetHeight+"px",left:a.left+"px"})}function e(a){if(/27$|38$|40$/.test(a.keyCode)&&p.is(":visible")||/^13$|^9$/.test(a.keyCode)&&k())switch(a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0,a.returnValue=!1,a.keyCode){case 38:n();break;case 40:m();break;case 9:case 13:l();break;case 27:p.hide()}else o.val().length!=r&&(q&&clearTimeout(q),q=setTimeout(f,c.delay),r=o.val().length)}function f(){var b,d,e=a.trim(o.val());c.multiple&&(b=e.lastIndexOf(c.multipleSep),-1!=b&&(e=a.trim(e.substr(b+c.multipleSep.length)))),e.length>=c.minchars?(cached=g(e),cached?i(cached.items):a.get(c.source,{q:e},function(a){p.hide(),d=j(a,e),i(d),h(e,d,a.length)})):p.hide()}function g(a){var b;for(b=0;b<s.length;b++)if(s[b].q==a)return s.unshift(s.splice(b,1)[0]),s[0];return!1}function h(a,b,d){for(var e;s.length&&t+d>c.maxCacheSize;)e=s.pop(),t-=e.size;s.push({q:a,size:d,items:b}),t+=d}function i(b){var e,f="";if(b){if(!b.length)return void p.hide();for(d(),e=0;e<b.length;e++)f+="<li>"+b[e]+"</li>";p.html(f).show(),p.children("li").mouseover(function(){p.children("li").removeClass(c.selectClass),a(this).addClass(c.selectClass)}).click(function(a){a.preventDefault(),a.stopPropagation(),l()})}}function j(b,d){var e,f,g=[],h=b.split(c.delimiter);for(e=0;e<h.length;e++)f=a.trim(h[e]),f&&(f=f.replace(new RegExp(d,"ig"),function(a){return'<span class="'+c.matchClass+'">'+a+"</span>"}),g[g.length]=f);return g}function k(){var a;return p.is(":visible")?(a=p.children("li."+c.selectClass),a.length||(a=!1),a):!1}function l(){$currentResult=k(),$currentResult&&(c.multiple?(-1!=o.val().indexOf(c.multipleSep)?$currentVal=o.val().substr(0,o.val().lastIndexOf(c.multipleSep)+c.multipleSep.length)+" ":$currentVal="",o.val($currentVal+$currentResult.text()+c.multipleSep+" "),o.focus()):o.val($currentResult.text()),p.hide(),o.trigger("change"),c.onSelect&&c.onSelect.apply(o[0]))}function m(){$currentResult=k(),$currentResult?$currentResult.removeClass(c.selectClass).next().addClass(c.selectClass):p.children("li:first-child").addClass(c.selectClass)}function n(){var a=k();a?a.removeClass(c.selectClass).prev().addClass(c.selectClass):p.children("li:last-child").addClass(c.selectClass)}var o,p,q,r,s,t;o=a(b).attr("autocomplete","off"),p=a("<ul/>"),q=!1,r=0,s=[],t=0,p.addClass(c.resultsClass).appendTo("body"),d(),a(window).on("load",d).on("resize",d),o.blur(function(){setTimeout(function(){p.hide()},200)}),o.keydown(e)},a.fn.suggest=function(b,c){return b?(c=c||{},c.multiple=c.multiple||!1,c.multipleSep=c.multipleSep||",",c.source=b,c.delay=c.delay||100,c.resultsClass=c.resultsClass||"ac_results",c.selectClass=c.selectClass||"ac_over",c.matchClass=c.matchClass||"ac_match",c.minchars=c.minchars||2,c.delimiter=c.delimiter||"\n",c.onSelect=c.onSelect||!1,c.maxCacheSize=c.maxCacheSize||65536,this.each(function(){new a.suggest(this,c)}),this):void 0}}(jQuery);
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/accordion.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/accordion.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/autocomplete.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/autocomplete.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/button.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/button.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/core.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/core.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Core 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/category/ui-core/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){function b(b,d){var e,f,g,h=b.nodeName.toLowerCase();return"area"===h?(e=b.parentNode,f=e.name,b.href&&f&&"map"===e.nodeName.toLowerCase()?(g=a("img[usemap='#"+f+"']")[0],!!g&&c(g)):!1):(/^(input|select|textarea|button|object)$/.test(h)?!b.disabled:"a"===h?b.href||d:d)&&c(b)}function c(b){return a.expr.filters.visible(b)&&!a(b).parents().addBack().filter(function(){return"hidden"===a.css(this,"visibility")}).length}a.ui=a.ui||{},a.extend(a.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),a.fn.extend({scrollParent:function(b){var c=this.css("position"),d="absolute"===c,e=b?/(auto|scroll|hidden)/:/(auto|scroll)/,f=this.parents().filter(function(){var b=a(this);return d&&"static"===b.css("position")?!1:e.test(b.css("overflow")+b.css("overflow-y")+b.css("overflow-x"))}).eq(0);return"fixed"!==c&&f.length?f:a(this[0].ownerDocument||document)},uniqueId:function(){var a=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++a)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&a(this).removeAttr("id")})}}),a.extend(a.expr[":"],{data:a.expr.createPseudo?a.expr.createPseudo(function(b){return function(c){return!!a.data(c,b)}}):function(b,c,d){return!!a.data(b,d[3])},focusable:function(c){return b(c,!isNaN(a.attr(c,"tabindex")))},tabbable:function(c){var d=a.attr(c,"tabindex"),e=isNaN(d);return(e||d>=0)&&b(c,!e)}}),a("<a>").outerWidth(1).jquery||a.each(["Width","Height"],function(b,c){function d(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.css(b,"padding"+this))||0,d&&(c-=parseFloat(a.css(b,"border"+this+"Width"))||0),f&&(c-=parseFloat(a.css(b,"margin"+this))||0)}),c}var e="Width"===c?["Left","Right"]:["Top","Bottom"],f=c.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+c]=function(b){return void 0===b?g["inner"+c].call(this):this.each(function(){a(this).css(f,d(this,b)+"px")})},a.fn["outer"+c]=function(b,e){return"number"!=typeof b?g["outer"+c].call(this,b):this.each(function(){a(this).css(f,d(this,b,!0,e)+"px")})}}),a.fn.addBack||(a.fn.addBack=function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}),a("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(a.fn.removeData=function(b){return function(c){return arguments.length?b.call(this,a.camelCase(c)):b.call(this)}}(a.fn.removeData)),a.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),a.fn.extend({focus:function(b){return function(c,d){return"number"==typeof c?this.each(function(){var b=this;setTimeout(function(){a(b).focus(),d&&d.call(b)},c)}):b.apply(this,arguments)}}(a.fn.focus),disableSelection:function(){var a="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(a+".ui-disableSelection",function(a){a.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(b){if(void 0!==b)return this.css("zIndex",b);if(this.length)for(var c,d,e=a(this[0]);e.length&&e[0]!==document;){if(c=e.css("position"),("absolute"===c||"relative"===c||"fixed"===c)&&(d=parseInt(e.css("zIndex"),10),!isNaN(d)&&0!==d))return d;e=e.parent()}return 0}}),a.ui.plugin={add:function(b,c,d){var e,f=a.ui[b].prototype;for(e in d)f.plugins[e]=f.plugins[e]||[],f.plugins[e].push([c,d[e]])},call:function(a,b,c,d){var e,f=a.plugins[b];if(f&&(d||a.element[0].parentNode&&11!==a.element[0].parentNode.nodeType))for(e=0;e<f.length;e++)a.options[f[e][0]]&&f[e][1].apply(a.element,c)}}});
|
||||
12
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/datepicker.min.js
vendored
Executable file
12
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/datepicker.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/dialog.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/dialog.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/draggable.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/draggable.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/droppable.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/droppable.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-blind.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-blind.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Effects Blind 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/blind-effect/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./effect"],a):a(jQuery)}(function(a){return a.effects.effect.blind=function(b,c){var d,e,f,g=a(this),h=/up|down|vertical/,i=/up|left|vertical|horizontal/,j=["position","top","bottom","left","right","height","width"],k=a.effects.setMode(g,b.mode||"hide"),l=b.direction||"up",m=h.test(l),n=m?"height":"width",o=m?"top":"left",p=i.test(l),q={},r="show"===k;g.parent().is(".ui-effects-wrapper")?a.effects.save(g.parent(),j):a.effects.save(g,j),g.show(),d=a.effects.createWrapper(g).css({overflow:"hidden"}),e=d[n](),f=parseFloat(d.css(o))||0,q[n]=r?e:0,p||(g.css(m?"bottom":"right",0).css(m?"top":"left","auto").css({position:"absolute"}),q[o]=r?f:e+f),r&&(d.css(n,0),p||d.css(o,f+e)),d.animate(q,{duration:b.duration,easing:b.easing,queue:!1,complete:function(){"hide"===k&&g.hide(),a.effects.restore(g,j),a.effects.removeWrapper(g),c()}})}});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-bounce.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-bounce.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Effects Bounce 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/bounce-effect/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./effect"],a):a(jQuery)}(function(a){return a.effects.effect.bounce=function(b,c){var d,e,f,g=a(this),h=["position","top","bottom","left","right","height","width"],i=a.effects.setMode(g,b.mode||"effect"),j="hide"===i,k="show"===i,l=b.direction||"up",m=b.distance,n=b.times||5,o=2*n+(k||j?1:0),p=b.duration/o,q=b.easing,r="up"===l||"down"===l?"top":"left",s="up"===l||"left"===l,t=g.queue(),u=t.length;for((k||j)&&h.push("opacity"),a.effects.save(g,h),g.show(),a.effects.createWrapper(g),m||(m=g["top"===r?"outerHeight":"outerWidth"]()/3),k&&(f={opacity:1},f[r]=0,g.css("opacity",0).css(r,s?2*-m:2*m).animate(f,p,q)),j&&(m/=Math.pow(2,n-1)),f={},f[r]=0,d=0;n>d;d++)e={},e[r]=(s?"-=":"+=")+m,g.animate(e,p,q).animate(f,p,q),m=j?2*m:m/2;j&&(e={opacity:0},e[r]=(s?"-=":"+=")+m,g.animate(e,p,q)),g.queue(function(){j&&g.hide(),a.effects.restore(g,h),a.effects.removeWrapper(g),c()}),u>1&&t.splice.apply(t,[1,0].concat(t.splice(u,o+1))),g.dequeue()}});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-clip.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-clip.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Effects Clip 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/clip-effect/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./effect"],a):a(jQuery)}(function(a){return a.effects.effect.clip=function(b,c){var d,e,f,g=a(this),h=["position","top","bottom","left","right","height","width"],i=a.effects.setMode(g,b.mode||"hide"),j="show"===i,k=b.direction||"vertical",l="vertical"===k,m=l?"height":"width",n=l?"top":"left",o={};a.effects.save(g,h),g.show(),d=a.effects.createWrapper(g).css({overflow:"hidden"}),e="IMG"===g[0].tagName?d:g,f=e[m](),j&&(e.css(m,0),e.css(n,f/2)),o[m]=j?f:0,o[n]=j?0:f/2,e.animate(o,{queue:!1,duration:b.duration,easing:b.easing,complete:function(){j||g.hide(),a.effects.restore(g,h),a.effects.removeWrapper(g),c()}})}});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-drop.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-drop.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Effects Drop 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/drop-effect/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./effect"],a):a(jQuery)}(function(a){return a.effects.effect.drop=function(b,c){var d,e=a(this),f=["position","top","bottom","left","right","opacity","height","width"],g=a.effects.setMode(e,b.mode||"hide"),h="show"===g,i=b.direction||"left",j="up"===i||"down"===i?"top":"left",k="up"===i||"left"===i?"pos":"neg",l={opacity:h?1:0};a.effects.save(e,f),e.show(),a.effects.createWrapper(e),d=b.distance||e["top"===j?"outerHeight":"outerWidth"](!0)/2,h&&e.css("opacity",0).css(j,"pos"===k?-d:d),l[j]=(h?"pos"===k?"+=":"-=":"pos"===k?"-=":"+=")+d,e.animate(l,{queue:!1,duration:b.duration,easing:b.easing,complete:function(){"hide"===g&&e.hide(),a.effects.restore(e,f),a.effects.removeWrapper(e),c()}})}});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-explode.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-explode.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Effects Explode 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/explode-effect/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./effect"],a):a(jQuery)}(function(a){return a.effects.effect.explode=function(b,c){function d(){t.push(this),t.length===l*m&&e()}function e(){n.css({visibility:"visible"}),a(t).remove(),p||n.hide(),c()}var f,g,h,i,j,k,l=b.pieces?Math.round(Math.sqrt(b.pieces)):3,m=l,n=a(this),o=a.effects.setMode(n,b.mode||"hide"),p="show"===o,q=n.show().css("visibility","hidden").offset(),r=Math.ceil(n.outerWidth()/m),s=Math.ceil(n.outerHeight()/l),t=[];for(f=0;l>f;f++)for(i=q.top+f*s,k=f-(l-1)/2,g=0;m>g;g++)h=q.left+g*r,j=g-(m-1)/2,n.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-g*r,top:-f*s}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:r,height:s,left:h+(p?j*r:0),top:i+(p?k*s:0),opacity:p?0:1}).animate({left:h+(p?0:j*r),top:i+(p?0:k*s),opacity:p?1:0},b.duration||500,b.easing,d)}});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-fade.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-fade.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Effects Fade 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/fade-effect/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./effect"],a):a(jQuery)}(function(a){return a.effects.effect.fade=function(b,c){var d=a(this),e=a.effects.setMode(d,b.mode||"toggle");d.animate({opacity:e},{queue:!1,duration:b.duration,easing:b.easing,complete:c})}});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-fold.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-fold.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Effects Fold 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/fold-effect/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./effect"],a):a(jQuery)}(function(a){return a.effects.effect.fold=function(b,c){var d,e,f=a(this),g=["position","top","bottom","left","right","height","width"],h=a.effects.setMode(f,b.mode||"hide"),i="show"===h,j="hide"===h,k=b.size||15,l=/([0-9]+)%/.exec(k),m=!!b.horizFirst,n=i!==m,o=n?["width","height"]:["height","width"],p=b.duration/2,q={},r={};a.effects.save(f,g),f.show(),d=a.effects.createWrapper(f).css({overflow:"hidden"}),e=n?[d.width(),d.height()]:[d.height(),d.width()],l&&(k=parseInt(l[1],10)/100*e[j?0:1]),i&&d.css(m?{height:0,width:k}:{height:k,width:0}),q[o[0]]=i?e[0]:k,r[o[1]]=i?e[1]:0,d.animate(q,p,b.easing).animate(r,p,b.easing,function(){j&&f.hide(),a.effects.restore(f,g),a.effects.removeWrapper(f),c()})}});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-highlight.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-highlight.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Effects Highlight 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/highlight-effect/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./effect"],a):a(jQuery)}(function(a){return a.effects.effect.highlight=function(b,c){var d=a(this),e=["backgroundImage","backgroundColor","opacity"],f=a.effects.setMode(d,b.mode||"show"),g={backgroundColor:d.css("backgroundColor")};"hide"===f&&(g.opacity=0),a.effects.save(d,e),d.show().css({backgroundImage:"none",backgroundColor:b.color||"#ffff99"}).animate(g,{queue:!1,duration:b.duration,easing:b.easing,complete:function(){"hide"===f&&d.hide(),a.effects.restore(d,e),c()}})}});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-puff.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-puff.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Effects Puff 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/puff-effect/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./effect","./effect-scale"],a):a(jQuery)}(function(a){return a.effects.effect.puff=function(b,c){var d=a(this),e=a.effects.setMode(d,b.mode||"hide"),f="hide"===e,g=parseInt(b.percent,10)||150,h=g/100,i={height:d.height(),width:d.width(),outerHeight:d.outerHeight(),outerWidth:d.outerWidth()};a.extend(b,{effect:"scale",queue:!1,fade:!0,mode:e,complete:c,percent:f?g:100,from:f?i:{height:i.height*h,width:i.width*h,outerHeight:i.outerHeight*h,outerWidth:i.outerWidth*h}}),d.effect(b)}});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-pulsate.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-pulsate.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Effects Pulsate 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/pulsate-effect/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./effect"],a):a(jQuery)}(function(a){return a.effects.effect.pulsate=function(b,c){var d,e=a(this),f=a.effects.setMode(e,b.mode||"show"),g="show"===f,h="hide"===f,i=g||"hide"===f,j=2*(b.times||5)+(i?1:0),k=b.duration/j,l=0,m=e.queue(),n=m.length;for((g||!e.is(":visible"))&&(e.css("opacity",0).show(),l=1),d=1;j>d;d++)e.animate({opacity:l},k,b.easing),l=1-l;e.animate({opacity:l},k,b.easing),e.queue(function(){h&&e.hide(),c()}),n>1&&m.splice.apply(m,[1,0].concat(m.splice(n,j+1))),e.dequeue()}});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-scale.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-scale.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Effects Scale 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/scale-effect/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./effect","./effect-size"],a):a(jQuery)}(function(a){return a.effects.effect.scale=function(b,c){var d=a(this),e=a.extend(!0,{},b),f=a.effects.setMode(d,b.mode||"effect"),g=parseInt(b.percent,10)||(0===parseInt(b.percent,10)?0:"hide"===f?0:100),h=b.direction||"both",i=b.origin,j={height:d.height(),width:d.width(),outerHeight:d.outerHeight(),outerWidth:d.outerWidth()},k={y:"horizontal"!==h?g/100:1,x:"vertical"!==h?g/100:1};e.effect="size",e.queue=!1,e.complete=c,"effect"!==f&&(e.origin=i||["middle","center"],e.restore=!0),e.from=b.from||("show"===f?{height:0,width:0,outerHeight:0,outerWidth:0}:j),e.to={height:j.height*k.y,width:j.width*k.x,outerHeight:j.outerHeight*k.y,outerWidth:j.outerWidth*k.x},e.fade&&("show"===f&&(e.from.opacity=0,e.to.opacity=1),"hide"===f&&(e.from.opacity=1,e.to.opacity=0)),d.effect(e)}});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-shake.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-shake.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Effects Shake 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/shake-effect/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./effect"],a):a(jQuery)}(function(a){return a.effects.effect.shake=function(b,c){var d,e=a(this),f=["position","top","bottom","left","right","height","width"],g=a.effects.setMode(e,b.mode||"effect"),h=b.direction||"left",i=b.distance||20,j=b.times||3,k=2*j+1,l=Math.round(b.duration/k),m="up"===h||"down"===h?"top":"left",n="up"===h||"left"===h,o={},p={},q={},r=e.queue(),s=r.length;for(a.effects.save(e,f),e.show(),a.effects.createWrapper(e),o[m]=(n?"-=":"+=")+i,p[m]=(n?"+=":"-=")+2*i,q[m]=(n?"-=":"+=")+2*i,e.animate(o,l,b.easing),d=1;j>d;d++)e.animate(p,l,b.easing).animate(q,l,b.easing);e.animate(p,l,b.easing).animate(o,l/2,b.easing).queue(function(){"hide"===g&&e.hide(),a.effects.restore(e,f),a.effects.removeWrapper(e),c()}),s>1&&r.splice.apply(r,[1,0].concat(r.splice(s,k+1))),e.dequeue()}});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-size.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-size.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Effects Size 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/size-effect/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./effect"],a):a(jQuery)}(function(a){return a.effects.effect.size=function(b,c){var d,e,f,g=a(this),h=["position","top","bottom","left","right","width","height","overflow","opacity"],i=["position","top","bottom","left","right","overflow","opacity"],j=["width","height","overflow"],k=["fontSize"],l=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],m=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],n=a.effects.setMode(g,b.mode||"effect"),o=b.restore||"effect"!==n,p=b.scale||"both",q=b.origin||["middle","center"],r=g.css("position"),s=o?h:i,t={height:0,width:0,outerHeight:0,outerWidth:0};"show"===n&&g.show(),d={height:g.height(),width:g.width(),outerHeight:g.outerHeight(),outerWidth:g.outerWidth()},"toggle"===b.mode&&"show"===n?(g.from=b.to||t,g.to=b.from||d):(g.from=b.from||("show"===n?t:d),g.to=b.to||("hide"===n?t:d)),f={from:{y:g.from.height/d.height,x:g.from.width/d.width},to:{y:g.to.height/d.height,x:g.to.width/d.width}},("box"===p||"both"===p)&&(f.from.y!==f.to.y&&(s=s.concat(l),g.from=a.effects.setTransition(g,l,f.from.y,g.from),g.to=a.effects.setTransition(g,l,f.to.y,g.to)),f.from.x!==f.to.x&&(s=s.concat(m),g.from=a.effects.setTransition(g,m,f.from.x,g.from),g.to=a.effects.setTransition(g,m,f.to.x,g.to))),("content"===p||"both"===p)&&f.from.y!==f.to.y&&(s=s.concat(k).concat(j),g.from=a.effects.setTransition(g,k,f.from.y,g.from),g.to=a.effects.setTransition(g,k,f.to.y,g.to)),a.effects.save(g,s),g.show(),a.effects.createWrapper(g),g.css("overflow","hidden").css(g.from),q&&(e=a.effects.getBaseline(q,d),g.from.top=(d.outerHeight-g.outerHeight())*e.y,g.from.left=(d.outerWidth-g.outerWidth())*e.x,g.to.top=(d.outerHeight-g.to.outerHeight)*e.y,g.to.left=(d.outerWidth-g.to.outerWidth)*e.x),g.css(g.from),("content"===p||"both"===p)&&(l=l.concat(["marginTop","marginBottom"]).concat(k),m=m.concat(["marginLeft","marginRight"]),j=h.concat(l).concat(m),g.find("*[width]").each(function(){var c=a(this),d={height:c.height(),width:c.width(),outerHeight:c.outerHeight(),outerWidth:c.outerWidth()};o&&a.effects.save(c,j),c.from={height:d.height*f.from.y,width:d.width*f.from.x,outerHeight:d.outerHeight*f.from.y,outerWidth:d.outerWidth*f.from.x},c.to={height:d.height*f.to.y,width:d.width*f.to.x,outerHeight:d.height*f.to.y,outerWidth:d.width*f.to.x},f.from.y!==f.to.y&&(c.from=a.effects.setTransition(c,l,f.from.y,c.from),c.to=a.effects.setTransition(c,l,f.to.y,c.to)),f.from.x!==f.to.x&&(c.from=a.effects.setTransition(c,m,f.from.x,c.from),c.to=a.effects.setTransition(c,m,f.to.x,c.to)),c.css(c.from),c.animate(c.to,b.duration,b.easing,function(){o&&a.effects.restore(c,j)})})),g.animate(g.to,{queue:!1,duration:b.duration,easing:b.easing,complete:function(){0===g.to.opacity&&g.css("opacity",g.from.opacity),"hide"===n&&g.hide(),a.effects.restore(g,s),o||("static"===r?g.css({position:"relative",top:g.to.top,left:g.to.left}):a.each(["top","left"],function(a,b){g.css(b,function(b,c){var d=parseInt(c,10),e=a?g.to.left:g.to.top;return"auto"===c?e+"px":d+e+"px"})})),a.effects.removeWrapper(g),c()}})}});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-slide.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-slide.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Effects Slide 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/slide-effect/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./effect"],a):a(jQuery)}(function(a){return a.effects.effect.slide=function(b,c){var d,e=a(this),f=["position","top","bottom","left","right","width","height"],g=a.effects.setMode(e,b.mode||"show"),h="show"===g,i=b.direction||"left",j="up"===i||"down"===i?"top":"left",k="up"===i||"left"===i,l={};a.effects.save(e,f),e.show(),d=b.distance||e["top"===j?"outerHeight":"outerWidth"](!0),a.effects.createWrapper(e).css({overflow:"hidden"}),h&&e.css(j,k?isNaN(d)?"-"+d:-d:d),l[j]=(h?k?"+=":"-=":k?"-=":"+=")+d,e.animate(l,{queue:!1,duration:b.duration,easing:b.easing,complete:function(){"hide"===g&&e.hide(),a.effects.restore(e,f),a.effects.removeWrapper(e),c()}})}});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-transfer.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect-transfer.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Effects Transfer 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/transfer-effect/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./effect"],a):a(jQuery)}(function(a){return a.effects.effect.transfer=function(b,c){var d=a(this),e=a(b.to),f="fixed"===e.css("position"),g=a("body"),h=f?g.scrollTop():0,i=f?g.scrollLeft():0,j=e.offset(),k={top:j.top-h,left:j.left-i,height:e.innerHeight(),width:e.innerWidth()},l=d.offset(),m=a("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(b.className).css({top:l.top-h,left:l.left-i,height:d.innerHeight(),width:d.innerWidth(),position:f?"fixed":"absolute"}).animate(k,b.duration,b.easing,function(){m.remove(),c()})}});
|
||||
21
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect.min.js
vendored
Executable file
21
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/effect.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/menu.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/menu.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/mouse.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/mouse.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Mouse 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/mouse/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./widget"],a):a(jQuery)}(function(a){var b=!1;return a(document).mouseup(function(){b=!1}),a.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(a){return b._mouseDown(a)}).bind("click."+this.widgetName,function(c){return!0===a.data(c.target,b.widgetName+".preventClickEvent")?(a.removeData(c.target,b.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(c){if(!b){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(c),this._mouseDownEvent=c;var d=this,e=1===c.which,f="string"==typeof this.options.cancel&&c.target.nodeName?a(c.target).closest(this.options.cancel).length:!1;return e&&!f&&this._mouseCapture(c)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(c)&&this._mouseDelayMet(c)&&(this._mouseStarted=this._mouseStart(c)!==!1,!this._mouseStarted)?(c.preventDefault(),!0):(!0===a.data(c.target,this.widgetName+".preventClickEvent")&&a.removeData(c.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(a){return d._mouseMove(a)},this._mouseUpDelegate=function(a){return d._mouseUp(a)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),c.preventDefault(),b=!0,!0)):!0}},_mouseMove:function(b){if(this._mouseMoved){if(a.ui.ie&&(!document.documentMode||document.documentMode<9)&&!b.button)return this._mouseUp(b);if(!b.which)return this._mouseUp(b)}return(b.which||b.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted)},_mouseUp:function(c){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,c.target===this._mouseDownEvent.target&&a.data(c.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(c)),b=!1,!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/position.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/position.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/progressbar.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/progressbar.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Progressbar 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/progressbar/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./core","./widget"],a):a(jQuery)}(function(a){return a.widget("ui.progressbar",{version:"1.11.4",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=a("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),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(a){return void 0===a?this.options.value:(this.options.value=this._constrainedValue(a),void this._refreshValue())},_constrainedValue:function(a){return void 0===a&&(a=this.options.value),this.indeterminate=a===!1,"number"!=typeof a&&(a=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,a))},_setOptions:function(a){var b=a.value;delete a.value,this._super(a),this.options.value=this._constrainedValue(b),this._refreshValue()},_setOption:function(a,b){"max"===a&&(b=Math.max(this.min,b)),"disabled"===a&&this.element.toggleClass("ui-state-disabled",!!b).attr("aria-disabled",b),this._super(a,b)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var b=this.options.value,c=this._percentage();this.valueDiv.toggle(this.indeterminate||b>this.min).toggleClass("ui-corner-right",b===this.options.max).width(c.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=a("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":b}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==b&&(this.oldValue=b,this._trigger("change")),b===this.options.max&&this._trigger("complete")}})});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/resizable.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/resizable.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/selectable.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/selectable.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Selectable 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/selectable/
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery","./core","./mouse","./widget"],a):a(jQuery)}(function(a){return a.widget("ui.selectable",a.ui.mouse,{version:"1.11.4",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var b,c=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){b=a(c.options.filter,c.element[0]),b.addClass("ui-selectee"),b.each(function(){var b=a(this),c=b.offset();a.data(this,"selectable-item",{element:this,$element:b,left:c.left,top:c.top,right:c.left+b.outerWidth(),bottom:c.top+b.outerHeight(),startselected:!1,selected:b.hasClass("ui-selected"),selecting:b.hasClass("ui-selecting"),unselecting:b.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=b.addClass("ui-selectee"),this._mouseInit(),this.helper=a("<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(b){var c=this,d=this.options;this.opos=[b.pageX,b.pageY],this.options.disabled||(this.selectees=a(d.filter,this.element[0]),this._trigger("start",b),a(d.appendTo).append(this.helper),this.helper.css({left:b.pageX,top:b.pageY,width:0,height:0}),d.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var d=a.data(this,"selectable-item");d.startselected=!0,b.metaKey||b.ctrlKey||(d.$element.removeClass("ui-selected"),d.selected=!1,d.$element.addClass("ui-unselecting"),d.unselecting=!0,c._trigger("unselecting",b,{unselecting:d.element}))}),a(b.target).parents().addBack().each(function(){var d,e=a.data(this,"selectable-item");return e?(d=!b.metaKey&&!b.ctrlKey||!e.$element.hasClass("ui-selected"),e.$element.removeClass(d?"ui-unselecting":"ui-selected").addClass(d?"ui-selecting":"ui-unselecting"),e.unselecting=!d,e.selecting=d,e.selected=d,d?c._trigger("selecting",b,{selecting:e.element}):c._trigger("unselecting",b,{unselecting:e.element}),!1):void 0}))},_mouseDrag:function(b){if(this.dragged=!0,!this.options.disabled){var c,d=this,e=this.options,f=this.opos[0],g=this.opos[1],h=b.pageX,i=b.pageY;return f>h&&(c=h,h=f,f=c),g>i&&(c=i,i=g,g=c),this.helper.css({left:f,top:g,width:h-f,height:i-g}),this.selectees.each(function(){var c=a.data(this,"selectable-item"),j=!1;c&&c.element!==d.element[0]&&("touch"===e.tolerance?j=!(c.left>h||c.right<f||c.top>i||c.bottom<g):"fit"===e.tolerance&&(j=c.left>f&&c.right<h&&c.top>g&&c.bottom<i),j?(c.selected&&(c.$element.removeClass("ui-selected"),c.selected=!1),c.unselecting&&(c.$element.removeClass("ui-unselecting"),c.unselecting=!1),c.selecting||(c.$element.addClass("ui-selecting"),c.selecting=!0,d._trigger("selecting",b,{selecting:c.element}))):(c.selecting&&((b.metaKey||b.ctrlKey)&&c.startselected?(c.$element.removeClass("ui-selecting"),c.selecting=!1,c.$element.addClass("ui-selected"),c.selected=!0):(c.$element.removeClass("ui-selecting"),c.selecting=!1,c.startselected&&(c.$element.addClass("ui-unselecting"),c.unselecting=!0),d._trigger("unselecting",b,{unselecting:c.element}))),c.selected&&(b.metaKey||b.ctrlKey||c.startselected||(c.$element.removeClass("ui-selected"),c.selected=!1,c.$element.addClass("ui-unselecting"),c.unselecting=!0,d._trigger("unselecting",b,{unselecting:c.element})))))}),!1}},_mouseStop:function(b){var c=this;return this.dragged=!1,a(".ui-unselecting",this.element[0]).each(function(){var d=a.data(this,"selectable-item");d.$element.removeClass("ui-unselecting"),d.unselecting=!1,d.startselected=!1,c._trigger("unselected",b,{unselected:d.element})}),a(".ui-selecting",this.element[0]).each(function(){var d=a.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass("ui-selected"),d.selecting=!1,d.selected=!0,d.startselected=!0,c._trigger("selected",b,{selected:d.element})}),this._trigger("stop",b),this.helper.remove(),!1}})});
|
||||
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/selectmenu.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/selectmenu.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/slider.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/slider.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/sortable.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/sortable.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/spinner.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/spinner.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/tabs.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/tabs.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/tooltip.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/tooltip.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/widget.min.js
vendored
Executable file
11
Kapitel_7/Lektion_4/wordpress/wp-includes/js/jquery/ui/widget.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
519
Kapitel_7/Lektion_4/wordpress/wp-includes/js/json2.js
Executable file
519
Kapitel_7/Lektion_4/wordpress/wp-includes/js/json2.js
Executable file
@@ -0,0 +1,519 @@
|
||||
/*
|
||||
json2.js
|
||||
2015-05-03
|
||||
|
||||
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. This file is provides the ES5 JSON capability to ES3 systems.
|
||||
If a project might run on IE8 or earlier, then this file should be included.
|
||||
This file does nothing on ES5 systems.
|
||||
|
||||
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
|
||||
eval, for, this
|
||||
*/
|
||||
|
||||
/*property
|
||||
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.
|
||||
|
||||
if (typeof JSON !== 'object') {
|
||||
JSON = {};
|
||||
}
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var rx_one = /^[\],:{}\s]*$/,
|
||||
rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
|
||||
rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
|
||||
rx_four = /(?:^|:|,)(?:\s*\[)+/g,
|
||||
rx_escapable = /[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
||||
|
||||
function f(n) {
|
||||
// Format integers to have at least two digits.
|
||||
return n < 10
|
||||
? '0' + n
|
||||
: n;
|
||||
}
|
||||
|
||||
function this_value() {
|
||||
return this.valueOf();
|
||||
}
|
||||
|
||||
if (typeof Date.prototype.toJSON !== 'function') {
|
||||
|
||||
Date.prototype.toJSON = function () {
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
Boolean.prototype.toJSON = this_value;
|
||||
Number.prototype.toJSON = this_value;
|
||||
String.prototype.toJSON = this_value;
|
||||
}
|
||||
|
||||
var gap,
|
||||
indent,
|
||||
meta,
|
||||
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.
|
||||
|
||||
rx_escapable.lastIndex = 0;
|
||||
return rx_escapable.test(string)
|
||||
? '"' + string.replace(rx_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') {
|
||||
meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"': '\\"',
|
||||
'\\': '\\\\'
|
||||
};
|
||||
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);
|
||||
rx_dangerous.lastIndex = 0;
|
||||
if (rx_dangerous.test(text)) {
|
||||
text = text.replace(rx_dangerous, 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 (
|
||||
rx_one.test(
|
||||
text
|
||||
.replace(rx_two, '@')
|
||||
.replace(rx_three, ']')
|
||||
.replace(rx_four, '')
|
||||
)
|
||||
) {
|
||||
|
||||
// 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
Kapitel_7/Lektion_4/wordpress/wp-includes/js/json2.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/json2.min.js
vendored
Executable file
@@ -0,0 +1 @@
|
||||
"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(a){return 10>a?"0"+a:a}function this_value(){return this.valueOf()}function quote(a){return rx_escapable.lastIndex=0,rx_escapable.test(a)?'"'+a.replace(rx_escapable,function(a){var b=meta[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g,h=gap,i=b[a];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(a)),"function"==typeof rep&&(i=rep.call(b,a,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";if(gap+=indent,g=[],"[object Array]"===Object.prototype.toString.apply(i)){for(f=i.length,c=0;f>c;c+=1)g[c]=str(c,i)||"null";return e=0===g.length?"[]":gap?"[\n"+gap+g.join(",\n"+gap)+"\n"+h+"]":"["+g.join(",")+"]",gap=h,e}if(rep&&"object"==typeof rep)for(f=rep.length,c=0;f>c;c+=1)"string"==typeof rep[c]&&(d=rep[c],e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));else for(d in i)Object.prototype.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));return e=0===g.length?"{}":gap?"{\n"+gap+g.join(",\n"+gap)+"\n"+h+"}":"{"+g.join(",")+"}",gap=h,e}}var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){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},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;"function"!=typeof JSON.stringify&&(meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(a,b,c){var d;if(gap="",indent="","number"==typeof c)for(d=0;c>d;d+=1)indent+=" ";else"string"==typeof c&&(indent=c);if(rep=b,b&&"function"!=typeof b&&("object"!=typeof b||"number"!=typeof b.length))throw new Error("JSON.stringify");return str("",{"":a})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&"object"==typeof e)for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&(d=walk(e,c),void 0!==d?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}();
|
||||
17
Kapitel_7/Lektion_4/wordpress/wp-includes/js/masonry.min.js
vendored
Executable file
17
Kapitel_7/Lektion_4/wordpress/wp-includes/js/masonry.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
933
Kapitel_7/Lektion_4/wordpress/wp-includes/js/mce-view.js
Executable file
933
Kapitel_7/Lektion_4/wordpress/wp-includes/js/mce-view.js
Executable file
@@ -0,0 +1,933 @@
|
||||
/* global tinymce */
|
||||
|
||||
/*
|
||||
* The TinyMCE view API.
|
||||
*
|
||||
* Note: this API is "experimental" meaning that it will probably change
|
||||
* in the next few releases based on feedback from 3.9.0.
|
||||
* If you decide to use it, please follow the development closely.
|
||||
*
|
||||
* Diagram
|
||||
*
|
||||
* |- registered view constructor (type)
|
||||
* | |- view instance (unique text)
|
||||
* | | |- editor 1
|
||||
* | | | |- view node
|
||||
* | | | |- view node
|
||||
* | | | |- ...
|
||||
* | | |- editor 2
|
||||
* | | | |- ...
|
||||
* | |- view instance
|
||||
* | | |- ...
|
||||
* |- registered view
|
||||
* | |- ...
|
||||
*/
|
||||
( function( window, wp, shortcode, $ ) {
|
||||
'use strict';
|
||||
|
||||
var views = {},
|
||||
instances = {};
|
||||
|
||||
wp.mce = wp.mce || {};
|
||||
|
||||
/**
|
||||
* wp.mce.views
|
||||
*
|
||||
* 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.views = {
|
||||
|
||||
/**
|
||||
* Registers a new view type.
|
||||
*
|
||||
* @param {String} type The view type.
|
||||
* @param {Object} extend An object to extend wp.mce.View.prototype with.
|
||||
*/
|
||||
register: function( type, extend ) {
|
||||
views[ type ] = wp.mce.View.extend( _.extend( extend, { type: type } ) );
|
||||
},
|
||||
|
||||
/**
|
||||
* Unregisters a view type.
|
||||
*
|
||||
* @param {String} type The view type.
|
||||
*/
|
||||
unregister: function( type ) {
|
||||
delete views[ type ];
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the settings of a view type.
|
||||
*
|
||||
* @param {String} type The view type.
|
||||
*
|
||||
* @return {Function} The view constructor.
|
||||
*/
|
||||
get: function( type ) {
|
||||
return views[ type ];
|
||||
},
|
||||
|
||||
/**
|
||||
* Unbinds all view nodes.
|
||||
* Runs before removing all view nodes from the DOM.
|
||||
*/
|
||||
unbind: function() {
|
||||
_.each( instances, function( instance ) {
|
||||
instance.unbind();
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Scans a given string for each view's pattern,
|
||||
* replacing any matches with markers,
|
||||
* and creates a new instance for every match.
|
||||
*
|
||||
* @param {String} content The string to scan.
|
||||
*
|
||||
* @return {String} The string with markers.
|
||||
*/
|
||||
setMarkers: function( content ) {
|
||||
var pieces = [ { content: content } ],
|
||||
self = this,
|
||||
instance, current;
|
||||
|
||||
_.each( views, function( view, type ) {
|
||||
current = pieces.slice();
|
||||
pieces = [];
|
||||
|
||||
_.each( current, function( piece ) {
|
||||
var remaining = piece.content,
|
||||
result, text;
|
||||
|
||||
// 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.prototype.match( remaining ) ) ) {
|
||||
// Any text before the match becomes an unprocessed piece.
|
||||
if ( result.index ) {
|
||||
pieces.push( { content: remaining.substring( 0, result.index ) } );
|
||||
}
|
||||
|
||||
instance = self.createInstance( type, result.content, result.options );
|
||||
text = instance.loader ? '.' : instance.text;
|
||||
|
||||
// Add the processed piece for the match.
|
||||
pieces.push( {
|
||||
content: instance.ignore ? text : '<p data-wpview-marker="' + instance.encodedText + '">' + text + '</p>',
|
||||
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 } );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
content = _.pluck( pieces, 'content' ).join( '' );
|
||||
return content.replace( /<p>\s*<p data-wpview-marker=/g, '<p data-wpview-marker=' ).replace( /<\/p>\s*<\/p>/g, '</p>' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a view instance.
|
||||
*
|
||||
* @param {String} type The view type.
|
||||
* @param {String} text The textual representation of the view.
|
||||
* @param {Object} options Options.
|
||||
* @param {Boolean} force Recreate the instance. Optional.
|
||||
*
|
||||
* @return {wp.mce.View} The view instance.
|
||||
*/
|
||||
createInstance: function( type, text, options, force ) {
|
||||
var View = this.get( type ),
|
||||
encodedText,
|
||||
instance;
|
||||
|
||||
text = tinymce.DOM.decode( text );
|
||||
|
||||
if ( ! force ) {
|
||||
instance = this.getInstance( text );
|
||||
|
||||
if ( instance ) {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
encodedText = encodeURIComponent( text );
|
||||
|
||||
options = _.extend( options || {}, {
|
||||
text: text,
|
||||
encodedText: encodedText
|
||||
} );
|
||||
|
||||
return instances[ encodedText ] = new View( options );
|
||||
},
|
||||
|
||||
/**
|
||||
* Get a view instance.
|
||||
*
|
||||
* @param {(String|HTMLElement)} object The textual representation of the view or the view node.
|
||||
*
|
||||
* @return {wp.mce.View} The view instance or undefined.
|
||||
*/
|
||||
getInstance: function( object ) {
|
||||
if ( typeof object === 'string' ) {
|
||||
return instances[ encodeURIComponent( object ) ];
|
||||
}
|
||||
|
||||
return instances[ $( object ).attr( 'data-wpview-text' ) ];
|
||||
},
|
||||
|
||||
/**
|
||||
* Given a view node, get the view's text.
|
||||
*
|
||||
* @param {HTMLElement} node The view node.
|
||||
*
|
||||
* @return {String} The textual representation of the view.
|
||||
*/
|
||||
getText: function( node ) {
|
||||
return decodeURIComponent( $( node ).attr( 'data-wpview-text' ) || '' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Renders all view nodes that are not yet rendered.
|
||||
*
|
||||
* @param {Boolean} force Rerender all view nodes.
|
||||
*/
|
||||
render: function( force ) {
|
||||
_.each( instances, function( instance ) {
|
||||
instance.render( force );
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the text of a given view node.
|
||||
*
|
||||
* @param {String} text The new text.
|
||||
* @param {tinymce.Editor} editor The TinyMCE editor instance the view node is in.
|
||||
* @param {HTMLElement} node The view node to update.
|
||||
* @param {Boolean} force Recreate the instance. Optional.
|
||||
*/
|
||||
update: function( text, editor, node, force ) {
|
||||
var instance = this.getInstance( node );
|
||||
|
||||
if ( instance ) {
|
||||
instance.update( text, editor, node, force );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Renders any editing interface based on the view type.
|
||||
*
|
||||
* @param {tinymce.Editor} editor The TinyMCE editor instance the view node is in.
|
||||
* @param {HTMLElement} node The view node to edit.
|
||||
*/
|
||||
edit: function( editor, node ) {
|
||||
var instance = this.getInstance( node );
|
||||
|
||||
if ( instance && instance.edit ) {
|
||||
instance.edit( instance.text, function( text, force ) {
|
||||
instance.update( text, editor, node, force );
|
||||
} );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove a given view node from the DOM.
|
||||
*
|
||||
* @param {tinymce.Editor} editor The TinyMCE editor instance the view node is in.
|
||||
* @param {HTMLElement} node The view node to remove.
|
||||
*/
|
||||
remove: function( editor, node ) {
|
||||
var instance = this.getInstance( node );
|
||||
|
||||
if ( instance ) {
|
||||
instance.remove( editor, node );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A Backbone-like View constructor intended for use when rendering a TinyMCE View.
|
||||
* The main difference is that the TinyMCE View is not tied to a particular DOM node.
|
||||
*
|
||||
* @param {Object} options Options.
|
||||
*/
|
||||
wp.mce.View = function( options ) {
|
||||
_.extend( this, options );
|
||||
this.initialize();
|
||||
};
|
||||
|
||||
wp.mce.View.extend = Backbone.View.extend;
|
||||
|
||||
_.extend( wp.mce.View.prototype, {
|
||||
|
||||
/**
|
||||
* The content.
|
||||
*
|
||||
* @type {*}
|
||||
*/
|
||||
content: null,
|
||||
|
||||
/**
|
||||
* Whether or not to display a loader.
|
||||
*
|
||||
* @type {Boolean}
|
||||
*/
|
||||
loader: true,
|
||||
|
||||
/**
|
||||
* Runs after the view instance is created.
|
||||
*/
|
||||
initialize: function() {},
|
||||
|
||||
/**
|
||||
* Retuns the content to render in the view node.
|
||||
*
|
||||
* @return {*}
|
||||
*/
|
||||
getContent: function() {
|
||||
return this.content;
|
||||
},
|
||||
|
||||
/**
|
||||
* Renders all view nodes tied to this view instance that are not yet rendered.
|
||||
*
|
||||
* @param {String} content The content to render. Optional.
|
||||
* @param {Boolean} force Rerender all view nodes tied to this view instance. Optional.
|
||||
*/
|
||||
render: function( content, force ) {
|
||||
if ( content != null ) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
content = this.getContent();
|
||||
|
||||
// If there's nothing to render an no loader needs to be shown, stop.
|
||||
if ( ! this.loader && ! content ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We're about to rerender all views of this instance, so unbind rendered views.
|
||||
force && this.unbind();
|
||||
|
||||
// Replace any left over markers.
|
||||
this.replaceMarkers();
|
||||
|
||||
if ( content ) {
|
||||
this.setContent( content, function( editor, node, contentNode ) {
|
||||
$( node ).data( 'rendered', true );
|
||||
this.bindNode.call( this, editor, node, contentNode );
|
||||
}, force ? null : false );
|
||||
} else {
|
||||
this.setLoader();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Binds a given node after its content is added to the DOM.
|
||||
*/
|
||||
bindNode: function() {},
|
||||
|
||||
/**
|
||||
* Unbinds a given node before its content is removed from the DOM.
|
||||
*/
|
||||
unbindNode: function() {},
|
||||
|
||||
/**
|
||||
* Unbinds all view nodes tied to this view instance.
|
||||
* Runs before their content is removed from the DOM.
|
||||
*/
|
||||
unbind: function() {
|
||||
this.getNodes( function( editor, node, contentNode ) {
|
||||
this.unbindNode.call( this, editor, node, contentNode );
|
||||
$( node ).trigger( 'wp-mce-view-unbind' );
|
||||
}, true );
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets all the TinyMCE editor instances that support views.
|
||||
*
|
||||
* @param {Function} callback A callback.
|
||||
*/
|
||||
getEditors: function( callback ) {
|
||||
_.each( tinymce.editors, function( editor ) {
|
||||
if ( editor.plugins.wpview ) {
|
||||
callback.call( this, editor );
|
||||
}
|
||||
}, this );
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets all view nodes tied to this view instance.
|
||||
*
|
||||
* @param {Function} callback A callback.
|
||||
* @param {Boolean} rendered Get (un)rendered view nodes. Optional.
|
||||
*/
|
||||
getNodes: function( callback, rendered ) {
|
||||
this.getEditors( function( editor ) {
|
||||
var self = this;
|
||||
|
||||
$( editor.getBody() )
|
||||
.find( '[data-wpview-text="' + self.encodedText + '"]' )
|
||||
.filter( function() {
|
||||
var data;
|
||||
|
||||
if ( rendered == null ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
data = $( this ).data( 'rendered' ) === true;
|
||||
|
||||
return rendered ? data : ! data;
|
||||
} )
|
||||
.each( function() {
|
||||
callback.call( self, editor, this, $( this ).find( '.wpview-content' ).get( 0 ) );
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets all marker nodes tied to this view instance.
|
||||
*
|
||||
* @param {Function} callback A callback.
|
||||
*/
|
||||
getMarkers: function( callback ) {
|
||||
this.getEditors( function( editor ) {
|
||||
var self = this;
|
||||
|
||||
$( editor.getBody() )
|
||||
.find( '[data-wpview-marker="' + this.encodedText + '"]' )
|
||||
.each( function() {
|
||||
callback.call( self, editor, this );
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Replaces all marker nodes tied to this view instance.
|
||||
*/
|
||||
replaceMarkers: function() {
|
||||
this.getMarkers( function( editor, node ) {
|
||||
var selected = node === editor.selection.getNode(),
|
||||
$viewNode;
|
||||
|
||||
if ( ! this.loader && $( node ).text() !== this.text ) {
|
||||
editor.dom.setAttrib( node, 'data-wpview-marker', null );
|
||||
return;
|
||||
}
|
||||
|
||||
$viewNode = editor.$(
|
||||
'<div class="wpview-wrap" data-wpview-text="' + this.encodedText + '" data-wpview-type="' + this.type + '">' +
|
||||
'<p class="wpview-selection-before">\u00a0</p>' +
|
||||
'<div class="wpview-body" contenteditable="false">' +
|
||||
'<div class="wpview-content wpview-type-' + this.type + '"></div>' +
|
||||
'</div>' +
|
||||
'<p class="wpview-selection-after">\u00a0</p>' +
|
||||
'</div>'
|
||||
);
|
||||
|
||||
editor.$( node ).replaceWith( $viewNode );
|
||||
|
||||
if ( selected ) {
|
||||
editor.wp.setViewCursor( false, $viewNode[0] );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes all marker nodes tied to this view instance.
|
||||
*/
|
||||
removeMarkers: function() {
|
||||
this.getMarkers( function( editor, node ) {
|
||||
editor.dom.setAttrib( node, 'data-wpview-marker', null );
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the content for all view nodes tied to this view instance.
|
||||
*
|
||||
* @param {*} content The content to set.
|
||||
* @param {Function} callback A callback. Optional.
|
||||
* @param {Boolean} rendered Only set for (un)rendered nodes. Optional.
|
||||
*/
|
||||
setContent: function( content, callback, rendered ) {
|
||||
if ( _.isObject( content ) && content.body.indexOf( '<script' ) !== -1 ) {
|
||||
this.setIframes( content.head || '', content.body, callback, rendered );
|
||||
} else if ( _.isString( content ) && content.indexOf( '<script' ) !== -1 ) {
|
||||
this.setIframes( '', content, callback, rendered );
|
||||
} else {
|
||||
this.getNodes( function( editor, node, contentNode ) {
|
||||
content = content.body || content;
|
||||
|
||||
if ( content.indexOf( '<iframe' ) !== -1 ) {
|
||||
content += '<div class="wpview-overlay"></div>';
|
||||
}
|
||||
|
||||
contentNode.innerHTML = '';
|
||||
contentNode.appendChild( _.isString( content ) ? editor.dom.createFragment( content ) : content );
|
||||
|
||||
callback && callback.call( this, editor, node, contentNode );
|
||||
}, rendered );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the content in an iframe for all view nodes tied to this view instance.
|
||||
*
|
||||
* @param {String} head HTML string to be added to the head of the document.
|
||||
* @param {String} body HTML string to be added to the body of the document.
|
||||
* @param {Function} callback A callback. Optional.
|
||||
* @param {Boolean} rendered Only set for (un)rendered nodes. Optional.
|
||||
*/
|
||||
setIframes: function( head, body, callback, rendered ) {
|
||||
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver,
|
||||
self = this;
|
||||
|
||||
this.getNodes( function( editor, node, contentNode ) {
|
||||
var dom = editor.dom,
|
||||
styles = '',
|
||||
bodyClasses = editor.getBody().className || '',
|
||||
editorHead = editor.getDoc().getElementsByTagName( 'head' )[0];
|
||||
|
||||
tinymce.each( dom.$( 'link[rel="stylesheet"]', editorHead ), function( link ) {
|
||||
if ( link.href && link.href.indexOf( 'skins/lightgray/content.min.css' ) === -1 &&
|
||||
link.href.indexOf( 'skins/wordpress/wp-content.css' ) === -1 ) {
|
||||
|
||||
styles += dom.getOuterHTML( link );
|
||||
}
|
||||
} );
|
||||
|
||||
if ( self.iframeHeight ) {
|
||||
dom.add( contentNode, 'div', { style: {
|
||||
width: '100%',
|
||||
height: self.iframeHeight
|
||||
} } );
|
||||
}
|
||||
|
||||
// Seems the browsers need a bit of time to insert/set the view nodes,
|
||||
// or the iframe will fail especially when switching Text => Visual.
|
||||
setTimeout( function() {
|
||||
var iframe, iframeDoc, observer, i, block;
|
||||
|
||||
contentNode.innerHTML = '';
|
||||
|
||||
iframe = dom.add( contentNode, 'iframe', {
|
||||
/* jshint scripturl: true */
|
||||
src: tinymce.Env.ie ? 'javascript:""' : '',
|
||||
frameBorder: '0',
|
||||
allowTransparency: 'true',
|
||||
scrolling: 'no',
|
||||
'class': 'wpview-sandbox',
|
||||
style: {
|
||||
width: '100%',
|
||||
display: 'block'
|
||||
},
|
||||
height: self.iframeHeight
|
||||
} );
|
||||
|
||||
dom.add( contentNode, 'div', { 'class': 'wpview-overlay' } );
|
||||
|
||||
iframeDoc = iframe.contentWindow.document;
|
||||
|
||||
iframeDoc.open();
|
||||
|
||||
iframeDoc.write(
|
||||
'<!DOCTYPE html>' +
|
||||
'<html>' +
|
||||
'<head>' +
|
||||
'<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' +
|
||||
head +
|
||||
styles +
|
||||
'<style>' +
|
||||
'html {' +
|
||||
'background: transparent;' +
|
||||
'padding: 0;' +
|
||||
'margin: 0;' +
|
||||
'}' +
|
||||
'body#wpview-iframe-sandbox {' +
|
||||
'background: transparent;' +
|
||||
'padding: 1px 0 !important;' +
|
||||
'margin: -1px 0 0 !important;' +
|
||||
'}' +
|
||||
'body#wpview-iframe-sandbox:before,' +
|
||||
'body#wpview-iframe-sandbox:after {' +
|
||||
'display: none;' +
|
||||
'content: "";' +
|
||||
'}' +
|
||||
'</style>' +
|
||||
'</head>' +
|
||||
'<body id="wpview-iframe-sandbox" class="' + bodyClasses + '">' +
|
||||
body +
|
||||
'</body>' +
|
||||
'</html>'
|
||||
);
|
||||
|
||||
iframeDoc.close();
|
||||
|
||||
function resize() {
|
||||
var $iframe;
|
||||
|
||||
if ( block ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the iframe still exists.
|
||||
if ( iframe.contentWindow ) {
|
||||
$iframe = $( iframe );
|
||||
self.iframeHeight = $( iframeDoc.body ).height();
|
||||
|
||||
if ( $iframe.height() !== self.iframeHeight ) {
|
||||
$iframe.height( self.iframeHeight );
|
||||
editor.nodeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( self.iframeHeight ) {
|
||||
block = true;
|
||||
|
||||
setTimeout( function() {
|
||||
block = false;
|
||||
resize();
|
||||
}, 3000 );
|
||||
}
|
||||
|
||||
$( iframe.contentWindow ).on( 'load', resize );
|
||||
|
||||
if ( MutationObserver ) {
|
||||
observer = new MutationObserver( _.debounce( resize, 100 ) );
|
||||
|
||||
observer.observe( iframeDoc.body, {
|
||||
attributes: true,
|
||||
childList: true,
|
||||
subtree: true
|
||||
} );
|
||||
|
||||
$( node ).one( 'wp-mce-view-unbind', function() {
|
||||
observer.disconnect();
|
||||
} );
|
||||
} else {
|
||||
for ( i = 1; i < 6; i++ ) {
|
||||
setTimeout( resize, i * 700 );
|
||||
}
|
||||
}
|
||||
|
||||
function classChange() {
|
||||
iframeDoc.body.className = editor.getBody().className;
|
||||
}
|
||||
|
||||
editor.on( 'wp-body-class-change', classChange );
|
||||
|
||||
$( node ).one( 'wp-mce-view-unbind', function() {
|
||||
editor.off( 'wp-body-class-change', classChange );
|
||||
} );
|
||||
|
||||
callback && callback.call( self, editor, node, contentNode );
|
||||
}, 50 );
|
||||
}, rendered );
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets a loader for all view nodes tied to this view instance.
|
||||
*/
|
||||
setLoader: function() {
|
||||
this.setContent(
|
||||
'<div class="loading-placeholder">' +
|
||||
'<div class="dashicons dashicons-admin-media"></div>' +
|
||||
'<div class="wpview-loading"><ins></ins></div>' +
|
||||
'</div>'
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets an error for all view nodes tied to this view instance.
|
||||
*
|
||||
* @param {String} message The error message to set.
|
||||
* @param {String} dashicon A dashicon ID. Optional. {@link https://developer.wordpress.org/resource/dashicons/}
|
||||
*/
|
||||
setError: function( message, dashicon ) {
|
||||
this.setContent(
|
||||
'<div class="wpview-error">' +
|
||||
'<div class="dashicons dashicons-' + ( dashicon || 'no' ) + '"></div>' +
|
||||
'<p>' + message + '</p>' +
|
||||
'</div>'
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Tries to find a text match in a given string.
|
||||
*
|
||||
* @param {String} content The string to scan.
|
||||
*
|
||||
* @return {Object}
|
||||
*/
|
||||
match: function( content ) {
|
||||
var match = shortcode.next( this.type, content );
|
||||
|
||||
if ( match ) {
|
||||
return {
|
||||
index: match.index,
|
||||
content: match.content,
|
||||
options: {
|
||||
shortcode: match.shortcode
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the text of a given view node.
|
||||
*
|
||||
* @param {String} text The new text.
|
||||
* @param {tinymce.Editor} editor The TinyMCE editor instance the view node is in.
|
||||
* @param {HTMLElement} node The view node to update.
|
||||
* @param {Boolean} force Recreate the instance. Optional.
|
||||
*/
|
||||
update: function( text, editor, node, force ) {
|
||||
_.find( views, function( view, type ) {
|
||||
var match = view.prototype.match( text );
|
||||
|
||||
if ( match ) {
|
||||
$( node ).data( 'rendered', false );
|
||||
editor.dom.setAttrib( node, 'data-wpview-text', encodeURIComponent( text ) );
|
||||
wp.mce.views.createInstance( type, text, match.options, force ).render();
|
||||
editor.focus();
|
||||
|
||||
return true;
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove a given view node from the DOM.
|
||||
*
|
||||
* @param {tinymce.Editor} editor The TinyMCE editor instance the view node is in.
|
||||
* @param {HTMLElement} node The view node to remove.
|
||||
*/
|
||||
remove: function( editor, node ) {
|
||||
this.unbindNode.call( this, editor, node, $( node ).find( '.wpview-content' ).get( 0 ) );
|
||||
$( node ).trigger( 'wp-mce-view-unbind' );
|
||||
editor.dom.remove( node );
|
||||
editor.focus();
|
||||
}
|
||||
} );
|
||||
} )( window, window.wp, window.wp.shortcode, window.jQuery );
|
||||
|
||||
/*
|
||||
* The WordPress core TinyMCE views.
|
||||
* Views for the gallery, audio, video, playlist and embed shortcodes,
|
||||
* and a view for embeddable URLs.
|
||||
*/
|
||||
( function( window, views, media, $ ) {
|
||||
var base, gallery, av, embed,
|
||||
schema, parser, serializer;
|
||||
|
||||
function verifyHTML( string ) {
|
||||
var settings = {};
|
||||
|
||||
if ( ! window.tinymce ) {
|
||||
return string.replace( /<[^>]+>/g, '' );
|
||||
}
|
||||
|
||||
if ( ! string || ( string.indexOf( '<' ) === -1 && string.indexOf( '>' ) === -1 ) ) {
|
||||
return string;
|
||||
}
|
||||
|
||||
schema = schema || new window.tinymce.html.Schema( settings );
|
||||
parser = parser || new window.tinymce.html.DomParser( settings, schema );
|
||||
serializer = serializer || new window.tinymce.html.Serializer( settings, schema );
|
||||
|
||||
return serializer.serialize( parser.parse( string, { forced_root_block: false } ) );
|
||||
}
|
||||
|
||||
base = {
|
||||
state: [],
|
||||
|
||||
edit: function( text, update ) {
|
||||
var type = this.type,
|
||||
frame = media[ type ].edit( text );
|
||||
|
||||
this.pausePlayers && this.pausePlayers();
|
||||
|
||||
_.each( this.state, function( state ) {
|
||||
frame.state( state ).on( 'update', function( selection ) {
|
||||
update( media[ type ].shortcode( selection ).string(), type === 'gallery' );
|
||||
} );
|
||||
} );
|
||||
|
||||
frame.on( 'close', function() {
|
||||
frame.detach();
|
||||
} );
|
||||
|
||||
frame.open();
|
||||
}
|
||||
};
|
||||
|
||||
gallery = _.extend( {}, base, {
|
||||
state: [ 'gallery-edit' ],
|
||||
template: media.template( 'editor-gallery' ),
|
||||
|
||||
initialize: function() {
|
||||
var attachments = media.gallery.attachments( this.shortcode, media.view.settings.post.id ),
|
||||
attrs = this.shortcode.attrs.named,
|
||||
self = this;
|
||||
|
||||
attachments.more()
|
||||
.done( function() {
|
||||
attachments = attachments.toJSON();
|
||||
|
||||
_.each( attachments, function( attachment ) {
|
||||
if ( attachment.sizes ) {
|
||||
if ( attrs.size && attachment.sizes[ attrs.size ] ) {
|
||||
attachment.thumbnail = attachment.sizes[ attrs.size ];
|
||||
} else if ( attachment.sizes.thumbnail ) {
|
||||
attachment.thumbnail = attachment.sizes.thumbnail;
|
||||
} else if ( attachment.sizes.full ) {
|
||||
attachment.thumbnail = attachment.sizes.full;
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
self.render( self.template( {
|
||||
verifyHTML: verifyHTML,
|
||||
attachments: attachments,
|
||||
columns: attrs.columns ? parseInt( attrs.columns, 10 ) : media.galleryDefaults.columns
|
||||
} ) );
|
||||
} )
|
||||
.fail( function( jqXHR, textStatus ) {
|
||||
self.setError( textStatus );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
av = _.extend( {}, base, {
|
||||
action: 'parse-media-shortcode',
|
||||
|
||||
initialize: function() {
|
||||
var self = this;
|
||||
|
||||
if ( this.url ) {
|
||||
this.loader = false;
|
||||
this.shortcode = media.embed.shortcode( {
|
||||
url: this.text
|
||||
} );
|
||||
}
|
||||
|
||||
wp.ajax.post( this.action, {
|
||||
post_ID: media.view.settings.post.id,
|
||||
type: this.shortcode.tag,
|
||||
shortcode: this.shortcode.string()
|
||||
} )
|
||||
.done( function( response ) {
|
||||
self.render( response );
|
||||
} )
|
||||
.fail( function( response ) {
|
||||
if ( self.url ) {
|
||||
self.ignore = true;
|
||||
self.removeMarkers();
|
||||
} else {
|
||||
self.setError( response.message || response.statusText, 'admin-media' );
|
||||
}
|
||||
} );
|
||||
|
||||
this.getEditors( function( editor ) {
|
||||
editor.on( 'wpview-selected', function() {
|
||||
self.pausePlayers();
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
pausePlayers: function() {
|
||||
this.getNodes( function( editor, node, content ) {
|
||||
var win = $( 'iframe.wpview-sandbox', content ).get( 0 );
|
||||
|
||||
if ( win && ( win = win.contentWindow ) && win.mejs ) {
|
||||
_.each( win.mejs.players, function( player ) {
|
||||
try {
|
||||
player.pause();
|
||||
} catch ( e ) {}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
embed = _.extend( {}, av, {
|
||||
action: 'parse-embed',
|
||||
|
||||
edit: function( text, update ) {
|
||||
var frame = media.embed.edit( text, this.url ),
|
||||
self = this;
|
||||
|
||||
this.pausePlayers();
|
||||
|
||||
frame.state( 'embed' ).props.on( 'change:url', function( model, url ) {
|
||||
if ( url && model.get( 'url' ) ) {
|
||||
frame.state( 'embed' ).metadata = model.toJSON();
|
||||
}
|
||||
} );
|
||||
|
||||
frame.state( 'embed' ).on( 'select', function() {
|
||||
var data = frame.state( 'embed' ).metadata;
|
||||
|
||||
if ( self.url ) {
|
||||
update( data.url );
|
||||
} else {
|
||||
update( media.embed.shortcode( data ).string() );
|
||||
}
|
||||
} );
|
||||
|
||||
frame.on( 'close', function() {
|
||||
frame.detach();
|
||||
} );
|
||||
|
||||
frame.open();
|
||||
}
|
||||
} );
|
||||
|
||||
views.register( 'gallery', _.extend( {}, gallery ) );
|
||||
|
||||
views.register( 'audio', _.extend( {}, av, {
|
||||
state: [ 'audio-details' ]
|
||||
} ) );
|
||||
|
||||
views.register( 'video', _.extend( {}, av, {
|
||||
state: [ 'video-details' ]
|
||||
} ) );
|
||||
|
||||
views.register( 'playlist', _.extend( {}, av, {
|
||||
state: [ 'playlist-edit', 'video-playlist-edit' ]
|
||||
} ) );
|
||||
|
||||
views.register( 'embed', _.extend( {}, embed ) );
|
||||
|
||||
views.register( 'embedURL', _.extend( {}, embed, {
|
||||
match: function( content ) {
|
||||
var re = /(^|<p>)(https?:\/\/[^\s"]+?)(<\/p>\s*|$)/gi,
|
||||
match = re.exec( content );
|
||||
|
||||
if ( match ) {
|
||||
return {
|
||||
index: match.index + match[1].length,
|
||||
content: match[2],
|
||||
options: {
|
||||
url: true
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
} ) );
|
||||
} )( window, window.wp.mce.views, window.wp.media, window.jQuery );
|
||||
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/mce-view.min.js
vendored
Executable file
1
Kapitel_7/Lektion_4/wordpress/wp-includes/js/mce-view.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user