kopia lustrzana https://github.com/OpenDroneMap/WebODM
Added missing lib files for slate
rodzic
a2606bbce5
commit
c403ea7023
|
@ -1,40 +1,39 @@
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
activesupport (5.0.1)
|
activesupport (5.0.2)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (~> 0.7)
|
i18n (~> 0.7)
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
addressable (2.5.0)
|
addressable (2.5.1)
|
||||||
public_suffix (~> 2.0, >= 2.0.2)
|
public_suffix (~> 2.0, >= 2.0.2)
|
||||||
autoprefixer-rails (6.7.2)
|
autoprefixer-rails (6.7.7.1)
|
||||||
execjs
|
execjs
|
||||||
backports (3.6.8)
|
backports (3.7.0)
|
||||||
coffee-script (2.4.1)
|
coffee-script (2.4.1)
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.12.2)
|
coffee-script-source (1.12.2)
|
||||||
compass-import-once (1.0.5)
|
compass-import-once (1.0.5)
|
||||||
sass (>= 3.2, < 3.5)
|
sass (>= 3.2, < 3.5)
|
||||||
concurrent-ruby (1.0.4)
|
concurrent-ruby (1.0.5)
|
||||||
contracts (0.13.0)
|
contracts (0.13.0)
|
||||||
dotenv (2.2.0)
|
dotenv (2.2.0)
|
||||||
em-websocket (0.5.1)
|
em-websocket (0.5.1)
|
||||||
eventmachine (>= 0.12.9)
|
eventmachine (>= 0.12.9)
|
||||||
http_parser.rb (~> 0.6.0)
|
http_parser.rb (~> 0.6.0)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
eventmachine (1.2.2)
|
eventmachine (1.2.3)
|
||||||
execjs (2.7.0)
|
execjs (2.7.0)
|
||||||
fast_blank (1.0.0)
|
fast_blank (1.0.0)
|
||||||
fastimage (2.0.1)
|
fastimage (2.1.0)
|
||||||
addressable (~> 2)
|
ffi (1.9.18)
|
||||||
ffi (1.9.17)
|
|
||||||
haml (4.0.7)
|
haml (4.0.7)
|
||||||
tilt
|
tilt
|
||||||
hamster (3.0.0)
|
hamster (3.0.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
hashie (3.5.2)
|
hashie (3.5.5)
|
||||||
http_parser.rb (0.6.0)
|
http_parser.rb (0.6.0)
|
||||||
i18n (0.7.0)
|
i18n (0.7.0)
|
||||||
kramdown (1.13.2)
|
kramdown (1.13.2)
|
||||||
|
@ -95,7 +94,7 @@ GEM
|
||||||
tilt (>= 1.4.1, < 3)
|
tilt (>= 1.4.1, < 3)
|
||||||
padrino-support (0.13.3.3)
|
padrino-support (0.13.3.3)
|
||||||
activesupport (>= 3.1)
|
activesupport (>= 3.1)
|
||||||
parallel (1.10.0)
|
parallel (1.11.1)
|
||||||
public_suffix (2.0.5)
|
public_suffix (2.0.5)
|
||||||
rack (2.0.1)
|
rack (2.0.1)
|
||||||
rack-livereload (0.3.16)
|
rack-livereload (0.3.16)
|
||||||
|
@ -106,16 +105,16 @@ GEM
|
||||||
redcarpet (3.3.4)
|
redcarpet (3.3.4)
|
||||||
rouge (2.0.7)
|
rouge (2.0.7)
|
||||||
sass (3.4.23)
|
sass (3.4.23)
|
||||||
servolux (0.12.0)
|
servolux (0.13.0)
|
||||||
sprockets (3.7.1)
|
sprockets (3.7.1)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (> 1, < 3)
|
rack (> 1, < 3)
|
||||||
thor (0.19.4)
|
thor (0.19.4)
|
||||||
thread_safe (0.3.5)
|
thread_safe (0.3.6)
|
||||||
tilt (2.0.6)
|
tilt (2.0.7)
|
||||||
tzinfo (1.2.2)
|
tzinfo (1.2.3)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
uglifier (3.0.4)
|
uglifier (3.1.12)
|
||||||
execjs (>= 0.3.0, < 3)
|
execjs (>= 0.3.0, < 3)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
module Multilang
|
||||||
|
def block_code(code, full_lang_name)
|
||||||
|
parts = full_lang_name.split('--')
|
||||||
|
rouge_lang_name = parts[0] || ""
|
||||||
|
super(code, rouge_lang_name).sub("highlight #{rouge_lang_name}") do |match|
|
||||||
|
match + " tab-" + full_lang_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
require 'middleman-core/renderers/redcarpet'
|
||||||
|
Middleman::Renderers::MiddlemanRedcarpetHTML.send :include, Multilang
|
|
@ -0,0 +1,169 @@
|
||||||
|
/**
|
||||||
|
* energize.js v0.1.0
|
||||||
|
*
|
||||||
|
* Speeds up click events on mobile devices.
|
||||||
|
* https://github.com/davidcalhoun/energize.js
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function() { // Sandbox
|
||||||
|
/**
|
||||||
|
* Don't add to non-touch devices, which don't need to be sped up
|
||||||
|
*/
|
||||||
|
if(!('ontouchstart' in window)) return;
|
||||||
|
|
||||||
|
var lastClick = {},
|
||||||
|
isThresholdReached, touchstart, touchmove, touchend,
|
||||||
|
click, closest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* isThresholdReached
|
||||||
|
*
|
||||||
|
* Compare touchstart with touchend xy coordinates,
|
||||||
|
* and only fire simulated click event if the coordinates
|
||||||
|
* are nearby. (don't want clicking to be confused with a swipe)
|
||||||
|
*/
|
||||||
|
isThresholdReached = function(startXY, xy) {
|
||||||
|
return Math.abs(startXY[0] - xy[0]) > 5 || Math.abs(startXY[1] - xy[1]) > 5;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* touchstart
|
||||||
|
*
|
||||||
|
* Save xy coordinates when the user starts touching the screen
|
||||||
|
*/
|
||||||
|
touchstart = function(e) {
|
||||||
|
this.startXY = [e.touches[0].clientX, e.touches[0].clientY];
|
||||||
|
this.threshold = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* touchmove
|
||||||
|
*
|
||||||
|
* Check if the user is scrolling past the threshold.
|
||||||
|
* Have to check here because touchend will not always fire
|
||||||
|
* on some tested devices (Kindle Fire?)
|
||||||
|
*/
|
||||||
|
touchmove = function(e) {
|
||||||
|
// NOOP if the threshold has already been reached
|
||||||
|
if(this.threshold) return false;
|
||||||
|
|
||||||
|
this.threshold = isThresholdReached(this.startXY, [e.touches[0].clientX, e.touches[0].clientY]);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* touchend
|
||||||
|
*
|
||||||
|
* If the user didn't scroll past the threshold between
|
||||||
|
* touchstart and touchend, fire a simulated click.
|
||||||
|
*
|
||||||
|
* (This will fire before a native click)
|
||||||
|
*/
|
||||||
|
touchend = function(e) {
|
||||||
|
// Don't fire a click if the user scrolled past the threshold
|
||||||
|
if(this.threshold || isThresholdReached(this.startXY, [e.changedTouches[0].clientX, e.changedTouches[0].clientY])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and fire a click event on the target element
|
||||||
|
* https://developer.mozilla.org/en/DOM/event.initMouseEvent
|
||||||
|
*/
|
||||||
|
var touch = e.changedTouches[0],
|
||||||
|
evt = document.createEvent('MouseEvents');
|
||||||
|
evt.initMouseEvent('click', true, true, window, 0, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
|
||||||
|
evt.simulated = true; // distinguish from a normal (nonsimulated) click
|
||||||
|
e.target.dispatchEvent(evt);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* click
|
||||||
|
*
|
||||||
|
* Because we've already fired a click event in touchend,
|
||||||
|
* we need to listed for all native click events here
|
||||||
|
* and suppress them as necessary.
|
||||||
|
*/
|
||||||
|
click = function(e) {
|
||||||
|
/**
|
||||||
|
* Prevent ghost clicks by only allowing clicks we created
|
||||||
|
* in the click event we fired (look for e.simulated)
|
||||||
|
*/
|
||||||
|
var time = Date.now(),
|
||||||
|
timeDiff = time - lastClick.time,
|
||||||
|
x = e.clientX,
|
||||||
|
y = e.clientY,
|
||||||
|
xyDiff = [Math.abs(lastClick.x - x), Math.abs(lastClick.y - y)],
|
||||||
|
target = closest(e.target, 'A') || e.target, // needed for standalone apps
|
||||||
|
nodeName = target.nodeName,
|
||||||
|
isLink = nodeName === 'A',
|
||||||
|
standAlone = window.navigator.standalone && isLink && e.target.getAttribute("href");
|
||||||
|
|
||||||
|
lastClick.time = time;
|
||||||
|
lastClick.x = x;
|
||||||
|
lastClick.y = y;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unfortunately Android sometimes fires click events without touch events (seen on Kindle Fire),
|
||||||
|
* so we have to add more logic to determine the time of the last click. Not perfect...
|
||||||
|
*
|
||||||
|
* Older, simpler check: if((!e.simulated) || standAlone)
|
||||||
|
*/
|
||||||
|
if((!e.simulated && (timeDiff < 500 || (timeDiff < 1500 && xyDiff[0] < 50 && xyDiff[1] < 50))) || standAlone) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
if(!standAlone) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special logic for standalone web apps
|
||||||
|
* See http://stackoverflow.com/questions/2898740/iphone-safari-web-app-opens-links-in-new-window
|
||||||
|
*/
|
||||||
|
if(standAlone) {
|
||||||
|
window.location = target.getAttribute("href");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an energize-focus class to the targeted link (mimics :focus behavior)
|
||||||
|
* TODO: test and/or remove? Does this work?
|
||||||
|
*/
|
||||||
|
if(!target || !target.classList) return;
|
||||||
|
target.classList.add("energize-focus");
|
||||||
|
window.setTimeout(function(){
|
||||||
|
target.classList.remove("energize-focus");
|
||||||
|
}, 150);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* closest
|
||||||
|
* @param {HTMLElement} node current node to start searching from.
|
||||||
|
* @param {string} tagName the (uppercase) name of the tag you're looking for.
|
||||||
|
*
|
||||||
|
* Find the closest ancestor tag of a given node.
|
||||||
|
*
|
||||||
|
* Starts at node and goes up the DOM tree looking for a
|
||||||
|
* matching nodeName, continuing until hitting document.body
|
||||||
|
*/
|
||||||
|
closest = function(node, tagName){
|
||||||
|
var curNode = node;
|
||||||
|
|
||||||
|
while(curNode !== document.body) { // go up the dom until we find the tag we're after
|
||||||
|
if(!curNode || curNode.nodeName === tagName) { return curNode; } // found
|
||||||
|
curNode = curNode.parentNode; // not found, so keep going up
|
||||||
|
}
|
||||||
|
|
||||||
|
return null; // not found
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add all delegated event listeners
|
||||||
|
*
|
||||||
|
* All the events we care about bubble up to document,
|
||||||
|
* so we can take advantage of event delegation.
|
||||||
|
*
|
||||||
|
* Note: no need to wait for DOMContentLoaded here
|
||||||
|
*/
|
||||||
|
document.addEventListener('touchstart', touchstart, false);
|
||||||
|
document.addEventListener('touchmove', touchmove, false);
|
||||||
|
document.addEventListener('touchend', touchend, false);
|
||||||
|
document.addEventListener('click', click, true); // TODO: why does this use capture?
|
||||||
|
|
||||||
|
})();
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,108 @@
|
||||||
|
/*
|
||||||
|
* jQuery Highlight plugin
|
||||||
|
*
|
||||||
|
* Based on highlight v3 by Johann Burkard
|
||||||
|
* http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html
|
||||||
|
*
|
||||||
|
* Code a little bit refactored and cleaned (in my humble opinion).
|
||||||
|
* Most important changes:
|
||||||
|
* - has an option to highlight only entire words (wordsOnly - false by default),
|
||||||
|
* - has an option to be case sensitive (caseSensitive - false by default)
|
||||||
|
* - highlight element tag and class names can be specified in options
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* // wrap every occurrance of text 'lorem' in content
|
||||||
|
* // with <span class='highlight'> (default options)
|
||||||
|
* $('#content').highlight('lorem');
|
||||||
|
*
|
||||||
|
* // search for and highlight more terms at once
|
||||||
|
* // so you can save some time on traversing DOM
|
||||||
|
* $('#content').highlight(['lorem', 'ipsum']);
|
||||||
|
* $('#content').highlight('lorem ipsum');
|
||||||
|
*
|
||||||
|
* // search only for entire word 'lorem'
|
||||||
|
* $('#content').highlight('lorem', { wordsOnly: true });
|
||||||
|
*
|
||||||
|
* // don't ignore case during search of term 'lorem'
|
||||||
|
* $('#content').highlight('lorem', { caseSensitive: true });
|
||||||
|
*
|
||||||
|
* // wrap every occurrance of term 'ipsum' in content
|
||||||
|
* // with <em class='important'>
|
||||||
|
* $('#content').highlight('ipsum', { element: 'em', className: 'important' });
|
||||||
|
*
|
||||||
|
* // remove default highlight
|
||||||
|
* $('#content').unhighlight();
|
||||||
|
*
|
||||||
|
* // remove custom highlight
|
||||||
|
* $('#content').unhighlight({ element: 'em', className: 'important' });
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009 Bartek Szopka
|
||||||
|
*
|
||||||
|
* Licensed under MIT license.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
jQuery.extend({
|
||||||
|
highlight: function (node, re, nodeName, className) {
|
||||||
|
if (node.nodeType === 3) {
|
||||||
|
var match = node.data.match(re);
|
||||||
|
if (match) {
|
||||||
|
var highlight = document.createElement(nodeName || 'span');
|
||||||
|
highlight.className = className || 'highlight';
|
||||||
|
var wordNode = node.splitText(match.index);
|
||||||
|
wordNode.splitText(match[0].length);
|
||||||
|
var wordClone = wordNode.cloneNode(true);
|
||||||
|
highlight.appendChild(wordClone);
|
||||||
|
wordNode.parentNode.replaceChild(highlight, wordNode);
|
||||||
|
return 1; //skip added node in parent
|
||||||
|
}
|
||||||
|
} else if ((node.nodeType === 1 && node.childNodes) && // only element nodes that have children
|
||||||
|
!/(script|style)/i.test(node.tagName) && // ignore script and style nodes
|
||||||
|
!(node.tagName === nodeName.toUpperCase() && node.className === className)) { // skip if already highlighted
|
||||||
|
for (var i = 0; i < node.childNodes.length; i++) {
|
||||||
|
i += jQuery.highlight(node.childNodes[i], re, nodeName, className);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
jQuery.fn.unhighlight = function (options) {
|
||||||
|
var settings = { className: 'highlight', element: 'span' };
|
||||||
|
jQuery.extend(settings, options);
|
||||||
|
|
||||||
|
return this.find(settings.element + "." + settings.className).each(function () {
|
||||||
|
var parent = this.parentNode;
|
||||||
|
parent.replaceChild(this.firstChild, this);
|
||||||
|
parent.normalize();
|
||||||
|
}).end();
|
||||||
|
};
|
||||||
|
|
||||||
|
jQuery.fn.highlight = function (words, options) {
|
||||||
|
var settings = { className: 'highlight', element: 'span', caseSensitive: false, wordsOnly: false };
|
||||||
|
jQuery.extend(settings, options);
|
||||||
|
|
||||||
|
if (words.constructor === String) {
|
||||||
|
words = [words];
|
||||||
|
}
|
||||||
|
words = jQuery.grep(words, function(word, i){
|
||||||
|
return word != '';
|
||||||
|
});
|
||||||
|
words = jQuery.map(words, function(word, i) {
|
||||||
|
return word.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
||||||
|
});
|
||||||
|
if (words.length == 0) { return this; };
|
||||||
|
|
||||||
|
var flag = settings.caseSensitive ? "" : "i";
|
||||||
|
var pattern = "(" + words.join("|") + ")";
|
||||||
|
if (settings.wordsOnly) {
|
||||||
|
pattern = "\\b" + pattern + "\\b";
|
||||||
|
}
|
||||||
|
var re = new RegExp(pattern, flag);
|
||||||
|
|
||||||
|
return this.each(function () {
|
||||||
|
jQuery.highlight(this, re, settings.element, settings.className);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
Plik diff jest za duży
Load Diff
Plik diff jest za duży
Load Diff
|
@ -0,0 +1,566 @@
|
||||||
|
/*! jQuery UI - v1.11.3 - 2015-02-12
|
||||||
|
* http://jqueryui.com
|
||||||
|
* Includes: widget.js
|
||||||
|
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
|
||||||
|
|
||||||
|
(function( factory ) {
|
||||||
|
if ( typeof define === "function" && define.amd ) {
|
||||||
|
|
||||||
|
// AMD. Register as an anonymous module.
|
||||||
|
define([ "jquery" ], factory );
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Browser globals
|
||||||
|
factory( jQuery );
|
||||||
|
}
|
||||||
|
}(function( $ ) {
|
||||||
|
/*!
|
||||||
|
* jQuery UI Widget 1.11.3
|
||||||
|
* http://jqueryui.com
|
||||||
|
*
|
||||||
|
* Copyright jQuery Foundation and other contributors
|
||||||
|
* Released under the MIT license.
|
||||||
|
* http://jquery.org/license
|
||||||
|
*
|
||||||
|
* http://api.jqueryui.com/jQuery.widget/
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var widget_uuid = 0,
|
||||||
|
widget_slice = Array.prototype.slice;
|
||||||
|
|
||||||
|
$.cleanData = (function( orig ) {
|
||||||
|
return function( elems ) {
|
||||||
|
var events, elem, i;
|
||||||
|
for ( i = 0; (elem = elems[i]) != null; i++ ) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
// Only trigger remove when necessary to save time
|
||||||
|
events = $._data( elem, "events" );
|
||||||
|
if ( events && events.remove ) {
|
||||||
|
$( elem ).triggerHandler( "remove" );
|
||||||
|
}
|
||||||
|
|
||||||
|
// http://bugs.jquery.com/ticket/8235
|
||||||
|
} catch ( e ) {}
|
||||||
|
}
|
||||||
|
orig( elems );
|
||||||
|
};
|
||||||
|
})( $.cleanData );
|
||||||
|
|
||||||
|
$.widget = function( name, base, prototype ) {
|
||||||
|
var fullName, existingConstructor, constructor, basePrototype,
|
||||||
|
// proxiedPrototype allows the provided prototype to remain unmodified
|
||||||
|
// so that it can be used as a mixin for multiple widgets (#8876)
|
||||||
|
proxiedPrototype = {},
|
||||||
|
namespace = name.split( "." )[ 0 ];
|
||||||
|
|
||||||
|
name = name.split( "." )[ 1 ];
|
||||||
|
fullName = namespace + "-" + name;
|
||||||
|
|
||||||
|
if ( !prototype ) {
|
||||||
|
prototype = base;
|
||||||
|
base = $.Widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create selector for plugin
|
||||||
|
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
|
||||||
|
return !!$.data( elem, fullName );
|
||||||
|
};
|
||||||
|
|
||||||
|
$[ namespace ] = $[ namespace ] || {};
|
||||||
|
existingConstructor = $[ namespace ][ name ];
|
||||||
|
constructor = $[ namespace ][ name ] = function( options, element ) {
|
||||||
|
// allow instantiation without "new" keyword
|
||||||
|
if ( !this._createWidget ) {
|
||||||
|
return new constructor( options, element );
|
||||||
|
}
|
||||||
|
|
||||||
|
// allow instantiation without initializing for simple inheritance
|
||||||
|
// must use "new" keyword (the code above always passes args)
|
||||||
|
if ( arguments.length ) {
|
||||||
|
this._createWidget( options, element );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// extend with the existing constructor to carry over any static properties
|
||||||
|
$.extend( constructor, existingConstructor, {
|
||||||
|
version: prototype.version,
|
||||||
|
// copy the object used to create the prototype in case we need to
|
||||||
|
// redefine the widget later
|
||||||
|
_proto: $.extend( {}, prototype ),
|
||||||
|
// track widgets that inherit from this widget in case this widget is
|
||||||
|
// redefined after a widget inherits from it
|
||||||
|
_childConstructors: []
|
||||||
|
});
|
||||||
|
|
||||||
|
basePrototype = new base();
|
||||||
|
// we need to make the options hash a property directly on the new instance
|
||||||
|
// otherwise we'll modify the options hash on the prototype that we're
|
||||||
|
// inheriting from
|
||||||
|
basePrototype.options = $.widget.extend( {}, basePrototype.options );
|
||||||
|
$.each( prototype, function( prop, value ) {
|
||||||
|
if ( !$.isFunction( value ) ) {
|
||||||
|
proxiedPrototype[ prop ] = value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
proxiedPrototype[ prop ] = (function() {
|
||||||
|
var _super = function() {
|
||||||
|
return base.prototype[ prop ].apply( this, arguments );
|
||||||
|
},
|
||||||
|
_superApply = function( args ) {
|
||||||
|
return base.prototype[ prop ].apply( this, args );
|
||||||
|
};
|
||||||
|
return function() {
|
||||||
|
var __super = this._super,
|
||||||
|
__superApply = this._superApply,
|
||||||
|
returnValue;
|
||||||
|
|
||||||
|
this._super = _super;
|
||||||
|
this._superApply = _superApply;
|
||||||
|
|
||||||
|
returnValue = value.apply( this, arguments );
|
||||||
|
|
||||||
|
this._super = __super;
|
||||||
|
this._superApply = __superApply;
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
});
|
||||||
|
constructor.prototype = $.widget.extend( basePrototype, {
|
||||||
|
// TODO: remove support for widgetEventPrefix
|
||||||
|
// always use the name + a colon as the prefix, e.g., draggable:start
|
||||||
|
// don't prefix for widgets that aren't DOM-based
|
||||||
|
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
|
||||||
|
}, proxiedPrototype, {
|
||||||
|
constructor: constructor,
|
||||||
|
namespace: namespace,
|
||||||
|
widgetName: name,
|
||||||
|
widgetFullName: fullName
|
||||||
|
});
|
||||||
|
|
||||||
|
// If this widget is being redefined then we need to find all widgets that
|
||||||
|
// are inheriting from it and redefine all of them so that they inherit from
|
||||||
|
// the new version of this widget. We're essentially trying to replace one
|
||||||
|
// level in the prototype chain.
|
||||||
|
if ( existingConstructor ) {
|
||||||
|
$.each( existingConstructor._childConstructors, function( i, child ) {
|
||||||
|
var childPrototype = child.prototype;
|
||||||
|
|
||||||
|
// redefine the child widget using the same prototype that was
|
||||||
|
// originally used, but inherit from the new version of the base
|
||||||
|
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
|
||||||
|
});
|
||||||
|
// remove the list of existing child constructors from the old constructor
|
||||||
|
// so the old child constructors can be garbage collected
|
||||||
|
delete existingConstructor._childConstructors;
|
||||||
|
} else {
|
||||||
|
base._childConstructors.push( constructor );
|
||||||
|
}
|
||||||
|
|
||||||
|
$.widget.bridge( name, constructor );
|
||||||
|
|
||||||
|
return constructor;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.widget.extend = function( target ) {
|
||||||
|
var input = widget_slice.call( arguments, 1 ),
|
||||||
|
inputIndex = 0,
|
||||||
|
inputLength = input.length,
|
||||||
|
key,
|
||||||
|
value;
|
||||||
|
for ( ; inputIndex < inputLength; inputIndex++ ) {
|
||||||
|
for ( key in input[ inputIndex ] ) {
|
||||||
|
value = input[ inputIndex ][ key ];
|
||||||
|
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
|
||||||
|
// Clone objects
|
||||||
|
if ( $.isPlainObject( value ) ) {
|
||||||
|
target[ key ] = $.isPlainObject( target[ key ] ) ?
|
||||||
|
$.widget.extend( {}, target[ key ], value ) :
|
||||||
|
// Don't extend strings, arrays, etc. with objects
|
||||||
|
$.widget.extend( {}, value );
|
||||||
|
// Copy everything else by reference
|
||||||
|
} else {
|
||||||
|
target[ key ] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.widget.bridge = function( name, object ) {
|
||||||
|
var fullName = object.prototype.widgetFullName || name;
|
||||||
|
$.fn[ name ] = function( options ) {
|
||||||
|
var isMethodCall = typeof options === "string",
|
||||||
|
args = widget_slice.call( arguments, 1 ),
|
||||||
|
returnValue = this;
|
||||||
|
|
||||||
|
if ( isMethodCall ) {
|
||||||
|
this.each(function() {
|
||||||
|
var methodValue,
|
||||||
|
instance = $.data( this, fullName );
|
||||||
|
if ( options === "instance" ) {
|
||||||
|
returnValue = instance;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( !instance ) {
|
||||||
|
return $.error( "cannot call methods on " + name + " prior to initialization; " +
|
||||||
|
"attempted to call method '" + options + "'" );
|
||||||
|
}
|
||||||
|
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
|
||||||
|
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
|
||||||
|
}
|
||||||
|
methodValue = instance[ options ].apply( instance, args );
|
||||||
|
if ( methodValue !== instance && methodValue !== undefined ) {
|
||||||
|
returnValue = methodValue && methodValue.jquery ?
|
||||||
|
returnValue.pushStack( methodValue.get() ) :
|
||||||
|
methodValue;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Allow multiple hashes to be passed on init
|
||||||
|
if ( args.length ) {
|
||||||
|
options = $.widget.extend.apply( null, [ options ].concat(args) );
|
||||||
|
}
|
||||||
|
|
||||||
|
this.each(function() {
|
||||||
|
var instance = $.data( this, fullName );
|
||||||
|
if ( instance ) {
|
||||||
|
instance.option( options || {} );
|
||||||
|
if ( instance._init ) {
|
||||||
|
instance._init();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$.data( this, fullName, new object( options, this ) );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
$.Widget = function( /* options, element */ ) {};
|
||||||
|
$.Widget._childConstructors = [];
|
||||||
|
|
||||||
|
$.Widget.prototype = {
|
||||||
|
widgetName: "widget",
|
||||||
|
widgetEventPrefix: "",
|
||||||
|
defaultElement: "<div>",
|
||||||
|
options: {
|
||||||
|
disabled: false,
|
||||||
|
|
||||||
|
// callbacks
|
||||||
|
create: null
|
||||||
|
},
|
||||||
|
_createWidget: function( options, element ) {
|
||||||
|
element = $( element || this.defaultElement || this )[ 0 ];
|
||||||
|
this.element = $( element );
|
||||||
|
this.uuid = widget_uuid++;
|
||||||
|
this.eventNamespace = "." + this.widgetName + this.uuid;
|
||||||
|
|
||||||
|
this.bindings = $();
|
||||||
|
this.hoverable = $();
|
||||||
|
this.focusable = $();
|
||||||
|
|
||||||
|
if ( element !== this ) {
|
||||||
|
$.data( element, this.widgetFullName, this );
|
||||||
|
this._on( true, this.element, {
|
||||||
|
remove: function( event ) {
|
||||||
|
if ( event.target === element ) {
|
||||||
|
this.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.document = $( element.style ?
|
||||||
|
// element within the document
|
||||||
|
element.ownerDocument :
|
||||||
|
// element is window or document
|
||||||
|
element.document || element );
|
||||||
|
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
|
||||||
|
}
|
||||||
|
|
||||||
|
this.options = $.widget.extend( {},
|
||||||
|
this.options,
|
||||||
|
this._getCreateOptions(),
|
||||||
|
options );
|
||||||
|
|
||||||
|
this._create();
|
||||||
|
this._trigger( "create", null, this._getCreateEventData() );
|
||||||
|
this._init();
|
||||||
|
},
|
||||||
|
_getCreateOptions: $.noop,
|
||||||
|
_getCreateEventData: $.noop,
|
||||||
|
_create: $.noop,
|
||||||
|
_init: $.noop,
|
||||||
|
|
||||||
|
destroy: function() {
|
||||||
|
this._destroy();
|
||||||
|
// we can probably remove the unbind calls in 2.0
|
||||||
|
// all event bindings should go through this._on()
|
||||||
|
this.element
|
||||||
|
.unbind( this.eventNamespace )
|
||||||
|
.removeData( this.widgetFullName )
|
||||||
|
// support: jquery <1.6.3
|
||||||
|
// http://bugs.jquery.com/ticket/9413
|
||||||
|
.removeData( $.camelCase( this.widgetFullName ) );
|
||||||
|
this.widget()
|
||||||
|
.unbind( this.eventNamespace )
|
||||||
|
.removeAttr( "aria-disabled" )
|
||||||
|
.removeClass(
|
||||||
|
this.widgetFullName + "-disabled " +
|
||||||
|
"ui-state-disabled" );
|
||||||
|
|
||||||
|
// clean up events and states
|
||||||
|
this.bindings.unbind( this.eventNamespace );
|
||||||
|
this.hoverable.removeClass( "ui-state-hover" );
|
||||||
|
this.focusable.removeClass( "ui-state-focus" );
|
||||||
|
},
|
||||||
|
_destroy: $.noop,
|
||||||
|
|
||||||
|
widget: function() {
|
||||||
|
return this.element;
|
||||||
|
},
|
||||||
|
|
||||||
|
option: function( key, value ) {
|
||||||
|
var options = key,
|
||||||
|
parts,
|
||||||
|
curOption,
|
||||||
|
i;
|
||||||
|
|
||||||
|
if ( arguments.length === 0 ) {
|
||||||
|
// don't return a reference to the internal hash
|
||||||
|
return $.widget.extend( {}, this.options );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( typeof key === "string" ) {
|
||||||
|
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
||||||
|
options = {};
|
||||||
|
parts = key.split( "." );
|
||||||
|
key = parts.shift();
|
||||||
|
if ( parts.length ) {
|
||||||
|
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
|
||||||
|
for ( i = 0; i < parts.length - 1; i++ ) {
|
||||||
|
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
|
||||||
|
curOption = curOption[ parts[ i ] ];
|
||||||
|
}
|
||||||
|
key = parts.pop();
|
||||||
|
if ( arguments.length === 1 ) {
|
||||||
|
return curOption[ key ] === undefined ? null : curOption[ key ];
|
||||||
|
}
|
||||||
|
curOption[ key ] = value;
|
||||||
|
} else {
|
||||||
|
if ( arguments.length === 1 ) {
|
||||||
|
return this.options[ key ] === undefined ? null : this.options[ key ];
|
||||||
|
}
|
||||||
|
options[ key ] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this._setOptions( options );
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
_setOptions: function( options ) {
|
||||||
|
var key;
|
||||||
|
|
||||||
|
for ( key in options ) {
|
||||||
|
this._setOption( key, options[ key ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
_setOption: function( key, value ) {
|
||||||
|
this.options[ key ] = value;
|
||||||
|
|
||||||
|
if ( key === "disabled" ) {
|
||||||
|
this.widget()
|
||||||
|
.toggleClass( this.widgetFullName + "-disabled", !!value );
|
||||||
|
|
||||||
|
// If the widget is becoming disabled, then nothing is interactive
|
||||||
|
if ( value ) {
|
||||||
|
this.hoverable.removeClass( "ui-state-hover" );
|
||||||
|
this.focusable.removeClass( "ui-state-focus" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
enable: function() {
|
||||||
|
return this._setOptions({ disabled: false });
|
||||||
|
},
|
||||||
|
disable: function() {
|
||||||
|
return this._setOptions({ disabled: true });
|
||||||
|
},
|
||||||
|
|
||||||
|
_on: function( suppressDisabledCheck, element, handlers ) {
|
||||||
|
var delegateElement,
|
||||||
|
instance = this;
|
||||||
|
|
||||||
|
// no suppressDisabledCheck flag, shuffle arguments
|
||||||
|
if ( typeof suppressDisabledCheck !== "boolean" ) {
|
||||||
|
handlers = element;
|
||||||
|
element = suppressDisabledCheck;
|
||||||
|
suppressDisabledCheck = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// no element argument, shuffle and use this.element
|
||||||
|
if ( !handlers ) {
|
||||||
|
handlers = element;
|
||||||
|
element = this.element;
|
||||||
|
delegateElement = this.widget();
|
||||||
|
} else {
|
||||||
|
element = delegateElement = $( element );
|
||||||
|
this.bindings = this.bindings.add( element );
|
||||||
|
}
|
||||||
|
|
||||||
|
$.each( handlers, function( event, handler ) {
|
||||||
|
function handlerProxy() {
|
||||||
|
// allow widgets to customize the disabled handling
|
||||||
|
// - disabled as an array instead of boolean
|
||||||
|
// - disabled class as method for disabling individual parts
|
||||||
|
if ( !suppressDisabledCheck &&
|
||||||
|
( instance.options.disabled === true ||
|
||||||
|
$( this ).hasClass( "ui-state-disabled" ) ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
||||||
|
.apply( instance, arguments );
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy the guid so direct unbinding works
|
||||||
|
if ( typeof handler !== "string" ) {
|
||||||
|
handlerProxy.guid = handler.guid =
|
||||||
|
handler.guid || handlerProxy.guid || $.guid++;
|
||||||
|
}
|
||||||
|
|
||||||
|
var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
|
||||||
|
eventName = match[1] + instance.eventNamespace,
|
||||||
|
selector = match[2];
|
||||||
|
if ( selector ) {
|
||||||
|
delegateElement.delegate( selector, eventName, handlerProxy );
|
||||||
|
} else {
|
||||||
|
element.bind( eventName, handlerProxy );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
_off: function( element, eventName ) {
|
||||||
|
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
|
||||||
|
this.eventNamespace;
|
||||||
|
element.unbind( eventName ).undelegate( eventName );
|
||||||
|
|
||||||
|
// Clear the stack to avoid memory leaks (#10056)
|
||||||
|
this.bindings = $( this.bindings.not( element ).get() );
|
||||||
|
this.focusable = $( this.focusable.not( element ).get() );
|
||||||
|
this.hoverable = $( this.hoverable.not( element ).get() );
|
||||||
|
},
|
||||||
|
|
||||||
|
_delay: function( handler, delay ) {
|
||||||
|
function handlerProxy() {
|
||||||
|
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
||||||
|
.apply( instance, arguments );
|
||||||
|
}
|
||||||
|
var instance = this;
|
||||||
|
return setTimeout( handlerProxy, delay || 0 );
|
||||||
|
},
|
||||||
|
|
||||||
|
_hoverable: function( element ) {
|
||||||
|
this.hoverable = this.hoverable.add( element );
|
||||||
|
this._on( element, {
|
||||||
|
mouseenter: function( event ) {
|
||||||
|
$( event.currentTarget ).addClass( "ui-state-hover" );
|
||||||
|
},
|
||||||
|
mouseleave: function( event ) {
|
||||||
|
$( event.currentTarget ).removeClass( "ui-state-hover" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
_focusable: function( element ) {
|
||||||
|
this.focusable = this.focusable.add( element );
|
||||||
|
this._on( element, {
|
||||||
|
focusin: function( event ) {
|
||||||
|
$( event.currentTarget ).addClass( "ui-state-focus" );
|
||||||
|
},
|
||||||
|
focusout: function( event ) {
|
||||||
|
$( event.currentTarget ).removeClass( "ui-state-focus" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
_trigger: function( type, event, data ) {
|
||||||
|
var prop, orig,
|
||||||
|
callback = this.options[ type ];
|
||||||
|
|
||||||
|
data = data || {};
|
||||||
|
event = $.Event( event );
|
||||||
|
event.type = ( type === this.widgetEventPrefix ?
|
||||||
|
type :
|
||||||
|
this.widgetEventPrefix + type ).toLowerCase();
|
||||||
|
// the original event may come from any element
|
||||||
|
// so we need to reset the target on the new event
|
||||||
|
event.target = this.element[ 0 ];
|
||||||
|
|
||||||
|
// copy original event properties over to the new event
|
||||||
|
orig = event.originalEvent;
|
||||||
|
if ( orig ) {
|
||||||
|
for ( prop in orig ) {
|
||||||
|
if ( !( prop in event ) ) {
|
||||||
|
event[ prop ] = orig[ prop ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.element.trigger( event, data );
|
||||||
|
return !( $.isFunction( callback ) &&
|
||||||
|
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
|
||||||
|
event.isDefaultPrevented() );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
||||||
|
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
|
||||||
|
if ( typeof options === "string" ) {
|
||||||
|
options = { effect: options };
|
||||||
|
}
|
||||||
|
var hasOptions,
|
||||||
|
effectName = !options ?
|
||||||
|
method :
|
||||||
|
options === true || typeof options === "number" ?
|
||||||
|
defaultEffect :
|
||||||
|
options.effect || defaultEffect;
|
||||||
|
options = options || {};
|
||||||
|
if ( typeof options === "number" ) {
|
||||||
|
options = { duration: options };
|
||||||
|
}
|
||||||
|
hasOptions = !$.isEmptyObject( options );
|
||||||
|
options.complete = callback;
|
||||||
|
if ( options.delay ) {
|
||||||
|
element.delay( options.delay );
|
||||||
|
}
|
||||||
|
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
|
||||||
|
element[ method ]( options );
|
||||||
|
} else if ( effectName !== method && element[ effectName ] ) {
|
||||||
|
element[ effectName ]( options.duration, options.easing, callback );
|
||||||
|
} else {
|
||||||
|
element.queue(function( next ) {
|
||||||
|
$( this )[ method ]();
|
||||||
|
if ( callback ) {
|
||||||
|
callback.call( element[ 0 ] );
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
var widget = $.widget;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}));
|
Plik diff jest za duży
Load Diff
Ładowanie…
Reference in New Issue