# HG changeset patch # User durandn # Date 1442592096 -7200 # Node ID 638ad584ca2765af42c388931311cbaf8af53b9d # Parent 8c8fd6a5bba959a937d84da93d027d180e50b00e updating libs for mdplayer diff -r 8c8fd6a5bba9 -r 638ad584ca27 server/src/remie/static/remie/js/LdtPlayer-release.js --- a/server/src/remie/static/remie/js/LdtPlayer-release.js Fri Sep 18 17:21:49 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6487 +0,0 @@ -/* - * - * Copyright 2010-2012 Institut de recherche et d'innovation - * contributor(s) : Karim Hamidou, Samuel Huron, Raphael Velt, Thibaut Cavalie - * - * contact@iri.centrepompidou.fr - * http://www.iri.centrepompidou.fr - * - * This software is a computer program whose purpose is to show and add annotations on a video . - * This software is governed by the CeCILL-C license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL-C - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL-C license and that you accept its terms. -*/ -/*! LAB.js (LABjs :: Loading And Blocking JavaScript) - v2.0.3 (c) Kyle Simpson - MIT License -*/ - -(function(global){ - var _$LAB = global.$LAB, - - // constants for the valid keys of the options object - _UseLocalXHR = "UseLocalXHR", - _AlwaysPreserveOrder = "AlwaysPreserveOrder", - _AllowDuplicates = "AllowDuplicates", - _CacheBust = "CacheBust", - /*!START_DEBUG*/_Debug = "Debug",/*!END_DEBUG*/ - _BasePath = "BasePath", - - // stateless variables used across all $LAB instances - root_page = /^[^?#]*\//.exec(location.href)[0], - root_domain = /^\w+\:\/\/\/?[^\/]+/.exec(root_page)[0], - append_to = document.head || document.getElementsByTagName("head"), - - // inferences... ick, but still necessary - opera_or_gecko = (global.opera && Object.prototype.toString.call(global.opera) == "[object Opera]") || ("MozAppearance" in document.documentElement.style), - -/*!START_DEBUG*/ - // console.log() and console.error() wrappers - log_msg = function(){}, - log_error = log_msg, -/*!END_DEBUG*/ - - // feature sniffs (yay!) - test_script_elem = document.createElement("script"), - explicit_preloading = typeof test_script_elem.preload == "boolean", // http://wiki.whatwg.org/wiki/Script_Execution_Control#Proposal_1_.28Nicholas_Zakas.29 - real_preloading = explicit_preloading || (test_script_elem.readyState && test_script_elem.readyState == "uninitialized"), // will a script preload with `src` set before DOM append? - script_ordered_async = !real_preloading && test_script_elem.async === true, // http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order - - // XHR preloading (same-domain) and cache-preloading (remote-domain) are the fallbacks (for some browsers) - xhr_or_cache_preloading = !real_preloading && !script_ordered_async && !opera_or_gecko - ; - -/*!START_DEBUG*/ - // define console wrapper functions if applicable - if (global.console && global.console.log) { - if (!global.console.error) global.console.error = global.console.log; - log_msg = function(msg) { global.console.log(msg); }; - log_error = function(msg,err) { global.console.error(msg,err); }; - } -/*!END_DEBUG*/ - - // test for function - function is_func(func) { return Object.prototype.toString.call(func) == "[object Function]"; } - - // test for array - function is_array(arr) { return Object.prototype.toString.call(arr) == "[object Array]"; } - - // make script URL absolute/canonical - function canonical_uri(src,base_path) { - var absolute_regex = /^\w+\:\/\//; - - // is `src` is protocol-relative (begins with // or ///), prepend protocol - if (/^\/\/\/?/.test(src)) { - src = location.protocol + src; - } - // is `src` page-relative? (not an absolute URL, and not a domain-relative path, beginning with /) - else if (!absolute_regex.test(src) && src.charAt(0) != "/") { - // prepend `base_path`, if any - src = (base_path || "") + src; - } - // make sure to return `src` as absolute - return absolute_regex.test(src) ? src : ((src.charAt(0) == "/" ? root_domain : root_page) + src); - } - - // merge `source` into `target` - function merge_objs(source,target) { - for (var k in source) { if (source.hasOwnProperty(k)) { - target[k] = source[k]; // TODO: does this need to be recursive for our purposes? - }} - return target; - } - - // does the chain group have any ready-to-execute scripts? - function check_chain_group_scripts_ready(chain_group) { - var any_scripts_ready = false; - for (var i=0; i 0) { - for (var i=0; i=0;) { - val = queue.shift(); - $L = $L[val.type].apply(null,val.args); - } - return $L; - }, - - // rollback `[global].$LAB` to what it was before this file was loaded, the return this current instance of $LAB - noConflict:function(){ - global.$LAB = _$LAB; - return instanceAPI; - }, - - // create another clean instance of $LAB - sandbox:function(){ - return create_sandbox(); - } - }; - - return instanceAPI; - } - - // create the main instance of $LAB - global.$LAB = create_sandbox(); - - - /* The following "hack" was suggested by Andrea Giammarchi and adapted from: http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html - NOTE: this hack only operates in FF and then only in versions where document.readyState is not present (FF < 3.6?). - - The hack essentially "patches" the **page** that LABjs is loaded onto so that it has a proper conforming document.readyState, so that if a script which does - proper and safe dom-ready detection is loaded onto a page, after dom-ready has passed, it will still be able to detect this state, by inspecting the now hacked - document.readyState property. The loaded script in question can then immediately trigger any queued code executions that were waiting for the DOM to be ready. - For instance, jQuery 1.4+ has been patched to take advantage of document.readyState, which is enabled by this hack. But 1.3.2 and before are **not** safe or - fixed by this hack, and should therefore **not** be lazy-loaded by script loader tools such as LABjs. - */ - (function(addEvent,domLoaded,handler){ - if (document.readyState == null && document[addEvent]){ - document.readyState = "loading"; - document[addEvent](domLoaded,handler = function(){ - document.removeEventListener(domLoaded,handler,false); - document.readyState = "complete"; - },false); - } - })("addEventListener","DOMContentLoaded"); - -})(this);/* - mustache.js — Logic-less templates in JavaScript - - See http://mustache.github.com/ for more info. -*/ - -var Mustache = function () { - var _toString = Object.prototype.toString; - - Array.isArray = Array.isArray || function (obj) { - return _toString.call(obj) == "[object Array]"; - } - - var _trim = String.prototype.trim, trim; - - if (_trim) { - trim = function (text) { - return text == null ? "" : _trim.call(text); - } - } else { - var trimLeft, trimRight; - - // IE doesn't match non-breaking spaces with \s. - if ((/\S/).test("\xA0")) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; - } else { - trimLeft = /^\s+/; - trimRight = /\s+$/; - } - - trim = function (text) { - return text == null ? "" : - text.toString().replace(trimLeft, "").replace(trimRight, ""); - } - } - - var escapeMap = { - "&": "&", - "<": "<", - ">": ">", - '"': '"', - "'": ''' - }; - - function escapeHTML(string) { - return String(string).replace(/&(?!\w+;)|[<>"']/g, function (s) { - return escapeMap[s] || s; - }); - } - - var regexCache = {}; - var Renderer = function () {}; - - Renderer.prototype = { - otag: "{{", - ctag: "}}", - pragmas: {}, - buffer: [], - pragmas_implemented: { - "IMPLICIT-ITERATOR": true - }, - context: {}, - - render: function (template, context, partials, in_recursion) { - // reset buffer & set context - if (!in_recursion) { - this.context = context; - this.buffer = []; // TODO: make this non-lazy - } - - // fail fast - if (!this.includes("", template)) { - if (in_recursion) { - return template; - } else { - this.send(template); - return; - } - } - - // get the pragmas together - template = this.render_pragmas(template); - - // render the template - var html = this.render_section(template, context, partials); - - // render_section did not find any sections, we still need to render the tags - if (html === false) { - html = this.render_tags(template, context, partials, in_recursion); - } - - if (in_recursion) { - return html; - } else { - this.sendLines(html); - } - }, - - /* - Sends parsed lines - */ - send: function (line) { - if (line !== "") { - this.buffer.push(line); - } - }, - - sendLines: function (text) { - if (text) { - var lines = text.split("\n"); - for (var i = 0; i < lines.length; i++) { - this.send(lines[i]); - } - } - }, - - /* - Looks for %PRAGMAS - */ - render_pragmas: function (template) { - // no pragmas - if (!this.includes("%", template)) { - return template; - } - - var that = this; - var regex = this.getCachedRegex("render_pragmas", function (otag, ctag) { - return new RegExp(otag + "%([\\w-]+) ?([\\w]+=[\\w]+)?" + ctag, "g"); - }); - - return template.replace(regex, function (match, pragma, options) { - if (!that.pragmas_implemented[pragma]) { - throw({message: - "This implementation of mustache doesn't understand the '" + - pragma + "' pragma"}); - } - that.pragmas[pragma] = {}; - if (options) { - var opts = options.split("="); - that.pragmas[pragma][opts[0]] = opts[1]; - } - return ""; - // ignore unknown pragmas silently - }); - }, - - /* - Tries to find a partial in the curent scope and render it - */ - render_partial: function (name, context, partials) { - name = trim(name); - if (!partials || partials[name] === undefined) { - throw({message: "unknown_partial '" + name + "'"}); - } - if (!context || typeof context[name] != "object") { - return this.render(partials[name], context, partials, true); - } - return this.render(partials[name], context[name], partials, true); - }, - - /* - Renders inverted (^) and normal (#) sections - */ - render_section: function (template, context, partials) { - if (!this.includes("#", template) && !this.includes("^", template)) { - // did not render anything, there were no sections - return false; - } - - var that = this; - - var regex = this.getCachedRegex("render_section", function (otag, ctag) { - // This regex matches _the first_ section ({{#foo}}{{/foo}}), and captures the remainder - return new RegExp( - "^([\\s\\S]*?)" + // all the crap at the beginning that is not {{*}} ($1) - - otag + // {{ - "(\\^|\\#)\\s*(.+)\\s*" + // #foo (# == $2, foo == $3) - ctag + // }} - - "\n*([\\s\\S]*?)" + // between the tag ($2). leading newlines are dropped - - otag + // {{ - "\\/\\s*\\3\\s*" + // /foo (backreference to the opening tag). - ctag + // }} - - "\\s*([\\s\\S]*)$", // everything else in the string ($4). leading whitespace is dropped. - - "g"); - }); - - - // for each {{#foo}}{{/foo}} section do... - return template.replace(regex, function (match, before, type, name, content, after) { - // before contains only tags, no sections - var renderedBefore = before ? that.render_tags(before, context, partials, true) : "", - - // after may contain both sections and tags, so use full rendering function - renderedAfter = after ? that.render(after, context, partials, true) : "", - - // will be computed below - renderedContent, - - value = that.find(name, context); - - if (type === "^") { // inverted section - if (!value || Array.isArray(value) && value.length === 0) { - // false or empty list, render it - renderedContent = that.render(content, context, partials, true); - } else { - renderedContent = ""; - } - } else if (type === "#") { // normal section - if (Array.isArray(value)) { // Enumerable, Let's loop! - renderedContent = that.map(value, function (row) { - return that.render(content, that.create_context(row), partials, true); - }).join(""); - } else if (that.is_object(value)) { // Object, Use it as subcontext! - renderedContent = that.render(content, that.create_context(value), - partials, true); - } else if (typeof value == "function") { - // higher order section - renderedContent = value.call(context, content, function (text) { - return that.render(text, context, partials, true); - }); - } else if (value) { // boolean section - renderedContent = that.render(content, context, partials, true); - } else { - renderedContent = ""; - } - } - - return renderedBefore + renderedContent + renderedAfter; - }); - }, - - /* - Replace {{foo}} and friends with values from our view - */ - render_tags: function (template, context, partials, in_recursion) { - // tit for tat - var that = this; - - var new_regex = function () { - return that.getCachedRegex("render_tags", function (otag, ctag) { - return new RegExp(otag + "(=|!|>|&|\\{|%)?([^#\\^]+?)\\1?" + ctag + "+", "g"); - }); - }; - - var regex = new_regex(); - var tag_replace_callback = function (match, operator, name) { - switch(operator) { - case "!": // ignore comments - return ""; - case "=": // set new delimiters, rebuild the replace regexp - that.set_delimiters(name); - regex = new_regex(); - return ""; - case ">": // render partial - return that.render_partial(name, context, partials); - case "{": // the triple mustache is unescaped - case "&": // & operator is an alternative unescape method - return that.find(name, context); - default: // escape the value - return escapeHTML(that.find(name, context)); - } - }; - var lines = template.split("\n"); - for(var i = 0; i < lines.length; i++) { - lines[i] = lines[i].replace(regex, tag_replace_callback, this); - if (!in_recursion) { - this.send(lines[i]); - } - } - - if (in_recursion) { - return lines.join("\n"); - } - }, - - set_delimiters: function (delimiters) { - var dels = delimiters.split(" "); - this.otag = this.escape_regex(dels[0]); - this.ctag = this.escape_regex(dels[1]); - }, - - escape_regex: function (text) { - // thank you Simon Willison - if (!arguments.callee.sRE) { - var specials = [ - '/', '.', '*', '+', '?', '|', - '(', ')', '[', ']', '{', '}', '\\' - ]; - arguments.callee.sRE = new RegExp( - '(\\' + specials.join('|\\') + ')', 'g' - ); - } - return text.replace(arguments.callee.sRE, '\\$1'); - }, - - /* - find `name` in current `context`. That is find me a value - from the view object - */ - find: function (name, context) { - name = trim(name); - - // Checks whether a value is thruthy or false or 0 - function is_kinda_truthy(bool) { - return bool === false || bool === 0 || bool; - } - - var value; - - // check for dot notation eg. foo.bar - if (name.match(/([a-z_]+)\./ig)) { - var childValue = this.walk_context(name, context); - if (is_kinda_truthy(childValue)) { - value = childValue; - } - } else { - if (is_kinda_truthy(context[name])) { - value = context[name]; - } else if (is_kinda_truthy(this.context[name])) { - value = this.context[name]; - } - } - - if (typeof value == "function") { - return value.apply(context); - } - if (value !== undefined) { - return value; - } - // silently ignore unkown variables - return ""; - }, - - walk_context: function (name, context) { - var path = name.split('.'); - // if the var doesn't exist in current context, check the top level context - var value_context = (context[path[0]] != undefined) ? context : this.context; - var value = value_context[path.shift()]; - while (value != undefined && path.length > 0) { - value_context = value; - value = value[path.shift()]; - } - // if the value is a function, call it, binding the correct context - if (typeof value == "function") { - return value.apply(value_context); - } - return value; - }, - - // Utility methods - - /* includes tag */ - includes: function (needle, haystack) { - return haystack.indexOf(this.otag + needle) != -1; - }, - - // by @langalex, support for arrays of strings - create_context: function (_context) { - if (this.is_object(_context)) { - return _context; - } else { - var iterator = "."; - if (this.pragmas["IMPLICIT-ITERATOR"]) { - iterator = this.pragmas["IMPLICIT-ITERATOR"].iterator; - } - var ctx = {}; - ctx[iterator] = _context; - return ctx; - } - }, - - is_object: function (a) { - return a && typeof a == "object"; - }, - - /* - Why, why, why? Because IE. Cry, cry cry. - */ - map: function (array, fn) { - if (typeof array.map == "function") { - return array.map(fn); - } else { - var r = []; - var l = array.length; - for(var i = 0; i < l; i++) { - r.push(fn(array[i])); - } - return r; - } - }, - - getCachedRegex: function (name, generator) { - var byOtag = regexCache[this.otag]; - if (!byOtag) { - byOtag = regexCache[this.otag] = {}; - } - - var byCtag = byOtag[this.ctag]; - if (!byCtag) { - byCtag = byOtag[this.ctag] = {}; - } - - var regex = byCtag[name]; - if (!regex) { - regex = byCtag[name] = generator(this.otag, this.ctag); - } - - return regex; - } - }; - - return({ - name: "mustache.js", - version: "0.5.0-dev", - - /* - Turns a template and view into HTML - */ - to_html: function (template, view, partials, send_fun) { - var renderer = new Renderer(); - if (send_fun) { - renderer.send = send_fun; - } - renderer.render(template, view || {}, partials); - if (!send_fun) { - return renderer.buffer.join("\n"); - } - } - }); -}(); -// Underscore.js 1.2.3 -// (c) 2009-2011 Jeremy Ashkenas, DocumentCloud Inc. -// Underscore is freely distributable under the MIT license. -// Portions of Underscore are inspired or borrowed from Prototype, -// Oliver Steele's Functional, and John Resig's Micro-Templating. -// For all details and documentation: -// http://documentcloud.github.com/underscore -(function(){function r(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source== -c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&r(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(m.call(a,h)&&(f++,!(g=m.call(c,h)&&r(a[h],c[h],d))))break;if(g){for(h in c)if(m.call(c, -h)&&!f--)break;g=!f}}d.pop();return g}var s=this,F=s._,o={},k=Array.prototype,p=Object.prototype,i=k.slice,G=k.concat,H=k.unshift,l=p.toString,m=p.hasOwnProperty,v=k.forEach,w=k.map,x=k.reduce,y=k.reduceRight,z=k.filter,A=k.every,B=k.some,q=k.indexOf,C=k.lastIndexOf,p=Array.isArray,I=Object.keys,t=Function.prototype.bind,b=function(a){return new n(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else typeof define==="function"&& -define.amd?define("underscore",function(){return b}):s._=b;b.VERSION="1.2.3";var j=b.each=b.forEach=function(a,c,b){if(a!=null)if(v&&a.forEach===v)a.forEach(c,b);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a==null&&(a=[]);if(x&&a.reduce===x)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(y&&a.reduceRight===y)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g, -c,d,e):b.reduce(g,c)};b.find=b.detect=function(a,c,b){var e;D(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(z&&a.filter===z)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(A&&a.every===A)return a.every(c, -b);j(a,function(a,g,h){if(!(e=e&&c.call(b,a,g,h)))return o});return e};var D=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(B&&a.some===B)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return o});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return q&&a.indexOf===q?a.indexOf(c)!=-1:b=D(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(c.call?c||a:a[c]).apply(a, -d)})};b.pluck=function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex= -function(a,c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after= -function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=I||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],d;for(d in a)m.call(a,d)&&(b[b.length]=d);return b};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)b[d]!==void 0&&(a[d]=b[d])});return a};b.defaults=function(a){j(i.call(arguments, -1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return r(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(m.call(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=p||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a=== -Object(a)};b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!m.call(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)== -"[object Date]"};b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.noConflict=function(){s._=F;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a),function(c){J(c, -b[c]=a[c])})};var K=0;b.uniqueId=function(a){var b=K++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape,function(a,b){return"',_.escape("+b.replace(/\\'/g,"'")+"),'"}).replace(d.interpolate,function(a,b){return"',"+b.replace(/\\'/g, -"'")+",'"}).replace(d.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};var n=function(a){this._wrapped=a};b.prototype=n.prototype;var u=function(a,c){return c?b(a).chain():a},J=function(a,c){n.prototype[a]=function(){var a=i.call(arguments);H.call(a,this._wrapped);return u(c.apply(b, -a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];n.prototype[a]=function(){b.apply(this._wrapped,arguments);return u(this._wrapped,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];n.prototype[a]=function(){return u(b.apply(this._wrapped,arguments),this._chain)}});n.prototype.chain=function(){this._chain=true;return this};n.prototype.value=function(){return this._wrapped}}).call(this); -/* main file */ -// Why is it called main ? It only loads the libs ! - -if ( window.IriSP === undefined && window.__IriSP === undefined ) { - /** - @class - the object under which everything goes. - */ - IriSP = {}; - - /** Alias to IriSP for backward compatibility */ - __IriSP = IriSP; -} - -/* underscore comes bundled with the player and we need - it ASAP, so load it that way -*/ - -IriSP._ = window._.noConflict(); -IriSP.underscore = IriSP._; - -IriSP.getLib = function(lib) { - return ( - IriSP.libFiles.useCdn && typeof IriSP.libFiles.cdn[lib] == "string" - ? IriSP.libFiles.cdn[lib] - : ( - typeof IriSP.libFiles.locations[lib] == "string" - ? IriSP.libFiles.locations[lib] - : ( - typeof IriSP.libFiles.inDefaultDir[lib] == "string" - ? IriSP.libFiles.defaultDir + IriSP.libFiles.inDefaultDir[lib] - : null - ) - ) - ) -} - -IriSP.loadLibs = function( config, metadata_url, callback ) { - // Localize jQuery variable - IriSP.jQuery = null; - var $L = $LAB.script(IriSP.getLib("jQuery")).script(IriSP.getLib("swfObject")).wait() - .script(IriSP.getLib("jQueryUI")); - - if (config.player.type === "jwplayer" || config.player.type === "allocine") { - // load our popcorn.js lookalike - $L.script(IriSP.getLib("jwplayer")); - } else { - // load the real popcorn - $L.script(IriSP.getLib("popcorn")).script(IriSP.getLib("popcorn.code")); - if (config.player.type === "youtube") { - $L.script(IriSP.getLib("popcorn.youtube")); - } - if (config.player.type === "vimeo") - $L.script(IriSP.getLib("popcorn.vimeo")); - - /* do nothing for html5 */ - } - - /* widget specific requirements */ - for (var idx in config.gui.widgets) { - if (config.gui.widgets[idx].type === "PolemicWidget" || - config.gui.widgets[idx].type === "StackGraphWidget" || - config.gui.widgets[idx].type === "SparklineWidget") { - $L.script(IriSP.getLib("raphael")); - } - if (config.gui.widgets[idx].type === "TraceWidget") { - $L.script(IriSP.getLib("tracemanager")) - } - } - - // same for modules - /* - for (var idx in config.modules) { - if (config.modules[idx].type === "PolemicWidget") - $L.script(IriSP.getLib("raphaelJs")); - } - */ - - $L.wait(function() { - IriSP.jQuery = window.jQuery.noConflict( true ); - - var css_link_jquery = IriSP.jQuery( "", { - rel: "stylesheet", - type: "text/css", - href: IriSP.getLib("cssjQueryUI"), - 'class': "dynamic_css" - } ); - var css_link_custom = IriSP.jQuery( "", { - rel: "stylesheet", - type: "text/css", - href: config.gui.css, - 'class': "dynamic_css" - } ); - - css_link_jquery.appendTo('head'); - css_link_custom.appendTo('head'); - - IriSP.setupDataLoader(); - IriSP.__dataloader.get(metadata_url, - function(data) { - /* save the data so that we could re-use it to - configure the video - */ - IriSP.__jsonMetadata = data; - callback.call(window) }); - }); -}; -IriSP.annotation_template = "{{! template for an annotation displayed in a segmentWidget }}
"; -IriSP.annotationWidget_template = "{{! template for the annotation widget }}
"; -IriSP.annotation_loading_template = "{{! template shown while the annotation widget is loading }}
 
Chargement...
"; -IriSP.annotationsListWidget_template = "{{! template for the annotation list widget }}
"; -IriSP.arrowWidget_template = "
"; -IriSP.createAnnotationWidget_template = "{{! template for the annotation creation widget }}
{{^cinecast_version}}
{{/cinecast_version}}
{{#show_from_field}} {{/show_from_field}}
{{^user_avatar}} {{/user_avatar}} {{#user_avatar}} {{/user_avatar}}
{{#tags.length}}
    {{#tags}}
  • {{/tags}}
{{#random_tags}} {{/random_tags}} {{/tags.length}} {{#polemic_mode}} {{#polemics.length}}
    {{#polemics}}
  • {{/polemics}}
{{/polemics.length}} {{/polemic_mode}}
"; -IriSP.createAnnotation_errorMessage_template = "

{{l10n.empty_annotation}}

"; -IriSP.loading_template = "
{{l10n.loading_wait}}
"; -IriSP.overlay_marker_template = "{{! the template for the small bars which is z-indexed over our segment widget }}
"; -IriSP.player_template = "{{! template for the radio player }}
{{^disable_annotate_btn}}
{{/disable_annotate_btn}} {{^disable_search_btn}}
{{/disable_search_btn}}
00:00
/
00:00
"; -IriSP.search_template = "{{! template for the search container }}
"; -IriSP.share_template = "{{! social network sharing template }} "; -IriSP.sliceWidget_template = "{{! template for the slice widget }}
{{! the whole bar }}
{{! the zone which represents our slice }}
"; -IriSP.slideShareWidget_template = "{{! template for the slideShare widget of the other }}
"; -IriSP.sliderWidget_template = "{{! template for the slider widget - it's composed of two divs we one overlayed on top of the other }}
"; -IriSP.tooltip_template = "{{! template used by the jquery ui tooltip }}
{{title}}
{{begin}} : {{end}}
{{description}}
"; -IriSP.tooltipWidget_template = "{{! template for the tooltip widget }}
"; -IriSP.tweetWidget_template = "{{! template for the tweet widget }}";/* utils.js - various utils that don't belong anywhere else */ - -/* trace function, for debugging */ - -IriSP.traceNum = 0; -IriSP.trace = function( msg, value ) { -/* - if( IriSP.config.gui.debug === true ) { - IriSP.traceNum += 1; - IriSP.jQuery( "
"+IriSP.traceNum+" - "+msg+" : "+value+"
" ).appendTo( "#Ldt-output" ); - } -*/ -}; - -/* used in callbacks - because in callbacks we lose "this", - we need to have a special function which wraps "this" in - a closure. This way, the -*/ -IriSP.wrap = function (obj, fn) { - return function() { - var args = Array.prototype.slice.call(arguments, 0); - return fn.apply(obj, args); - } -} - -/* convert a time to a percentage in the media */ -IriSP.timeToPourcent = function(time, timetotal){ - var time = Math.abs(time); - var timetotal = Math.abs(timetotal); - - return Math.floor((time/timetotal) * 100); -}; - -IriSP.padWithZeros = function(num) { - if (Math.abs(num) < 10) { - return "0" + num.toString(); - } else { - return num.toString(); - } -}; - -/* convert a number of milliseconds to a tuple of the form - [hours, minutes, seconds] -*/ -IriSP.msToTime = function(ms) { - return IriSP.secondsToTime(ms / 1000); -} -/* convert a number of seconds to a tuple of the form - [hours, minutes, seconds] -*/ -IriSP.secondsToTime = function(secs) { - var hours = Math.abs(parseInt( secs / 3600 ) % 24); - var minutes = Math.abs(parseInt( secs / 60 ) % 60); - var seconds = parseFloat(Math.abs(secs % 60).toFixed(0)); - - var toString_fn = function() { - var ret = ""; - if (hours > 0) - ret = IriSP.padWithZeros(this.hours) + ":"; - ret += IriSP.padWithZeros(this.minutes) + ":" + IriSP.padWithZeros(this.seconds); - - return ret; - } - return {"hours" : hours, "minutes" : minutes, "seconds" : seconds, toString: toString_fn}; -}; - -/* format a tweet - replaces @name by a link to the profile, #hashtag, etc. */ -IriSP.formatTweet = function(tweet) { - /* - an array of arrays which hold a regexp and its replacement. - */ - var regExps = [ - /* copied from http://codegolf.stackexchange.com/questions/464/shortest-url-regex-match-in-javascript/480#480 */ - [/((https?:\/\/)?[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?)/gi, "$1"], - [/@(\w+)/gi, "@$1"], // matches a @handle - [/#(\w+)/gi, "#$1"],// matches a hashtag - [/(\+\+)/gi, "$1"], - [/(--)/gi, "$1"], - [/(==)/gi, "$1"], - [/(\?\?)/gi, "$1"] - ]; - - var i = 0; - for(i = 0; i < regExps.length; i++) { - tweet = tweet.replace(regExps[i][0], regExps[i][1]); - } - - return tweet; -}; - -IriSP.countProperties = function(obj) { - var count = 0; - - for(var prop in obj) { - if(obj.hasOwnProperty(prop)) - ++count; - } - - return count; -}; - -// conversion de couleur Decimal vers HexaDecimal || 000 si fff -IriSP.DEC_HEXA_COLOR = function (dec) { - var val = +dec; - var str = val.toString(16); - var zeroes = ""; - if (str.length < 6) { - for (var i = 0; i < 6 - str.length; i++) - zeroes += "0"; - } - return zeroes + str; -}; - -/* shortcut to have global variables in templates */ -IriSP.templToHTML = function(template, values) { - var params = IriSP.underscore.extend( - { "defaults" : IriSP.default_templates_vars, - "l10n" : IriSP.i18n.getMessages() - }, - values); - return Mustache.to_html(template, params); -}; - -/* we need to be stricter than encodeURIComponent, - because of twitter -*/ -IriSP.encodeURI = function(str) { - return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28'). - replace(/\)/g, '%29').replace(/\*/g, '%2A'); -} - -IriSP.jqEscape = function(text) { - return text.replace(/(:|\.)/g,'\\$1') -} - -IriSP.jqId = function (text) { - return IriSP.jQuery('#' + IriSP.jqEscape(text)); - } - -IriSP.__guidCounter = 0; -IriSP.guid = function(prefix) { - IriSP.__guidCounter += 1; - return prefix + IriSP.__guidCounter; -}; - -/** returns an url to share on facebook */ -IriSP.mkFbUrl = function(url, text) { - if (typeof(text) === "undefined") - text = "I'm watching "; - - return "http://www.facebook.com/share.php?u=" + IriSP.encodeURI(text) + IriSP.shorten_url(url); -}; - -/** returns an url to share on twitter */ -IriSP.mkTweetUrl = function(url, text) { - if (typeof(text) === "undefined") - text = "I'm watching "; - - return "http://twitter.com/home?status=" + IriSP.encodeURI(text) + IriSP.shorten_url(url); -}; - -/** returns an url to share on google + */ -IriSP.mkGplusUrl = function(url, text) { - return "https://plusone.google.com/_/+1/confirm?hl=en&url=" + IriSP.shorten_url(url); -}; - -/** test if a value is null or undefined */ -IriSP.null_or_undefined = function(val) { - return (typeof(val) === "undefined" || val === null); -}; - -/** get a property that can have multiple names **/ - -IriSP.get_aliased = function(_obj, _aliases) { - for (var _i = 0; _i < _aliases.length; _i++) { - if (typeof _obj[_aliases[_i]] !== "undefined") { - return _obj[_aliases[_i]]; - } - } - return null; -} - -/** issue a call to an url shortener and return the shortened url */ -IriSP.shorten_url = function(url) { - return encodeURIComponent(url); -}; - - -/* for ie compatibility -if (Object.prototype.__defineGetter__&&!Object.defineProperty) { - Object.defineProperty=function(obj,prop,desc) { - if ("get" in desc) obj.__defineGetter__(prop,desc.get); - if ("set" in desc) obj.__defineSetter__(prop,desc.set); - } -} -*/ - -/* Creates regexps from text */ -IriSP.regexpFromText = function(_text) { - return new RegExp('(' + _text.replace(/(\W)/gim,'\\$1') + ')','gim'); -} -/* wrapper that simulates popcorn.js because - popcorn is a bit unstable at the time */ - -IriSP.PopcornReplacement = { -}; - -/** base class for our popcorn-compatible players. - */ -IriSP.PopcornReplacement.player = function(container, options) { - /* the jwplayer calls the callbacks in the global space so we need to - preserve them using IriSP.wrap */ - this.callbacks = { - onReady: IriSP.wrap(this, this.__initApi), - onTime: IriSP.wrap(this, this.__timeHandler), - onPlay: IriSP.wrap(this, this.__playHandler), - onPause: IriSP.wrap(this, this.__pauseHandler), - onSeek: IriSP.wrap(this, this.__seekHandler) - }; - - this.media = { - "paused": true, - "muted": false - }; - - this.container = container.slice(1); //eschew the '#' - - this.msgPump = {}; /* dictionnary used to receive and send messages */ - this.__codes = []; /* used to schedule the execution of a piece of code in - a segment (similar to the popcorn.code plugin). */ - - this._options = options; - -}; - -IriSP.PopcornReplacement.player.prototype.listen = function(msg, callback) { - if (!this.msgPump.hasOwnProperty(msg)) - this.msgPump[msg] = []; - - this.msgPump[msg].push(callback); -}; - -IriSP.PopcornReplacement.player.prototype.trigger = function(msg, params) { - if (!this.msgPump.hasOwnProperty(msg)) - return; - - var d = this.msgPump[msg]; - - for(var i = 0; i < d.length; i++) { - d[i].call(window, params); - } - -}; - -IriSP.PopcornReplacement.player.prototype.guid = function(prefix) { - var str = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { - var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); - return v.toString(16); - }); - - return prefix + str; -}; - -/** init the api after that flash player has been setup - called by the callback - defined by the embedded flash player -*/ -IriSP.PopcornReplacement.player.prototype.__initApi = function() { - this.trigger("loadedmetadata"); // we've done more than loading metadata of course, - // but popcorn doesn't need to know more. - this.media.muted = this.playerFns.getMute(); - /* some programmed segments are supposed to be run at the beginning */ - var i = 0; - for(i = 0; i < this.__codes.length; i++) { - var c = this.__codes[i]; - if (0 == c.start) { - c.onStart(); - } - - if (0 == c.end) { - c.onEnd(); - } - } -}; - -/* -IriSP.PopcornReplacement.jwplayer = function(container, options) { - IriSP.PopcornReplacement._container = container.slice(1); //eschew the '#' - options.events = { - onReady: IriSP.PopcornReplacement.__initApi, - onTime: IriSP.PopcornReplacement.__timeHandler, - onPlay: IriSP.PopcornReplacement.__playHandler, - onPause: IriSP.PopcornReplacement.__pauseHandler, - onSeek: IriSP.PopcornReplacement.__seekHandler - } - - jwplayer(IriSP.PopcornReplacement._container).setup(options); - IriSP.PopcornReplacement.media.duration = options.duration; - return IriSP.PopcornReplacement; -}; -*/ - -IriSP.PopcornReplacement.player.prototype.currentTime = function(time) { - if (typeof(time) === "undefined") { - return this.playerFns.getPosition(); - } else { - var currentTime = +time; - this.playerFns.seek(currentTime); - return currentTime; - } -}; - -IriSP.PopcornReplacement.player.prototype.play = function() { - this.media.paused = false; - this.trigger("play"); - //IriSP.PopcornReplacement.trigger("playing"); - this.playerFns.play(); -}; - -IriSP.PopcornReplacement.player.prototype.pause = function() { -// if ( !this.media.paused ) { - this.media.paused = true; - this.trigger( "pause" ); - this.playerFns.pause(); -// } -}; - -IriSP.PopcornReplacement.player.prototype.muted = function(val) { - if (typeof(val) !== "undefined") { - - if (this.playerFns.getMute() !== val) { - if (val) { - this.playerFns.setMute(true); - this.media.muted = true; - } else { - this.playerFns.setMute(false); - this.media.muted = false; - } - - this.trigger( "volumechange" ); - } - - return this.playerFns.getMute(); - } else { - return this.playerFns.getMute(); - } -}; - -IriSP.PopcornReplacement.player.prototype.volume = function(val) { - if (typeof this.playerFns.getVolume == "undefined" || typeof this.playerFns.setVolume == "undefined") { - return false; - } - var _vol = this.playerFns.getVolume(); - if (typeof(val) !== "undefined" && parseFloat(val) !== NaN) { - val = Math.max(0, Math.min(1, val)); - if (parseFloat(val) != parseFloat(_vol)) { - this.playerFns.setVolume(val); - this.trigger("volumechange"); - _vol = this.playerFns.getVolume(); - } - } - return _vol; -}; - -IriSP.PopcornReplacement.player.prototype.mute = IriSP.PopcornReplacement.player.prototype.muted; - -IriSP.PopcornReplacement.player.prototype.code = function(options) { - this.__codes.push(options); - return this; -}; - -/* called everytime the player updates itself - (onTime event) - */ - -IriSP.PopcornReplacement.player.prototype.__timeHandler = function(event) { - var pos = event.position; - - var i = 0; - for(i = 0; i < this.__codes.length; i++) { - var c = this.__codes[i]; - - if (pos >= c.start && pos < c.end && - pos - 1 <= c.start) { - c.onStart(); - } - - if (pos > c.start && pos > c.end && - pos - 1 <= c.end) { - c.onEnd(); - } - - } - - this.trigger("timeupdate"); -}; - -IriSP.PopcornReplacement.player.prototype.__seekHandler = function(event) { - var i = 0; - - for(i = 0; i < this.__codes.length; i++) { - var c = this.__codes[i]; - - if (event.position >= c.start && event.position < c.end) { - c.onEnd(); - } - } - - for(i = 0; i < this.__codes.length; i++) { - var c = this.__codes[i]; - - if (typeof(event.offset) === "undefined") - event.offset = 0; - - if (event.offset >= c.start && event.offset < c.end) { - c.onStart(); - } - - } - - /* this signal sends as an extra argument the position in the video. - As far as I know, this argument is not provided by popcorn */ - this.trigger("seeked", event.offset); -}; - -IriSP.PopcornReplacement.player.prototype.__playHandler = function(event) { - this.media.paused = false; - this.trigger("play"); -}; - -IriSP.PopcornReplacement.player.prototype.__pauseHandler = function(event) { - this.media.paused = true; - this.trigger("pause"); -}; - -IriSP.PopcornReplacement.player.prototype.roundTime = function() { - var currentTime = this.currentTime(); - return Math.round(currentTime); -};/* data.js - this file deals with how the players gets and sends data */ - -IriSP.DataLoader = function() { - this._cache = {}; - - /* - A structure to hold callbacks for specific urls. We need it because - ajax calls are asynchronous, so it means that sometimes we ask - multiple times for a ressource because the first call hasn't been - received yet. - */ - this._callbacks = {}; -}; - -IriSP.DataLoader.prototype.get = function(url, callback, force_reload) { - var base_url = url.split("&")[0]; - if (typeof force_reload != "undefined" && force_reload && this._cache.hasOwnProperty(base_url)) { - delete this._cache[base_url] - } - if (this._cache.hasOwnProperty(base_url)) { - callback(this._cache[base_url]); - } else { - if (!this._callbacks.hasOwnProperty(base_url)) { - this._callbacks[base_url] = [callback]; - /* we need a closure because this gets lost when it's called back */ - - // uncomment you don't want to use caching. - // IriSP.jQuery.get(url, callback); - - var func = function(data) { - this._cache[base_url] = data; - var i = 0; - - for (i = 0; i < this._callbacks[base_url].length; i++) { - this._callbacks[base_url][i](this._cache[base_url]); - } - delete this._callbacks[base_url]; - }; - - /* automagically choose between json and jsonp */ - if (url.indexOf(document.location.hostname) === -1 && - url.indexOf("http://") !== -1 /* not a relative url */ ) { - // we contacting a foreign domain, use JSONP - - IriSP.jQuery.get(url, {}, IriSP.wrap(this, func), "jsonp"); - } else { - - // otherwise, hey, whatever rows your boat - IriSP.jQuery.get(url, IriSP.wrap(this, func)); - } - - } else { - /* simply push the callback - it'll get called when the ressource - has been received */ - - this._callbacks[base_url].push(callback); - - } - } -} - -/* the base abstract "class" */ -IriSP.Serializer = function(DataLoader, url) { - this._DataLoader = DataLoader; - this._url = url; - this._data = []; -}; - -IriSP.Serializer.prototype.serialize = function(data) { }; -IriSP.Serializer.prototype.deserialize = function(data) {}; - -IriSP.Serializer.prototype.currentMedia = function() { -}; - -IriSP.Serializer.prototype.getDuration = function() { -}; - -IriSP.Serializer.prototype.sync = function(callback) { - callback.call(this, this._data); -}; - -IriSP.SerializerFactory = function(DataLoader) { - this._dataloader = DataLoader; -}; - -IriSP.SerializerFactory.prototype.getSerializer = function(metadataOptions) { - /* This function returns serializer set-up with the correct - configuration - takes a metadata struct describing the metadata source - */ - if (metadataOptions === undefined) - /* return an empty serializer */ - return IriSP.Serializer("", ""); - - switch(metadataOptions.type) { - case "json": - return new IriSP.JSONSerializer(this._dataloader, metadataOptions.src); - break; - - case "dummy": /* only used for unit testing - not defined in production */ - return new IriSP.MockSerializer(this._dataloader, metadataOptions.src); - break; - - case "empty": - return new IriSP.Serializer("", "empty"); - break; - - default: - return undefined; - } -}; -IriSP.language = 'en'; - -IriSP.libFiles = { - defaultDir : "js/libs/", - inDefaultDir : { - jQuery : "jquery.min.js", - jQueryUI : "jquery-ui.min.js", - jQueryToolTip : "jquery.tools.min.js", - swfObject : "swfobject.js", - //cssjQueryUI : "jquery-ui.css", - popcorn : "popcorn.js", - jwplayer : "jwplayer.js", - raphael : "raphael.js", - "popcorn.mediafragment" : "popcorn.mediafragment.js", - "popcorn.code" : "popcorn.code.js", - "popcorn.jwplayer" : "popcorn.jwplayer.js", - "popcorn.youtube" : "popcorn.youtube.js", - "tracemanager" : "tracemanager.js" - }, - locations : { - // use to define locations outside defautl_dir - }, - cdn : { - jQueryUI : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.js", - jQueryToolTip : "http://cdn.jquerytools.org/1.2.4/all/jquery.tools.min.js", - swfObject : "http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js", - cssjQueryUI : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/base/jquery-ui.css" - }, - useCdn : false -} - -IriSP.widgetsDefaults = { - "LayoutManager" : { - spacer_div_height : 0 - }, - "PlayerWidget" : { - - }, - "AnnotationsWidget" : { - "share_text" : "I'm watching " - }, - "TweetsWidget" : { - default_profile_picture : "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png", - tweet_display_period : 10000 // how long do we show a tweet ? - }, - "SliderWidget" : { - minimize_period : 850 // how long does the slider stays maximized after the user leaves the zone ? - }, - "SegmentsWidget" : { - cinecast_version : false - }, - "createAnnotationWidget" : { - tags : [ - { - "id" : "digitalstudies", - "meta" : { - "description" : "#digital-studies" - } - }, - { - "id" : "amateur", - "meta" : { - "description" : "#amateur" - }, - } - ], - remote_tags : false, - random_tags : false, - show_from_field : false, - disable_share : false, - return_delay : 10000, - polemic_mode : true, /* enable polemics ? */ - polemics : [{ - "className" : "positive", - "keyword" : "++" - }, { - "className" : "negative", - "keyword" : "--" - }, { - "className" : "reference", - "keyword" : "==" - }, { - "className" : "question", - "keyword" : "??" - }], - cinecast_version : false, /* put to false to enable the platform version, true for the festival cinecast one. */ - - /* where does the widget PUT the annotations - this is a mustache template. id refers to the id of the media ans is filled - by the widget. - */ - api_endpoint_template : "", // platform_url + "/ldtplatform/api/ldt/annotations/{{id}}.json", - api_method : "PUT" - }, - "SparklineWidget" : { - lineColor : "#7492b4", - fillColor : "#aeaeb8", - lineWidth : 2, - cinecast_version : false - }, - "AnnotationsListWidget" : { - ajax_mode : true, /* use ajax to get information about the annotations. - if set to false, only search in the annotations for the - current project. */ - /* the platform generates some funky urls. We replace them afterwards to point to the - correct place - this setting will probably be overwritten by the platform - implementers. - Note that the player has to replace the variables between {{ and }} by its own values. - */ - ajax_url : "", //platform_url + "/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}", - ajax_granularity : 10000, /* how much ms should we look before and after the current timecode */ - default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png", - project_url : "", //platform_url + "/ldtplatform/ldt/front/player/" - /* the beginning of a link to the new front */ - cinecast_version : false, - refresh_interval : 10000 - }, - "StackGraphWidget" : { - defaultcolor : "#585858", - tags : [ - { - "keywords" : [ "++" ], - "description" : "positif", - "color" : "#1D973D" - }, - { - "keywords" : [ "--" ], - "description" : "negatif", - "color" : "#CE0A15" - }, - { - "keywords" : [ "==" ], - "description" : "reference", - "color" : "#C5A62D" - }, - { - "keywords" : [ "??" ], - "description" : "question", - "color" : "#036AAE" - } - ], - streamgraph : false - } -}/* the widget classes and definitions */ - -/** - * @class Widget is an "abstract" class. It's mostly used to define some properties common to every widget. - * - * Note that widget constructors are never called directly by the user. Instead, the widgets are instantiated by functions - * defined in init.js - * - * @constructor - * @param Popcorn a reference to the popcorn Object - * @param config configuration options for the widget - * @param Serializer a serializer instance from which the widget reads data fromCharCode -*/ -IriSP.Widget = function(Popcorn, config, Serializer) { - - if (config === undefined || config === null) { - config = {} - } - - this._Popcorn = Popcorn; - this._config = config; - this._serializer = Serializer; - - if (config.hasOwnProperty("container")) { - this._id = config.container; - this.selector = IriSP.jQuery("#" + this._id); - } - - if (config.hasOwnProperty("spacer")) { - this._spacerId = config.spacer; - this.spacer = IriSP.jQuery("#" + this._spacerId); - } - - - if (config.hasOwnProperty("width")) { - // this.width and not this._width because we consider it public. - this.width = config.width; - } - - if (config.hasOwnProperty("height")) { - this.height = config.height; - } - - if (config.hasOwnProperty("heightmax")) { - this.heightmax = config.heightmax; - } - - if (config.hasOwnProperty("widthmax")) { - this.widthmax = config.widthmax; - } - - if (config.hasOwnProperty("layoutManager")) { - this.layoutManager = config.layoutManager; - } - if (typeof this.selector != "undefined") { - this.selector.addClass("Ldt-TraceMe").addClass("Ldt-Widget"); - this.selector.attr("widget-type", this._config.type); - } - - // Parsing Widget Defaults - var _this = this; - - if (typeof config.type == "string" && typeof IriSP.widgetsDefaults[config.type] == "object") { - IriSP._(IriSP.widgetsDefaults[config.type]).each(function(_v, _k) { - if (typeof config[_k] != "undefined") { - _this[_k] = config[_k]; - } else { - _this[_k] = _v; - } - }); - } - -}; - - -IriSP.Widget.prototype.currentMedia = function() { - return this._serializer.currentMedia(); -} - -IriSP.Widget.prototype.getDuration = function() { - return this._serializer.getDuration(); -} - -/** - * This method responsible of drawing a widget on screen. - */ -IriSP.Widget.prototype.draw = function() { - /* implemented by "sub-classes" */ -}; - -/** - * Optional method if you want your widget to support redraws. - */ -IriSP.Widget.prototype.redraw = function() { - /* implemented by "sub-classes" */ -}; -/* modules are non-graphical entities, similar to widgets */ - -IriSP.Module = function(Popcorn, config, Serializer) { - - if (config === undefined || config === null) { - config = {} - } - - this._Popcorn = Popcorn; - this._config = config; - this._serializer = Serializer; -}; -/* layout.js - very basic layout management */ - -/** - @class a layout manager manages a div and the layout of objects - inside it. -*/ -IriSP.LayoutManager = function(options) { - this._Popcorn = null; - this._widgets = []; - - this._div = "LdtPlayer"; - this._width = 640; - - if (options === undefined) { - options = {}; - }; - - if (options.hasOwnProperty('container')) { - this._div = options.container; - } - - if (options.hasOwnProperty('width')) { - this._width = options.width; - } - - if (options.hasOwnProperty('height')) { - this._height = options.height; - } - - /* this is a shortcut */ - this.selector = IriSP.jQuery("#" + this._div); - - this.selector.css({ - "width": this._width, - "clear": "both" - }); - - if (this._height !== undefined) - this.selector.css("height", this._height); -}; - -/** - Set the popcorn instance used by the manager. - - we need this special setter because of a chicken and egg problem : - we want the manager to use popcorn but the popcorn div will be managed - by the manager. So we need a way to set the instance the manager uses -*/ - -IriSP.LayoutManager.prototype.setPopcornInstance = function(popcorn) { - this._Popcorn = popcorn; -} - -/** create a subdiv with an unique id, and a spacer div as well. - @param widgetName the name of the widget. - @return an array of the form [createdivId, spacerdivId]. -*/ -IriSP.LayoutManager.prototype.createDiv = function(widgetName) { - if (typeof(widgetName) === "undefined") - widgetName = ""; - - var newDiv = IriSP.guid(this._div + "_widget_" + widgetName + "_"); - var spacerDiv = IriSP.guid("LdtPlayer_spacer_"); - this._widgets.push([widgetName, newDiv]); - - var divTempl = "
"); - - if (options.hasOwnProperty("width")) - IriSP.jQuery("#" + containerDiv).css("width", options.width); - - if (options.hasOwnProperty("height")) - IriSP.jQuery("#" + containerDiv).css("height", options.height); - - pop = Popcorn("#" + tmpId); - break; - - case "jwplayer": - var opts = IriSP.jQuery.extend({}, options); - delete opts.container; - delete opts.type; - - - /* Try to guess options.file and options.streamer only if file and streamer - are not already defined in the configuration */ - if (options.provider === "rtmp" && !opts.hasOwnProperty("file") && !opts.hasOwnProperty("streamer")) { - /* exit if we can't access the metadata */ - if (typeof(IriSP.__jsonMetadata) === "undefined") { - break; - }; - - // the json format is totally illogical - //opts.streamer = IriSP.__jsonMetadata["medias"][0]["meta"]["item"]["value"]; - //var source = IriSP.__jsonMetadata["medias"][0]["href"]; - - // the source if a full url but jwplayer wants an url relative to the - // streamer url, so we've got to remove the common part. - //opts.file = source.slice(opts.streamer.length); - - /* sometimes we get served a file with a wrong path and streamer. - as a streamer is of the form rtmp://domain/path/ and the media is - the rest, we uglily do this : - */ - opts.file = ""; - opts.streamer = ""; - var fullPath = IriSP.get_aliased(IriSP.__jsonMetadata["medias"][0], ["href","url"]); - - if (fullPath === null) { - console.log("no url or href field defined in the metadata."); - } - - var pathSplit = fullPath.split('/'); - - for (var i = 0; i < pathSplit.length; i++) { - if (i < 4) { - opts.streamer += pathSplit[i] + "/"; - } else { - opts.file += pathSplit[i]; - /* omit the last slash if we're on the last element */ - if (i < pathSplit.length - 1) - opts.file += "/"; - } - } - } else { - /* other providers type, video for instance - - pass everything as is */ - } - - if (!options.hasOwnProperty("flashplayer")) { - opts.flashplayer = IriSP.jwplayer_swf_path; - } - - if (!options.hasOwnProperty("controlbar.position")) { - opts["controlbar.position"] = "none"; - } - - pop = new IriSP.PopcornReplacement.jwplayer("#" + containerDiv, opts); - break; - - case "youtube": - var opts = IriSP.jQuery.extend({}, options); - delete opts.container; - opts.controls = 0; - opts.autostart = false; - templ = "width: {{width}}px; height: {{height}}px;"; - var str = Mustache.to_html(templ, {width: opts.width, height: opts.height}); - // Popcorn.youtube wants us to specify the size of the player in the style attribute of its container div. - IriSP.jQuery("#" + containerDiv).attr("style", str); - - pop = Popcorn.youtube("#" + containerDiv, opts.video, opts); - break; - - case "dailymotion": - pop = new IriSP.PopcornReplacement.dailymotion("#" + containerDiv, options); - break; - - case "allocine": - /* pass the options as-is to the allocine player and let it handle everything */ - pop = new IriSP.PopcornReplacement.allocine("#" + containerDiv, options); - break; - - default: - pop = undefined; - }; - - return pop; -}; - -/** Configure the gui and instantiate the widgets passed as parameters - @param guiOptions the gui object as seen in the examples. - */ -IriSP.configureWidgets = function (popcornInstance, layoutManager, guiOptions) { - - var serialFactory = new IriSP.SerializerFactory(IriSP.__dataloader); - var params = {width: guiOptions.width, height: guiOptions.height}; - - var default_options = guiOptions.default_options; - if (IriSP.null_or_undefined(default_options)) - default_options = {}; - - var ret_widgets = []; - var index; - for (index = 0; index < guiOptions.widgets.length; index++) { - var widget = IriSP.instantiateWidget(popcornInstance, serialFactory, layoutManager, guiOptions.widgets[index], default_options); - - ret_widgets.push(widget); - }; - - return ret_widgets; -}; - -/** configure modules. @see configureWidgets */ -IriSP.configureModules = function (popcornInstance, modulesList) { - if (IriSP.null_or_undefined(modulesList)) - return; - - var serialFactory = new IriSP.SerializerFactory(IriSP.__dataloader); - var ret_modules = []; - var index; - - for (index = 0; index < modulesList.length; index++) { - var moduleConfig = modulesList[index]; - - var serializer = serialFactory.getSerializer(moduleConfig.metadata); - var module = new IriSP[moduleConfig.type](popcornInstance, moduleConfig, serializer); - ret_modules.push(module); - }; - - return ret_modules; -}; - -/** instantiate a widget - only called by configureWidgets, never by the user. Handles widget - dependencies. - @param popcornInstance popcorn instance the widget will user - @param serialFactory serializer factory to instantiate the widget with - @param layoutManager layout manager - @param widgetConfig configuration options for the widget - @param defaultOptions a dictionnary with some options defined for every widget. - */ -IriSP.instantiateWidget = function(popcornInstance, serialFactory, layoutManager, widgetConfig, defaultOptions) { - - if (IriSP.null_or_undefined(defaultOptions)) { - defaultOptions = {}; - } - if (IriSP.null_or_undefined(widgetConfig)) { - return; - } - - widgetConfig = IriSP.underscore.defaults(widgetConfig, defaultOptions); - - var arr = IriSP.jQuery.extend({}, widgetConfig); - - /* create a div for those widgets who didn't already specify a container; */ - if (!arr.hasOwnProperty("container")) { - /* create div returns us a container for the widget and a spacer */ - var ret = layoutManager.createDiv(widgetConfig.type); - var container = ret[0]; - var spacer = ret[1]; - arr.container = container; - arr.spacer = spacer; - arr.layoutManager = layoutManager; - } - var serializer = serialFactory.getSerializer(widgetConfig.metadata); - - if (typeof serializer == "undefined") - debugger; - - // instantiate the object passed as a string - var widget = new IriSP[widgetConfig.type](popcornInstance, arr, serializer); - - if (widgetConfig.hasOwnProperty("requires")) { - // also create the widgets this one depends on. - // the dependency widget is available in the parent widget context as - // this.WidgetName (for instance, this.TipWidget); - - var i = 0; - for(i = 0; i < widgetConfig.requires.length; i++) { - var widgetName = widgetConfig.requires[i]["type"], - _configobj = IriSP.jQuery.extend({}, widgetConfig.requires[i]), - _div = document.createElement('div'), - _container = IriSP.guid(arr.container + '_' + widgetName + '_'); - _configobj.container = _container; - _div.id = _container; - widget.selector.append(_div); - widget[widgetName] = IriSP.instantiateWidget(popcornInstance, serialFactory, layoutManager, _configobj, defaultOptions); - } - } - - serializer.sync(IriSP.wrap(widget, function() { this.draw(); })); - return widget; -}; - -/** single point of entry for the metadataplayer */ -IriSP.initPlayer = function(config, metadata_url) { - document.getElementById(config.gui.container).innerHTML = IriSP.templToHTML(IriSP.loading_template, config.gui); - IriSP.loadLibs(config, metadata_url, - function() { - - var layoutManager = new IriSP.LayoutManager(config.gui); - - var pop = IriSP.configurePopcorn(layoutManager, config.player); - - IriSP._widgets = IriSP.configureWidgets(pop, layoutManager, config.gui); - IriSP._modules = IriSP.configureModules(pop, config.modules); - IriSP.jQuery('#Ldt-loader').detach(); - }); -};IriSP.I18n = function() { - this.messages = {}; - this.base_lang = 'en'; -} - -IriSP.I18n.prototype.getLanguage = function(lang) { - var _lang = ( - typeof lang != "undefined" - ? lang - : ( - typeof IriSP.language != "undefined" - ? IriSP.language - : this.base_lang - ) - ); - return ( - typeof this.messages[_lang] == "object" - ? _lang - : ( - typeof this.messages[this.base_lang] == "object" - ? this.base_lang - : null - ) - ) -} - -IriSP.I18n.prototype.getMessages = function(lang) { - var _lang = this.getLanguage(lang); - return ( - _lang != null - ? this.messages[_lang] - : {} - ); -} - -IriSP.I18n.prototype.getMessage = function(message, lang) { - var _msgs = this.getMessages(lang); - return ( - typeof _msgs[message] != "undefined" - ? _msgs[message] - : message - ) -} - -IriSP.I18n.prototype.addMessage = function(lang, messagekey, messagevalue) { - if (typeof this.messages[lang] == "undefined") { - this.messages[lang] = {}; - } - this.messages[lang][messagekey] = messagevalue; -} - -IriSP.I18n.prototype.addMessages = function(messagesObj) { - var _this = this; - IriSP.underscore(messagesObj).each(function(_messages, _lang) { - IriSP.underscore(_messages).each(function(_value, _key) { - _this.addMessage(_lang, _key, _value); - }) - }); -} - -IriSP.i18n = new IriSP.I18n(); - -IriSP.i18n.addMessages({ - "fr": { - "loading_wait": "Chargement en cours, veuillez patienter…" - }, - "en": { - "loading_wait": "Loading, please wait…" - } -}) -/* To wrap a player the develop should create a new class derived from -the IriSP.PopcornReplacement.player and defining the correct functions */ - -/** allocine player wrapper */ -IriSP.PopcornReplacement.allocine = function(container, options) { -// console.log("Calling allocine player"); - /* appel du parent pour initialiser les structures communes à tous les players */ - IriSP.PopcornReplacement.player.call(this, container, options); - - var _this = this; - - /* Définition des fonctions de l'API - */ - - this.playerFns = { - play : function() { - return _this.apiCall("play"); - }, - pause : function() { - return _this.apiCall("pause"); - }, - getPosition : function() { - return _this.apiCall("getSeek","return") || 0; - }, - seek : function(pos) { - return _this.apiCall("seek",pos); - }, - getMute : function() { - return _this.apiCall("getMute","return"); - }, - setMute : function(p) { - return _this.apiCall("setMute", p); - } - } - - window.onReady = IriSP.wrap(this, this.ready); - window.onAllocineStateChange = IriSP.wrap(this, this.stateHandler); - window.onTime = IriSP.wrap(this, this.progressHandler); - - var _videoUrl = ( - typeof options.directVideoPath == "string" - ? options.directVideoPath - : IriSP.get_aliased(IriSP.__jsonMetadata["medias"][0], ["href","url"]) - ); - var _flashVars = { - "streamFMS" : true, - "adVast" : false, - "lg" : "fr_cinecast", - "autoPlay" : options.autoPlay, - "directVideoTitle" : "", - "urlAcData" : options.urlAcData, - "directVideoPath" : _videoUrl, - "host" : "http://allocine.fr" - } - - if (typeof IriSP.__jsonMetadata["medias"][0].meta == "object" && typeof IriSP.__jsonMetadata["medias"][0].meta.subtitles == "string") { - _flashVars.subTitlePath = IriSP.__jsonMetadata["medias"][0].meta.subtitles; - } - - - var params = { - "allowScriptAccess" : "always", - "wmode": "opaque", - "flashvars" : IriSP.jQuery.param(_flashVars), - "allowfullscreen" : true - }; - var atts = { - id : this.container - }; - swfobject.embedSWF(options.acPlayerUrl, this.container, options.width, options.height, "10", null, null, params, atts); - -}; - -IriSP.PopcornReplacement.allocine.prototype = new IriSP.PopcornReplacement.player("", {}); - -IriSP.PopcornReplacement.allocine.prototype.ready = function() { - this.player = document.getElementById(this.container); - this.player.addEventListener("onStateChange", "onAllocineStateChange"); - this.player.cueVideoByUrl(this._options.video); - this.callbacks.onReady(); -}; - -IriSP.PopcornReplacement.allocine.prototype.progressHandler = function(progressInfo) { - this.callbacks.onTime({ - position: progressInfo.mediaTime - }); -} - - -IriSP.PopcornReplacement.allocine.prototype.apiCall = function(_method, _arg) { - if (this.player) { - try { - if (typeof _arg == "undefined") { - return this.player.sendToActionScript(_method); - } else { - return this.player.sendToActionScript(_method, _arg); - } - } catch(e) { - console.error('Exception while requesting AcPlayer for "' + _method + (typeof _arg == "undefined" ? '' : '" with argument "' + _arg ) + '"\n', e); - return false; - } - } else { - return false; - } -} - -IriSP.PopcornReplacement.allocine.prototype.stateHandler = function(state) { - console.log("stateHandler"); - switch(state) { - case 1: - this.callbacks.onPlay(); - break; - - case 2: - this.callbacks.onPause(); - break; - - case 3: - this.callbacks.onSeek({ - position: this.player.getCurrentTime() - }); - break; - - /* - case 5: - this.callbacks.onReady(); - break; - */ - } - -};/* To wrap a player the develop should create a new class derived from -the IriSP.PopcornReplacement.player and defining the correct functions */ - -/** jwplayer player wrapper */ -IriSP.PopcornReplacement.dailymotion = function(container, options) { - console.log("Calling"); - /* appel du parent pour initialiser les structures communes à tous les players */ - IriSP.PopcornReplacement.player.call(this, container, options); - - var _this = this; - - /* Définition des fonctions de l'API - */ - - this.playerFns = { - play : function() { - if (_this.player) { - return _this.player.playVideo(); - } else { - return false; - } - }, - pause : function() { - if (_this.player) { - return _this.player.pauseVideo(); - } else { - return false; - } - }, - getPosition : function() { - if (_this.player) { - return _this.player.getCurrentTime(); - } else { - return 0; - } - }, - seek : function(pos) { - if (_this.player) { - return _this.player.seekTo(pos); - } else { - return false; - } - }, - getMute : function() { - if (_this.player) { - return _this.player.isMuted(); - } else { - return false; - } - }, - setMute : function(p) { - if (_this.player) { - if (p) { - _this.player.mute(); - } - else { - _this.player.unMute(); - } - } - }, - getVolume : function() { - if (_this.player) { - return _this.player.getVolume() / 100; - } else { - return false; - } - }, - setVolume : function(p) { - if (_this.player) { - _this.player.setVolume(Math.floor(100 * p)); - } - }, - } - - window.onDailymotionPlayerReady = IriSP.wrap(this, this.ready); - window.onDailymotionStateChange = IriSP.wrap(this, this.stateHandler); - window.onDailymotionVideoProgress = IriSP.wrap(this, this.progressHandler); - - var params = { - "allowScriptAccess" : "always", - "wmode": "opaque" - }; - var atts = { - id : this.container - }; - swfobject.embedSWF("http://www.dailymotion.com/swf?chromeless=1&enableApi=1", this.container, options.width, options.height, "8", null, null, params, atts); - -}; - -IriSP.PopcornReplacement.dailymotion.prototype = new IriSP.PopcornReplacement.player("", {}); - -IriSP.PopcornReplacement.dailymotion.prototype.ready = function() { - - this.player = document.getElementById(this.container); - - this.player.addEventListener("onStateChange", "onDailymotionStateChange"); - this.player.addEventListener("onVideoProgress", "onDailymotionVideoProgress"); - this.player.cueVideoByUrl(this._options.video); - - this.callbacks.onReady(); -}; - -IriSP.PopcornReplacement.dailymotion.prototype.progressHandler = function(progressInfo) { - - this.callbacks.onTime({ - position: progressInfo.mediaTime - }); -} - -IriSP.PopcornReplacement.dailymotion.prototype.stateHandler = function(state) { - - switch(state) { - case 1: - this.callbacks.onPlay(); - break; - - case 2: - this.callbacks.onPause(); - break; - - case 3: - this.callbacks.onSeek({ - position: this.player.getCurrentTime() - }); - break; - - /* - case 5: - this.callbacks.onReady(); - break; - */ - } - -};/* To wrap a player the develop should create a new class derived from - the IriSP.PopcornReplacement.player and defining the correct functions */ - -/** jwplayer player wrapper */ -IriSP.PopcornReplacement.jwplayer = function(container, options) { - /* appel du parent pour initialiser les structures communes à tous les players */ - IriSP.PopcornReplacement.player.call(this, container, options); - - this.media.duration = options.duration; /* optional */ - - /* Définition des fonctions de l'API - */ - this.playerFns = { - play: function() { return jwplayer(this.container).play(); }, - pause: function() { return jwplayer(this.container).pause(); }, - getPosition: function() { return jwplayer(this.container).getPosition(); }, - seek: function(pos) { return jwplayer(this.container).seek(pos); }, - getMute: function() { return jwplayer(this.container).getMute() }, - setMute: function(p) { return jwplayer(this.container).setMute(p); }, - getVolume: function() { return jwplayer(this.container).getVolume() / 100; }, - setVolume: function(p) { return jwplayer(this.container).setVolume(Math.floor(100*p)); } - } - - options.events = this.callbacks; - - jwplayer(this.container).setup(options); -}; - -IriSP.PopcornReplacement.jwplayer.prototype = new IriSP.PopcornReplacement.player("", {}); -/* embed module - listens and relay hash changes to a parent window. */ - -IriSP.EmbedModule = function(Popcorn, config, Serializer) { - IriSP.Module.call(this, Popcorn, config, Serializer); - - window.addEventListener('message', IriSP.wrap(this, this.handleMessages), false); - this._Popcorn.listen("IriSP.Mediafragment.hashchange", IriSP.wrap(this, this.relayChanges)); -}; - -IriSP.EmbedModule.prototype = new IriSP.Module(); - -IriSP.EmbedModule.prototype.handleMessages = function(e) { - if (e.data.type === "hashchange") { - window.location.hash = e.data.value; - } -}; - -IriSP.EmbedModule.prototype.relayChanges = function(newHash) { - window.parent.postMessage({type: "hashchange", value: newHash}, "*"); - return; -};/* mediafragment module */ - -IriSP.MediaFragment = function(Popcorn, config, Serializer) { - IriSP.Module.call(this, Popcorn, config, Serializer); - - this.mutex = false; /* a mutex because we access the url from two different functions */ - - this._Popcorn.listen( "loadedmetadata", IriSP.wrap(this,this.advanceTime)); - this._Popcorn.listen( "pause", IriSP.wrap(this,this.updateTime)); - this._Popcorn.listen( "seeked", IriSP.wrap(this,this.updateTime)); - this._Popcorn.listen( "IriSP.PolemicTweet.click", IriSP.wrap(this,this.updateAnnotation)); - this._Popcorn.listen( "IriSP.SegmentsWidget.click", IriSP.wrap(this,this.updateAnnotation)); - - window.onhashchange = IriSP.wrap(this, this.advanceTime); -}; - -IriSP.MediaFragment.prototype = new IriSP.Module(); - -IriSP.MediaFragment.prototype.advanceTime = function() { - var url = window.location.href; - - if ( url.split( "#" )[ 1 ] != null ) { - pageoffset = url.split( "#" )[1]; - - if ( pageoffset.substring(0, 2) === "t=") { - // timecode - if ( pageoffset.substring( 2 ) != null ) { - var offsettime = pageoffset.substring( 2 ); - this._Popcorn.currentTime( parseFloat(offsettime) ); - - /* we have to trigger this signal manually because of a - bug in the jwplayer */ - this._Popcorn.trigger("seeked", parseFloat(offsettime)); - } - } else if ( pageoffset.substring(0, 3) === "id=") { - // annotation - var annotationId = pageoffset.substring( 3 ); - // there's no better way than that because - // of possible race conditions - this._serializer.sync(IriSP.wrap(this, function() { - this.lookupAnnotation.call(this, annotationId); - })); - } - } -}; - -/** handler for the seeked signal. It may have or may have not an argument. - @param time if not undefined, the time we're seeking to -*/ -IriSP.MediaFragment.prototype.updateTime = function(time) { - if (this.mutex === true) { - return; - } - - var history = window.history; - if ( !history.pushState ) { - return false; - } - - if (IriSP.null_or_undefined(time) || typeof(time) != "number") { - var ntime = this._Popcorn.currentTime().toFixed(2) - } else { - var ntime = time.toFixed(2); - } - - // used to relay the new hash to the embedder - this._Popcorn.trigger("IriSP.Mediafragment.hashchange", "#t=" + ntime); - - splitArr = window.location.href.split( "#" ) - history.replaceState( {}, "", splitArr[0] + "#t=" + ntime ); -}; - - -IriSP.MediaFragment.prototype.updateAnnotation = function(annotationId) { - var _this = this; - this.mutex = true; - - var history = window.history; - if ( !history.pushState ) { - return false; - } - - - // used to relay the new hash to the embedder - this._Popcorn.trigger("IriSP.Mediafragment.hashchange", "#id=" + annotationId); - - splitArr = window.location.href.split( "#" ) - history.replaceState( {}, "", splitArr[0] + "#id=" + annotationId); - - - // reset the mutex afterwards to prevent the module from reacting to his own changes. - window.setTimeout(function() { _this.mutex = false }, 50); -}; - -// lookup and seek to the beginning of an annotation -IriSP.MediaFragment.prototype.lookupAnnotation = function(annotationId) { - var _this = this; - this.mutex = true; - - var annotation = undefined; - var annotations = this._serializer._data.annotations; - - var i; - for (i = 0; i < annotations.length; i++) { - if (annotations[i].id === annotationId) { - annotation = annotations[i]; - break; - } - } - - if (typeof(annotation) !== "undefined") { - this._Popcorn.currentTime(annotation.begin / 1000); - - /* we have to trigger this signal manually because of a - bug in the jwplayer */ - this._Popcorn.trigger("seeked", annotation.begin / 1000); - this._Popcorn.trigger("IriSP.Mediafragment.showAnnotation", annotationId); - } - - window.setTimeout(function() { _this.mutex = false }, 50); -}; -IriSP.AnnotationsListWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); - this.__counter = 0; - this.__oldList = []; - this.searchRe = null; - this._ajax_cache = []; - var _this = this; - - this._Popcorn.listen("IriSP.search", function(searchString) { - _this.searchHandler(searchString); - }); - this._Popcorn.listen("IriSP.search.closed", function() { - _this.searchHandler(false); - }); - this._Popcorn.listen("IriSP.search.cleared", function() { - _this.searchHandler(false); - }); -}; - - -IriSP.AnnotationsListWidget.prototype = new IriSP.Widget(); - -IriSP.AnnotationsListWidget.prototype.clear = function() { -}; - -IriSP.AnnotationsListWidget.prototype.clearWidget = function() { -}; - -IriSP.AnnotationsListWidget.prototype.searchHandler = function(searchString) { - this.searchRe = (searchString && searchString.length) ? IriSP.regexpFromText(searchString) : null; - if (this.ajax_mode && !this.cinecast_version) { - var _this = this, - _annotations = ( - this.searchRe === null - ? this._ajax_cache - : IriSP.underscore.filter(this._ajax_cache, function(_a) { - return (_this.searchRe.test(_a.desc) || _this.searchRe.test(_a.title)); - }) - ); - this.do_redraw(_annotations); - if (_annotations.length) { - this._Popcorn.trigger("IriSP.search.matchFound"); - } else { - this._Popcorn.trigger("IriSP.search.noMatchFound"); - } - } else { - this.drawList(); - } -} - -/** effectively redraw the widget - called by drawList */ -IriSP.AnnotationsListWidget.prototype.do_redraw = function(list) { - var _html = IriSP.templToHTML( - IriSP.annotationsListWidget_template, { - annotations: list - }), - _this = this; - - this.selector.html(_html); - - this.selector.find('.Ldt-AnnotationsList-Tag-Li').click(function() { - _this._Popcorn.trigger("IriSP.search.triggeredSearch", IriSP.jQuery(this).text().trim()); - }) - - if (this.searchRe !== null) { - this.selector.find(".Ldt-AnnotationsList-Title a, .Ldt-AnnotationsList-Description") - .each(function() { - var _$ = IriSP.jQuery(this); - _$.html(_$.text().trim().replace(_this.searchRe, '$1')) - }) - } -}; - -IriSP.AnnotationsListWidget.prototype.transformAnnotation = function(a) { - var _this = this; - return { - "id" : a.id, - "title": this.cinecast_version ? IriSP.get_aliased(a.meta, ['creator_name', 'creator']) : a.content.title, - "desc" : this.cinecast_version ? a.content.data : a.content.description, - "begin": IriSP.msToTime(a.begin), - "end" : IriSP.msToTime(a.end), - "thumbnail" : (typeof a.meta == "object" && typeof a.meta.thumbnail == "string") ? a.meta.thumbnail : this.default_thumbnail, - "url" : (typeof a.meta == "object" && typeof a.meta.url == "string") ? a.meta.url : null, - "created_at" :(typeof a.meta == "object" && typeof a.meta.created == "string") ? Date.parse(a.meta.created.replace(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}\:\d{2}\:\d{2}).*$/,"$2/$3/$1 $4 UTC+0000")) : null, - "tags": typeof a.tags == "object" - ? IriSP.underscore(a.tags) - .chain() - .map(function(_t) { - if (typeof _t == "string") { - return _t.replace(/^.*:/,'#'); - } else { - if (typeof _t['id-ref'] != "undefined") { - var _f = IriSP.underscore.find(_this._serializer._data.tags, function(_tag) { - return _tag.id == _t['id-ref']; - }); - if (typeof _f != "undefined") { - return IriSP.get_aliased(_f.meta, ['dc:title', 'title']); - } - } - } - return null; - }) - .filter(function(_t) { - return _t !== null && _t !== "" - }) - .value() - : [] - } -} - -/** draw the annotation list */ -IriSP.AnnotationsListWidget.prototype.drawList = function(force_redraw) { - var _this = this; - -// var view_type = this._serializer.getContributions(); - var annotations = this._serializer._data.annotations; - var currentTime = this._Popcorn.currentTime(); - var list = []; - -/* if (typeof(view_type) === "undefined") { - return; -} */ - for (i = 0; i < annotations.length; i++) { - var obj = this.transformAnnotation(annotations[i]); - obj.iterator = i; - obj.distance = Math.abs((annotations[i].end + annotations[i].begin) / 2000 - currentTime); - if (!this.cinecast_version || annotations[i].type == "cinecast:UserAnnotation") { - list.push(obj); - } - - } - - if (this.searchRe !== null) { - list = list.filter(function(_a) { - return (_this.searchRe.test(_a.desc) || _this.searchRe.test(_a.title)); - }); - if (list.length) { - this._Popcorn.trigger("IriSP.search.matchFound"); - } else { - this._Popcorn.trigger("IriSP.search.noMatchFound"); - } - } - list = IriSP.underscore(list) - .chain() - .sortBy(function(_o) { - return _o.distance; - }) - .first(10) - .sortBy(function(_o) { - return (_this.cinecast_version ? - _o.created_at : _o.iterator); - }) - .value(); - var idList = IriSP.underscore.pluck(list, "id").sort(); - - if (!IriSP.underscore.isEqual(this.__oldList, idList) || this.lastSearch !== this.searchRe || typeof(force_redraw) !== "undefined") { - this.do_redraw(list); - this.__oldList = idList; - this.lastSearch = this.searchRe; - } - /* save for next call */ - - -}; - -IriSP.AnnotationsListWidget.prototype.ajaxRedraw = function(timecode) { - - /* the seeked signal sometimes passes an argument - depending on if we're using - our popcorn lookalike or the real thing - if it's the case, use it as it's - more precise than currentTime which sometimes contains the place we where at */ - if (IriSP.null_or_undefined(timecode) || typeof(timecode) != "number") { - var tcode = this._Popcorn.currentTime(); - } else { - var tcode = timecode; - } - - - /* the platform gives us a special url - of the type : http://path/{{media}}/{{begin}}/{{end}} - we double the braces using regexps and we feed it to mustache to build the correct url - we have to do that because the platform only knows at run time what view it's displaying. - */ - - var media_id = this.currentMedia()["id"]; - var duration = this.getDuration(); - - var begin_timecode = (Math.floor(tcode) - 300) * 1000; - if (begin_timecode < 0) - begin_timecode = 0; - - var end_timecode = (Math.floor(tcode) + 300) * 1000; - if (end_timecode > duration) - end_timecode = duration; - - var templ = Mustache.to_html(this.ajax_url, {media: media_id, begin: begin_timecode, - end: end_timecode}); - - /* we create on the fly a serializer to get the ajax */ - var serializer = new IriSP.JSONSerializer(IriSP.__dataloader, templ); - serializer.sync(IriSP.wrap(this, function(json) { this.processJson(json, serializer) })); -}; - -/** process the received json - it's a bit hackish */ -IriSP.AnnotationsListWidget.prototype.processJson = function(json, serializer) { - /* FIXME: DRY the whole thing */ - var annotations = serializer._data.annotations; - if (IriSP.null_or_undefined(annotations)) - return; - - /* - commented in case we wanted to discriminate against some annotation types. - var view_types = serializer.getIds("Contributions"); - */ - var l = []; - - var media = this.currentMedia()["id"]; - - for (i = 0; i < annotations.length; i++) { - var obj = this.transformAnnotation(annotations[i]) - if (typeof obj.url == "undefined" || !obj.url) { - /* only if the annotation isn't present in the document create an - external link */ - if (this.annotations_ids.indexOf(obj.id.toLowerCase()) == -1) { - // braindead url; jacques didn't want to create a new one in the platform, - // so we append the cutting id to the url. - obj.url = this.project_url + "/" + media + "/" + - annotations[i].meta.project + "/" + - annotations[i].meta["id-ref"] + '#id=' + annotations[i].id; - - // obj.url = document.location.href.split("#")[0] + "/" + annotation.meta.project; - } - } - l.push(obj); - } - this._ajax_cache = l; - this.do_redraw(l); -}; -IriSP.AnnotationsListWidget.prototype.draw = function() { - - /* build a table of the annotations present in the document for faster - lookup - */ - this.annotations_ids = IriSP.underscore(this._serializer._data.annotations).map(function(_a) { - return _a.id.toLowerCase(); - }); - - var _this = this; - - if (!this.ajax_mode || this.cinecast_version) { - var _throttled = IriSP.underscore.throttle(function() { - _this.drawList(); - }, 1500); - _throttled(); - this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", _throttled); - this._Popcorn.listen("timeupdate", _throttled); - if (this.cinecast_version) { - window.setInterval(function() { - var _tmpSerializer = new IriSP.JSONSerializer(IriSP.__dataloader, _this._config.metadata.src, true); - _tmpSerializer.sync(function(json) { - _this.annotations_ids = IriSP.underscore(_this._serializer._data.annotations).map(function(_a) { - return _a.id.toLowerCase(); - }); - IriSP.underscore(json.annotations).each(function(_a) { - var _j = _this.annotations_ids.indexOf(_a.id); - if (_j == -1) { - _this._serializer._data.annotations.push(_a); - _this.annotations_ids.push(_a.id); - } else { - _this._serializer._data.annotations[_j] = _a; - } - _throttled(); - }); - }, true); // true is for force_refresh - },this.refresh_interval); - } - } else { - /* update the widget when the video has finished loading and when it's seeked and paused */ - this._Popcorn.listen("seeked", IriSP.wrap(this, this.ajaxRedraw)); - this._Popcorn.listen("loadedmetadata", IriSP.wrap(this, this.ajaxRedraw)); - this._Popcorn.listen("paused", IriSP.wrap(this, this.ajaxRedraw)); - - this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", IriSP.wrap(this, this.ajaxRedraw)); - } - -};/* Internationalization for this widget */ - -IriSP.i18n.addMessages( - { - "fr": { - "keywords": "Mots-clés" - }, - "en": { - "keywords": "Keywords" - } - } -); - -IriSP.AnnotationsWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); - /* flag used when we're creating an annotation */ - this._hidden = false; -}; - - -IriSP.AnnotationsWidget.prototype = new IriSP.Widget(); - -IriSP.AnnotationsWidget.prototype.clear = function() { - this.selector.find(".Ldt-SaTitle").text(""); - this.selector.find(".Ldt-SaDescription").text(""); - this.selector.find(".Ldt-SaKeywordText").text(""); -}; - -IriSP.AnnotationsWidget.prototype.displayAnnotation = function(annotation) { - var title = annotation.content.title; - var description = annotation.content.description; - var keywords = ""; - var begin = +annotation.begin / 1000; - var end = +annotation.end / 1000; - var duration = this.getDuration(); - var tags = ""; - - var title_templ = "{{title}} - ( {{begin}} - {{end}} )"; - var endstr = Mustache.to_html(title_templ, {title: title, begin: IriSP.secondsToTime(begin), end: IriSP.secondsToTime(end)}); - - this.selector.find(".Ldt-SaTitle").text(endstr); - this.selector.find(".Ldt-SaDescription").text(description); - - - if (!IriSP.null_or_undefined(annotation.tags) && !IriSP.null_or_undefined(this._serializer._data.tags)) { - /* save the tag id and keywords in a unique structure */ - var tag_list = {}; - for (var i = 0; i < this._serializer._data.tags.length; i++) { - var id = this._serializer._data.tags[i]["id"]; - var keyword = IriSP.get_aliased(this._serializer._data.tags[i]["meta"], ["dc:title", "title"]); - - tag_list[id] = keyword; - } - - /* then browse the list of defined tags for the current annotation */ - for (var i = 0; i < annotation.tags.length; i++) { - if (tag_list.hasOwnProperty(annotation.tags[i]["id-ref"])) - tags += tag_list[annotation.tags[i]["id-ref"]] + ", "; - } - } - - tags = IriSP.i18n.getMessage("keywords") + ": " + tags.slice(0, tags.length - 2); - - this.selector.find(".Ldt-SaKeywords").text(tags); - - // update sharing buttons - var url = document.location.href + "#id=" + annotation.id; - this.selector.find(".Ldt-fbShare").attr("href", IriSP.mkFbUrl(url, this.share_text)); - this.selector.find(".Ldt-TwShare").attr("href", IriSP.mkTweetUrl(url, this.share_text)); - this.selector.find(".Ldt-GplusShare").attr("href", IriSP.mkGplusUrl(url, this.share_text)); -}; - -IriSP.AnnotationsWidget.prototype.clearWidget = function() { - /* retract the pane between two annotations */ - this.selector.find(".Ldt-SaTitle").text(""); - this.selector.find(".Ldt-SaDescription").text(""); - this.selector.find(".Ldt-SaKeywordText").html(""); - this.selector.find(".Ldt-ShowAnnotation").slideUp(); -}; - -IriSP.AnnotationsWidget.prototype.draw = function() { - var _this = this; - - var annotationMarkup = IriSP.templToHTML(IriSP.annotationWidget_template); - this.selector.append(annotationMarkup); - - this._Popcorn.listen("IriSP.AnnotationsWidget.show", - IriSP.wrap(this, this.show)); - this._Popcorn.listen("IriSP.AnnotationsWidget.hide", - IriSP.wrap(this, this.hide)); - - var legal_ids = []; - if (typeof(this._serializer.getChapitrage()) !== "undefined") - legal_ids.push(this._serializer.getChapitrage()); - else - legal_ids = this._serializer.getNonTweetIds(); - - var annotations = this._serializer._data.annotations; - var i; - - for (i in annotations) { - var annotation = annotations[i]; - var begin = Math.round((+ annotation.begin) / 1000); - var end = Math.round((+ annotation.end) / 1000); - - if (typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined" - && !IriSP.underscore.include(legal_ids, annotation.meta["id-ref"])) { - continue; - } - - - var conf = {start: begin, end: end, - onStart: - function(annotation) { - return function() { - _this.displayAnnotation(annotation); - - } }(annotation), - onEnd: - function() { _this.clearWidget.call(_this); } - }; - this._Popcorn = this._Popcorn.code(conf); - } - -}; - -IriSP.AnnotationsWidget.prototype.hide = function() { - if (this._hidden == false) { - this.selector.hide(); - this._hidden = true; - } -}; - -IriSP.AnnotationsWidget.prototype.show = function() { - if (this._hidden == true) { - this.selector.show(); - this._hidden = false; - } -};IriSP.ArrowWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); - - this._oldAnnotation = null; - this._blockArrow = false; -}; - - -IriSP.ArrowWidget.prototype = new IriSP.Widget(); - -IriSP.ArrowWidget.prototype.clear = function() { - -}; - -IriSP.ArrowWidget.prototype.clearWidget = function() { -}; - -IriSP.ArrowWidget.prototype.draw = function() { - var templ = Mustache.to_html(IriSP.arrowWidget_template, {}); - this.selector.append(templ); - this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeUpdateHandler)); - this._Popcorn.listen("IriSP.ArrowWidget.blockArrow", IriSP.wrap(this, this.blockArrow)); - this._Popcorn.listen("IriSP.ArrowWidget.releaseArrow", IriSP.wrap(this, this.releaseArrow)); - -}; - -IriSP.ArrowWidget.prototype.timeUpdateHandler = function(percents) { - if (this._blockArrow) - return; - - var currentTime = this._Popcorn.currentTime(); - var currentAnnotation = this._serializer.currentChapitre(currentTime); - if (IriSP.null_or_undefined(currentAnnotation)) { - var c_annots = this._serializer.currentAnnotation(currentTime) - if (c_annots.length != 0) - var currentAnnotation = c_annots[0]; // FIXME : use the others ? - else - return; - } - - /* move the arrow only if the current annotation changes */ - if (currentAnnotation != this._oldAnnotation) { - var begin = (+ currentAnnotation.begin) / 1000; - var end = (+ currentAnnotation.end) / 1000; - - var duration = this.getDuration() / 1000; - var middle_time = (begin + end) / 2; - var percents = middle_time / duration; - - // we need to apply a fix because the arrow has a certain length - // it's half the length of the arrow (27 / 2). We need to convert - // it in percents though. - var totalWidth = this.selector.width(); - var pixels = percents * totalWidth; - var correction = (27 / 2); - var corrected_pixels = pixels - correction; - - /* make sure that the arrow is aligned with the pattern - of the widget under it */ - if (corrected_pixels % 3 != 0) - corrected_pixels -= (corrected_pixels % 3 - 1); - - /* don't move out of the screen */ - if (corrected_pixels <= 0) - corrected_pixels = 0; - - if (corrected_pixels <= 15) { - this.selector.children(".Ldt-arrowWidget").removeClass("Ldt-arrowLeftEdge Ldt-arrowCenter Ldt-arrowRightEdge") - .addClass("Ldt-arrowLeftEdge"); - } else if (corrected_pixels >= totalWidth - 25) { - this.selector.children(".Ldt-arrowWidget").removeClass("Ldt-arrowLeftEdge Ldt-arrowCenter Ldt-arrowRightEdge") - .addClass("Ldt-arrowRightEdge"); - } else { - this.selector.children(".Ldt-arrowWidget").removeClass("Ldt-arrowLeftEdge Ldt-arrowCenter Ldt-arrowRightEdge") - .addClass("Ldt-arrowCenter"); - } - - this.selector.children(".Ldt-arrowWidget").animate({"left" : corrected_pixels + "px"}); - - this._oldAnnotation = currentAnnotation; - } -}; - -/** Block the arrow for instance when the user is annotating */ -IriSP.ArrowWidget.prototype.blockArrow = function() { - this._blockArrow = true; -}; - -IriSP.ArrowWidget.prototype.releaseArrow = function() { - this._blockArrow = false; -}; -/* Internationalization for this widget */ - -IriSP.i18n.addMessages( - { - "en": { - "submit": "Submit", - "add_keywords": "Add keywords", - "add_polemic_keywords": "Add polemic keywords", - "your_name": "Your name", - "type_here": "Type your annotation here.", - "wait_while_processed": "Please wait while your request is being processed...", - "error_while_contacting": "An error happened while contacting the server. Your annotation has not been saved.", - "empty_annotation": "Your annotation is empty. Please write something before submitting.", - "annotation_saved": "Thank you, your annotation has been saved.", - "share_annotation": "Would you like to share it on social networks ?", - "share_on": "Share on", - "more_tags": "More tags" - }, - "fr": { - "submit": "Envoyer", - "add_keywords": "Ajouter des mots-clés", - "add_polemic_keywords": "Ajouter des mots-clés polémiques", - "your_name": "Votre nom", - "type_here": "Rédigez votre annotation ici.", - "wait_while_processed": "Veuillez patienter pendant le traitement de votre requête...", - "error_while_contacting": "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée", - "empty_annotation": "Votre annotation est vide. Merci de rédiger un texte avant de l'envoyer.", - "annotation_saved": "Merci, votre annotation a été enregistrée.", - "share_annotation": "Souhaitez-vous la partager sur les réseaux sociaux ?", - "share_on": "Partager sur", - "more_tags": "Plus de mots-clés" - } - } -); - -IriSP.createAnnotationWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); - this._hidden = true; - - if (!IriSP.null_or_undefined(IriSP.user)) { - if (!IriSP.null_or_undefined(IriSP.user.avatar)) { - this.user_avatar = IriSP.user.avatar; - } - if (!IriSP.null_or_undefined(IriSP.user.name)) { - this.user_name = IriSP.user.name; - } - } - - /* variables to save the current position of the slicer */ - if (this.cinecast_version) { - this.sliceLeft = 0; - this.sliceWidth = 0; - } -}; - - -IriSP.createAnnotationWidget.prototype = new IriSP.Widget(); - -IriSP.createAnnotationWidget.prototype.clear = function() { - this.selector.find(".Ldt-SaTitle").text(""); - this.selector.find(".Ldt-SaDescription").text(""); - this.selector.find(".Ldt-SaKeywordText").text(""); -}; - -IriSP.createAnnotationWidget.prototype.draw = function() { - var _this = this; - if (typeof this.remote_tags == "object") { - IriSP.jQuery.getJSON((typeof this.remote_tags.alias == "string" ? this.remote_tags.alias : this.remote_tags.url), function(_json) { - _this.tags = _json.tags; - _this.drawCallback(); - }); - } else { - this.drawCallback(); - } -} - -IriSP.createAnnotationWidget.prototype.drawCallback = function() { - var _this = this; - - var annotationMarkup = IriSP.templToHTML(IriSP.createAnnotationWidget_template, - this); - - this.selector.append(annotationMarkup); - - if (!this.cinecast_version) - this.selector.hide(); - else { - this.showStartScreen(); - } - - if (this.random_tags) { - this.selector.find(".Ldt-createAnnotation-keywords li").hide(); - this.showMoreTags(); - this.selector.find('.Ldt-createAnnotation-moar-keywordz').click(function() { - _this.showMoreTags(); - }) - } - // Add onclick event to both polemic and keywords buttons - - this.selector.find(".Ldt-createAnnotation-keyword-button, .Ldt-createAnnotation-polemic-button").click(function() { - _this.addKeyword(IriSP.jQuery(this).text()); - return false; - }); - - // js_mod is a custom event because there's no simple way to test for a js - // change in a textfield. - this.selector.find(".Ldt-createAnnotation-Description") - .bind("propertychange keyup input paste click js_mod", IriSP.wrap(this, this.handleTextChanges)); - - /* the cinecast version of the player is supposed to pause when the user clicks on the button */ - - /* the cinecast version expects the user to comment on a defined segment. - As the widget is always shown, we need a way to update it's content as - time passes. We do this like we did with the annotationsWidget : we schedule - a .code start function which will be called at the right time. - */ - if (this.cinecast_version) { - var legal_ids; - if (typeof(this._serializer.getChapitrage()) !== "undefined") - legal_id = this._serializer.getChapitrage(); - else - legal_id = this._serializer.getNonTweetIds()[0]; - - var annotations = this._serializer._data.annotations; - var i; - - for (i in annotations) { - var annotation = annotations[i]; - if (typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined" - && legal_id !== annotation.meta["id-ref"]) { - continue; - } - - code = {start: annotation.begin / 1000, end: annotation.end / 1000, - onStart: function(annotation) { return function() { - if (typeof(annotation.content) !== "undefined") - _this.selector.find(".Ldt-createAnnotation-Title").html(annotation.content.title); - - _this._currentAnnotation = annotation; - var beginTime = IriSP.msToTime(annotation.begin); - var endTime = IriSP.msToTime(annotation.end); - var timeTemplate = IriSP.templToHTML("- ({{begin}} - {{ end }})", {begin: beginTime, end: endTime }); - _this.selector.find(".Ldt-createAnnotation-TimeFrame").html(timeTemplate); - } }(annotation) - }; - - this._Popcorn.code(code); - } - } - - this.selector.find(".Ldt-createAnnotation-submitButton").click(IriSP.wrap(this, this.handleButtonClick)); - - if (!this.cinecast_version) { - this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked", - IriSP.wrap(this, this.handleAnnotateSignal)); - - // handle clicks on the cancel button too. - this.selector.find(".Ldt-createAnnotation-Minimize").click(IriSP.wrap(this, - function() { - // we've got to simulate the pressing of the button because there's no - // other way to minimize the widget and show the widgets that were hidden - // same time - this._Popcorn.trigger("IriSP.PlayerWidget.AnnotateButton.clicked"); - } - )); - } -}; - -IriSP.createAnnotationWidget.prototype.showMoreTags = function() { - for (var j=0; j < this.random_tags; j++) { - var _jq = this.selector.find(".Ldt-createAnnotation-keywords li:hidden"); - if (_jq.length > 1) { - IriSP.jQuery(_jq[Math.floor(_jq.length*Math.random())]).show(); - } else { - _jq.show(); - break; - } - } - if (this.selector.find(".Ldt-createAnnotation-keywords li:hidden").length == 0) { - this.selector.find('.Ldt-createAnnotation-moar-keywordz').hide(); - } -} - -/* Handles adding keywords and polemics */ -IriSP.createAnnotationWidget.prototype.addKeyword = function(_keyword) { - var _field = this.selector.find(".Ldt-createAnnotation-Description"), - _rx = IriSP.regexpFromText(_keyword), - _contents = _field.val(); - _contents = ( _rx.test(_contents) - ? _contents.replace(_rx,"").replace(" "," ").replace(/(^\s+|\s+$)/g,'') - : _contents.replace(/(^\s+|\s+$)/g,'') + " " + _keyword - ); - _field.val(_contents.replace(/(^\s+|\s+$)/g,'')).trigger("js_mod"); -} - -/** handles clicks on the annotate button. Works only for the non-cinecast version */ -IriSP.createAnnotationWidget.prototype.handleAnnotateSignal = function() { - - if (this._hidden == false && this._state == 'startScreen') { - this.selector.hide(); - this._hidden = true; - - // free the arrow. - this._Popcorn.trigger("IriSP.ArrowWidget.releaseArrow"); - this._Popcorn.trigger("IriSP.SliceWidget.hide"); - this._Popcorn.trigger("IriSP.AnnotationsWidget.show"); - - } else { - this._Popcorn.trigger("IriSP.AnnotationsWidget.hide"); - this.showStartScreen(); - this.selector.show(); - this._hidden = false; - var currentTime = this._Popcorn.currentTime(); - - // block the arrow. - this._Popcorn.trigger("IriSP.ArrowWidget.blockArrow"); - - var duration = this.getDuration(); - - var currentChapter = this._serializer.currentChapitre(currentTime); - - if (IriSP.null_or_undefined(currentChapter)) { - var left = this.selector.width() / 2; - var width = this.selector.width() / 10; - } else { - var left = (currentChapter.begin / duration) * this.selector.width(); - var width = (currentChapter.end / duration) * this.selector.width() - left; - } - - // slider position and length is kept in percents. - this.sliceLeft = (left / this.selector.width()) * 100; - this.sliceWidth = (width / this.selector.width()) * 100; - - this._Popcorn.trigger("IriSP.SliceWidget.position", [left, width]); - this._Popcorn.listen("IriSP.SliceWidget.zoneChange", IriSP.wrap(this, this.handleSliderChanges)); - this._Popcorn.trigger("IriSP.SliceWidget.show"); - - if (!IriSP.null_or_undefined(currentChapter)) { - this.selector.find(".Ldt-createAnnotation-Title").html(currentChapter.content.title); - - this._currentcurrentChapter = currentChapter; - var beginTime = IriSP.msToTime(currentChapter.begin); - var endTime = IriSP.msToTime(currentChapter.end); - var timeTemplate = IriSP.templToHTML("- ({{begin}} - {{ end }})", {begin: beginTime, end: endTime }); - this.selector.find(".Ldt-createAnnotation-TimeFrame").html(timeTemplate); - } - } -}; - - -/** watch for changes in the textfield and change the buttons accordingly */ -IriSP.createAnnotationWidget.prototype.handleTextChanges = function(event) { - var contents = this.selector.find(".Ldt-createAnnotation-Description").val(); - if (this.cinecast_version) { - this._Popcorn.pause(); - } - this.selector.find(".Ldt-createAnnotation-btnblock button").each(function() { - var _rx = IriSP.regexpFromText(IriSP.jQuery(this).text()); - if (_rx.test(contents)) { - IriSP.jQuery(this).parent().addClass("Ldt-createAnnotation-active-button"); - } else { - IriSP.jQuery(this).parent().removeClass("Ldt-createAnnotation-active-button"); - } - }); - -}; - -IriSP.createAnnotationWidget.prototype.showStartScreen = function() { - this.selector.find(".Ldt-createAnnotation-screen").hide(); - this.selector.find(".Ldt-createAnnotation-startScreen").show(); - - var jqTextfield = this.selector.find(".Ldt-createAnnotation-Description"); // handle on the textfield. used for the closure - - /* test if the browser supports the placeholder attribute */ - if (!IriSP.null_or_undefined(jqTextfield.get(0).placeholder)) { - jqTextfield.attr("placeholder", IriSP.i18n.getMessage('type_here')); - } else { - jqTextfield.val(IriSP.i18n.getMessage('type_here')); - jqTextfield.one("click", IriSP.wrap(this, function() { jqTextfield.val(""); })); - } - - - - this._state = "startScreen"; -}; - -IriSP.createAnnotationWidget.prototype.showWaitScreen = function() { - this.selector.find(".Ldt-createAnnotation-screen").hide(); - this.selector.find(".Ldt-createAnnotation-waitScreen").show(); - this._state = "waitScreen"; -}; - -IriSP.createAnnotationWidget.prototype.showErrorScreen = function() { - this.selector.find(".Ldt-createAnnotation-screen").hide(); - this.selector.find(".Ldt-createAnnotation-errorScreen").show(); - this._state = "errorScreen"; - var _this = this; - window.setTimeout(function() { _this.showStartScreen(); }, 2000); -}; - -/** update show the final screen with links to share the created annotation */ -IriSP.createAnnotationWidget.prototype.showEndScreen = function(annotation) { - this.selector.find(".Ldt-createAnnotation-screen").hide(); - - if (this.cinecast_version) { - this.selector.find(".Ldt-createAnnotation-Title").parent().show(); - } - - var url = ( (typeof annotation.meta == "object" && typeof annotation.meta.url == "string" && annotation.meta.url.length) - ? annotation.meta.url - : ( document.location.href + "#id=" + annotation.id ) ); - var twStatus = IriSP.mkTweetUrl(url); - var gpStatus = IriSP.mkGplusUrl(url); - var fbStatus = IriSP.mkFbUrl(url); - - this.selector.find(".Ldt-createAnnotation-endScreen-TweetLink").attr("href", twStatus); - this.selector.find(".Ldt-createAnnotation-endScreen-FbLink").attr("href", fbStatus); - this.selector.find(".Ldt-createAnnotation-endScreen-GplusLink").attr("href", gpStatus); - - this.selector.find(".Ldt-createAnnotation-endScreen").show(); - this._state = "endScreen"; -}; - -/** handle clicks on "send annotation" button */ -IriSP.createAnnotationWidget.prototype.handleButtonClick = function(event) { - var _this = this; - var textfield = this.selector.find(".Ldt-createAnnotation-Description"); - var contents = textfield.val(); - - if (contents === "") { - if (this.selector.find(".Ldt-createAnnotation-errorMessage").length === 0) { - this.selector.find(".Ldt-createAnnotation-Container") - .after(IriSP.templToHTML(IriSP.createAnnotation_errorMessage_template)); - textfield.css("background-color", "#d93c71"); - } else { - this.selector.find(".Ldt-createAnnotation-errorMessage").show(); - } - - textfield.one("js_mod propertychange keyup input paste", IriSP.wrap(this, function() { - var contents = textfield.val(); - - if (contents !== "") { - this.selector.find(".Ldt-createAnnotation-errorMessage").hide(); - textfield.css("background-color", ""); - } - })); - } else { - this.showWaitScreen(); - - this.sendLdtData(contents, function(annotation) { - if (_this.cinecast_version) { - if (_this._Popcorn.media.paused) - _this._Popcorn.play(); - } - - if (_this._state == "waitScreen") { - _this.showEndScreen(annotation); - if (_this.cinecast_version) { - window.setTimeout(function() { _this.showStartScreen(); }, _this.return_delay); - } - } - // hide the slicer widget - if (!_this.cinecast_version) { - _this._Popcorn.trigger("IriSP.SliceWidget.hide"); - } - }); - } -}; - -IriSP.createAnnotationWidget.prototype.handleSliderChanges = function(params) { - this.sliceLeft = params[0]; - this.sliceWidth = params[1]; -}; - -IriSP.createAnnotationWidget.prototype.sendLdtData = function(contents, callback) { - var _this = this; - var apiJson = { - format : "http://advene.org/ns/cinelab/", - annotations : [ - {} - ], - meta: {}}; - var annotation = apiJson.annotations[0]; - - annotation.media = this.currentMedia()["id"]; - - if (this.cinecast_version) { - annotation.begin = Math.round(this._Popcorn.currentTime() * 1000); - annotation.end = annotation.begin; - } else { - var duration = this.getDuration(); - annotation.begin = +((duration * (this.sliceLeft / 100)).toFixed(0)); - annotation.end = +((duration * ((this.sliceWidth + this.sliceLeft) / 100)).toFixed(0)); - } - - // boundary checks - annotation.begin = Math.max(0, annotation.begin); - annotation.end = Math.min(this.getDuration(), annotation.end); - - annotation.type = ( this.cinecast_version ? "cinecast:UserAnnotation" : ( this._serializer.getContributions() || "" )); - if (typeof(annotation.type) === "undefined") - annotation.type = ""; - - annotation.type_title = "Contributions"; - annotation.content = {}; - annotation.content.data = contents; - if (this.cinecast_version) { - var _extract = IriSP.underscore(this._serializer._data.annotations) - .filter(function(_a) { - return (_a.begin <= annotation.begin && _a.end >= annotation.begin && _a.type == "cinecast:MovieExtract"); - }) - if (_extract.length) { - annotation.extract = _extract[0].id; - } - } - - var meta = apiJson.meta; - - - var _username = this.selector.find(".Ldt-createAnnotation-userName").val(); - meta.creator = ( - (_username && _username.length) - ? _username - : ( - (!IriSP.null_or_undefined(IriSP.user) && !IriSP.null_or_undefined(IriSP.user.name)) - ? IriSP.user.name - : "Anonymous user" - ) - ); - - meta.created = Date().toString(); - - var _tags = []; - IriSP._(this.tags).each(function(_v) { - var _rx = IriSP.regexpFromText(_v.meta.description); - if (_rx.test(contents)) { - _tags.push(_v.id); - } - }); - - if (typeof this.remote_tags == "object") { - _tags = IriSP._(_tags).map(function(_t) { - return _this.remote_tags.id + ':' + _t - }); - if (typeof apiJson.imports == "undefined") { - apiJson.imports = []; - } - apiJson.imports.push({ - "id" : this.remote_tags.id, - "url" : this.remote_tags.url - }) - } - annotation.tags = IriSP.underscore.uniq(_tags); - - var jsonString = JSON.stringify(apiJson); - var project_id = this._serializer._data.meta.id; - - //TODO: extract magic url - var url = Mustache.to_html(this.api_endpoint_template, - {id: project_id}); - - IriSP.jQuery.ajax({ - url: url, - type: this.api_method, - contentType: 'application/json', - data: jsonString, - //dataType: 'json', - success: IriSP.wrap(this, function(json, textStatus, XMLHttpRequest) { - /* add the annotation to the annotation and tell the world */ - var annotation = json.annotations[0]; - - if (!this.cinecast_version) { - /* if the media doesn't have a contributions line, we need to add one */ - if (typeof(this._serializer.getContributions()) === "undefined") { - /* set up a basic view */ - var tmp_view = {"dc:contributor": "perso", "dc:creator": "perso", "dc:title": "Contributions", - "id": json.annotations[0].type} - - - IriSP.get_aliased(this._serializer._data, ["annotation_types", "annotation-types"]).push(tmp_view); - } - - delete annotation.tags; - annotation.content.description = annotation.content.data; - annotation.content.title = ""; - delete annotation.content.data; - annotation.id = json.annotations[0].id; - - annotation.meta = meta; - annotation.meta["id-ref"] = json.annotations[0]["type"]; - } else { - annotation.type = "cinecast:UserAnnotation"; - } - // everything is shared so there's no need to propagate the change - var _an_ids = IriSP.underscore(this._serializer._data.annotations).map(function(_a) { - return _a.id.toLowerCase(); - }); - if (IriSP._(_an_ids).indexOf(annotation.id.toLowerCase()) == -1) { - _this._serializer._data.annotations.push(annotation); - } - - _this._Popcorn.trigger("IriSP.createAnnotationWidget.addedAnnotation", annotation); - this.selector.find(".Ldt-createAnnotation-Description").val("").trigger("js_mod"); - callback(annotation); - }), - error: - function(jqXHR, textStatus, errorThrown) { - console.log("an error occured while contacting " - + url + " and sending " + jsonString + textStatus ); - _this.showErrorScreen(); } }); -};IriSP.HelloWorldWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); -} - -IriSP.HelloWorldWidget.prototype = new IriSP.Widget(); - -IriSP.HelloWorldWidget.prototype.draw = function() { - this.selector - .html('Hello, world') - .css({ - "text-align" : "center", - "padding": "10px 0", - "font-size" : "14px" - }); - - console.log(this); -} -/* Internationalization for this widget */ - -IriSP.i18n.addMessages( - { - "en": { - "play_pause": "Play/Pause", - "mute_unmute": "Mute/Unmute", - "play": "Play", - "pause": "Pause", - "mute": "Mute", - "unmute": "Unmute", - "annotate": "Annotate", - "search": "Search", - "elapsed_time": "Elapsed time", - "total_time": "Total time", - "volume": "Volume", - "volume_control": "Volume control" - }, - "fr": { - "play_pause": "Lecture/Pause", - "mute_unmute": "Couper/Activer le son", - "play": "Lecture", - "pause": "Pause", - "mute": "Couper le son", - "unmute": "Activer le son", - "annotate": "Annoter", - "search": "Rechercher", - "elapsed_time": "Durée écoulée", - "total_time": "Durée totale", - "volume": "Niveau sonore", - "volume_control": "Réglage du niveau sonore" - } - } -); - - -IriSP.PlayerWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); - - this._searchBlockOpen = false; - this._searchLastValue = ""; -}; - -IriSP.PlayerWidget.prototype = new IriSP.Widget(); - -IriSP.PlayerWidget.prototype.draw = function() { - var self = this; - var width = this.width; - var height = this.height; - var heightS = this.height-20; - - var playerTempl = IriSP.templToHTML(IriSP.player_template, this._config); - this.selector.append(playerTempl); - - this.selector.children(".Ldt-controler").show(); - - // handle clicks by the user on the video. - this._Popcorn.listen("play", IriSP.wrap(this, this.playButtonUpdater)); - this._Popcorn.listen("pause", IriSP.wrap(this, this.playButtonUpdater)); - - this._Popcorn.listen("volumechange", IriSP.wrap(this, this.volumeUpdater)); - - this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeDisplayUpdater)); - // update the time display for the first time. - this._Popcorn.listen("loadedmetadata", IriSP.wrap(this, this.timeDisplayUpdater)); - - this._Popcorn.listen("IriSP.search.matchFound", IriSP.wrap(this, this.searchMatch)); - this._Popcorn.listen("IriSP.search.noMatchFound", IriSP.wrap(this, this.searchNoMatch)); - this._Popcorn.listen("IriSP.search.triggeredSearch", IriSP.wrap(this, this.triggeredSearch)); - - - this.selector.find(".Ldt-CtrlPlay").click(function() { self.playHandler.call(self); }); - this.selector.find(".Ldt-CtrlAnnotate").click(function() - { self._Popcorn.trigger("IriSP.PlayerWidget.AnnotateButton.clicked"); }); - this.selector.find(".Ldt-CtrlSearch").click(function() { self.searchButtonHandler.call(self); }); - - var _volctrl = this.selector.find(".Ldt-Ctrl-Volume-Control"); - this.selector.find('.Ldt-CtrlSound') - .click(function() { self.muteHandler.call(self); } ) - .mouseover(function() { - _volctrl.show(); - }) - .mouseout(function() { - _volctrl.hide(); - }); - _volctrl.mouseover(function() { - _volctrl.show(); - }).mouseout(function() { - _volctrl.hide(); - }); - - /* - var searchButtonPos = this.selector.find(".Ldt-CtrlSearch").position(); - var searchBox = Mustache.to_html(IriSP.search_template, {margin_left : searchButtonPos.left + "px"}); - this.selector.find(".Ldt-CtrlSearch").after(searchBox); - */ - - // trigger an IriSP.PlayerWidget.MouseOver to the widgets that are interested (i.e : sliderWidget) - this.selector.hover(function() { self._Popcorn.trigger("IriSP.PlayerWidget.MouseOver"); }, - function() { self._Popcorn.trigger("IriSP.PlayerWidget.MouseOut"); }); - this.selector.find(".Ldt-Ctrl-Volume-Cursor").draggable({ - axis: "x", - drag: function(event, ui) { - var _vol = Math.max(0, Math.min( 1, ui.position.left / (ui.helper.parent().width() - ui.helper.outerWidth()))); - ui.helper.attr("title",IriSP.i18n.getMessage('volume')+': ' + Math.floor(100*_vol) + '%'); - self._Popcorn.volume(_vol); - }, - containment: "parent" - }); - - setTimeout(function() { - self.volumeUpdater(); - }, 1000); /* some player - jwplayer notable - save the state of the mute button between sessions */ -}; - -/* Update the elasped time div */ -IriSP.PlayerWidget.prototype.timeDisplayUpdater = function() { - - if (this._previousSecond === undefined) { - this._previousSecond = this._Popcorn.roundTime(); - } - else { - /* we're still in the same second, so it's not necessary to update time */ - if (this._Popcorn.roundTime() == this._previousSecond) - return; - - } - - // we get it at each call because it may change. - var duration = this.getDuration() / 1000; - var totalTime = IriSP.secondsToTime(duration); - var elapsedTime = IriSP.secondsToTime(this._Popcorn.currentTime()); - - this.selector.find(".Ldt-ElapsedTime").html(elapsedTime.toString()); - this.selector.find(".Ldt-TotalTime").html(totalTime.toString()); - this._previousSecond = this._Popcorn.roundTime(); -}; - -/* update the icon of the button - separate function from playHandler - because in some cases (for instance, when the user directly clicks on - the jwplayer window) we have to change the icon without playing/pausing -*/ -IriSP.PlayerWidget.prototype.playButtonUpdater = function() { - var status = this._Popcorn.media.paused; - - if ( status == true ){ - /* the background sprite is changed by adding/removing the correct classes */ - this.selector.find(".Ldt-CtrlPlay").attr("title", IriSP.i18n.getMessage('play')); - this.selector.find(".Ldt-CtrlPlay").removeClass("Ldt-CtrlPlay-PauseState").addClass("Ldt-CtrlPlay-PlayState"); - } else { - this.selector.find(".Ldt-CtrlPlay").attr("title", IriSP.i18n.getMessage('pause')); - this.selector.find(".Ldt-CtrlPlay").removeClass("Ldt-CtrlPlay-PlayState").addClass("Ldt-CtrlPlay-PauseState"); - } - - return; -}; - - -IriSP.PlayerWidget.prototype.playHandler = function() { - var status = this._Popcorn.media.paused; - - if ( status == true ){ - this._Popcorn.play(); - } else { - this._Popcorn.pause(); - } -}; - -IriSP.PlayerWidget.prototype.muteHandler = function() { - this._Popcorn.mute(!this._Popcorn.muted()); -}; - -IriSP.PlayerWidget.prototype.volumeUpdater = function() { - var _muted = this._Popcorn.muted(), - _vol = this._Popcorn.volume(); - if (_vol === false) { - _vol = .5; - } - var _soundCtl = this.selector.find(".Ldt-CtrlSound"); - _soundCtl.removeClass("Ldt-CtrlSound-Mute Ldt-CtrlSound-Half Ldt-CtrlSound-Full"); - if (_muted) { - _soundCtl.attr("title", IriSP.i18n.getMessage('unmute')) - .addClass("Ldt-CtrlSound-Mute"); - } else { - _soundCtl.attr("title", IriSP.i18n.getMessage('mute')) - .addClass(_vol < .5 ? "Ldt-CtrlSound-Half" : "Ldt-CtrlSound-Full" ) - } - var _cursor = this.selector.find(".Ldt-Ctrl-Volume-Cursor"); - _cursor.css({ - "left": ( _muted ? 0 : Math.floor(_vol * (_cursor.parent().width() - _cursor.outerWidth())) ) + "px" - }) -}; - -IriSP.PlayerWidget.prototype.showSearchBlock = function() { - var self = this; - - if (this._searchBlockOpen == false) { - this.selector.find(".LdtSearch").show("blind", { direction: "horizontal"}, 100); - this.selector.find(".LdtSearchInput").css('background-color','#fff'); - - this._searchBlockOpen = true; - this.selector.find(".LdtSearchInput").bind('keyup', null, function() { self.searchHandler.call(self); } ); - this.selector.find(".LdtSearchInput").focus(); - - // we need this variable because some widget can find a match in - // their data while at the same time other's don't. As we want the - // search field to become green when there's a match, we need a - // variable to remember that we had one. - this._positiveMatch = false; - - // tell the world the field is open - this._Popcorn.trigger("IriSP.search.open"); - } -}; - -IriSP.PlayerWidget.prototype.hideSearchBlock = function() { - if (this._searchBlockOpen == true) { - this._searchLastValue = this.selector.find(".LdtSearchInput").attr('value'); - this.selector.find(".LdtSearchInput").attr('value',''); - this.selector.find(".LdtSearch").hide("blind", { direction: "horizontal"}, 75); - - // unbind the watcher event. - this.selector.find(".LdtSearchInput").unbind('keypress set'); - this._searchBlockOpen = false; - - this._positiveMatch = false; - - this._Popcorn.trigger("IriSP.search.closed"); - } -}; - -/** react to clicks on the search button */ -IriSP.PlayerWidget.prototype.searchButtonHandler = function() { - var self = this; - - /* show the search field if it is not shown */ - if ( this._searchBlockOpen == false ) { - this.showSearchBlock(); - this.selector.find(".LdtSearchInput").attr('value', this._searchLastValue); - this._Popcorn.trigger("IriSP.search", this._searchLastValue); // trigger the search to make it more natural. - } else { - this.hideSearchBlock(); - } -}; - -/** this handler is called whenever the content of the search - field changes */ -IriSP.PlayerWidget.prototype.searchHandler = function() { - this._searchLastValue = this.selector.find(".LdtSearchInput").attr('value'); - this._positiveMatch = false; - - // do nothing if the search field is empty, instead of highlighting everything. - if (this._searchLastValue == "") { - this._Popcorn.trigger("IriSP.search.cleared"); - this.selector.find(".LdtSearchInput").css('background-color',''); - } else { - this._Popcorn.trigger("IriSP.search", this._searchLastValue); - } -}; - -/** - handler for the IriSP.search.found message, which is sent by some views when they - highlight a match. -*/ -IriSP.PlayerWidget.prototype.searchMatch = function() { - this._positiveMatch = true; - this.selector.find(".LdtSearchInput").css('background-color','#e1ffe1'); -}; - -/** the same, except that no value could be found */ -IriSP.PlayerWidget.prototype.searchNoMatch = function() { - if (this._positiveMatch !== true) - this.selector.find(".LdtSearchInput").css('background-color', "#d62e3a"); -}; - -/** react to an IriSP.Player.triggeredSearch - that is, when - a widget ask the PlayerWidget to do a search on his behalf */ -IriSP.PlayerWidget.prototype.triggeredSearch = function(searchString) { - this.showSearchBlock(); - this.selector.find(".LdtSearchInput").attr('value', searchString); - this._Popcorn.trigger("IriSP.search", searchString); // trigger the search to make it more natural. -}; - - -/* - * - * Copyright 2010 Institut de recherche et d'innovation - * contributor(s) : Samuel Huron - * - * contact@iri.centrepompidou.fr - * http://www.iri.centrepompidou.fr - * - * This software is a computer program whose purpose is to show and add annotations on a video . - * This software is governed by the CeCILL-C license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL-C - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL-C license and that you accept its terms. -*/ -// CHART TIMELINE / VERSION PROTOTYPE :: - -/** the polemic widget */ -IriSP.PolemicWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); - - this.userPol = new Array(); - this.userNoPol = new Array(); - this.userst = new Array(); - this.numberOfTweet = 0; - this.Users; - this.TweetPolemic; - this.yMax = this.height; - this.PaperSlider; - this.heightOfChart; - this.tweets = new Array(); - this.svgElements = {}; - - this.oldSearchMatches = []; -}; - -IriSP.PolemicWidget.prototype = new IriSP.Widget(); - -IriSP.PolemicWidget.prototype.draw = function() { - - // variable - // yMax - - var self = this; - var yCoef = 2; // coef for height of 1 tweet - var frameSize = 5; // frame size - var margin = 1; // marge between frame - var lineSize = this.width; // timeline pixel width - var nbrframes = lineSize/frameSize; // frame numbers - var numberOfTweet = 0; // number of tweet overide later - var duration = this.getDuration(); // timescale width - var frameLength = lineSize / frameSize; // frame timescale - var timeline; - var colors = new Array("","#1D973D","#036AAE","#CE0A15","#C5A62D","#585858"); - - // array - //var tweets = new Array(); - var element = new Array(); - var cluster = new Array(); - var frames = new Array(frameLength); - var slices = new Array(); - - - // Classes ======================================================================= - var Frames = function(){ - - var Myclusters; - var x; - var y; - var width; - var height; - }; - Frames = function(json){ - // make my clusters - // ou Frame vide - }; - Frames.prototype.draw = function(){ - }; - Frames.prototype.zoom = function(){ - }; - Frames.prototype.inside = function(){ - }; - var Clusters = function(){ - var Object; - var yDist; - var x; - var y; - var width; - var height; - }; - Clusters = function(json){ - // make my object - }; - var Tweet = function(){ - }; - // Classes ======================================================================= - - // Refactoring (parametere) ************************************************************ - // color translastion - var qTweet_0 =0; - var qTweet_Q =0; - var qTweet_REF=0; - var qTweet_OK =0; - var qTweet_KO =0; - function colorTranslation(value){ - if(value == "Q"){ - qTweet_Q+=1; - return 2; - }else if(value =="REF"){ - qTweet_REF+=1; - return 4; - }else if(value =="OK"){ - qTweet_OK+=1; - return 1; - }else if(value =="KO"){ - qTweet_KO+=1; - return 3; - }else if(value ==""){ - qTweet_0+=1; - return 5; - } - } - - - this._serializer.sync(function(data) { loaded_callback.call(self, data); return; }); - - function loaded_callback (json) { - var view_type = this._serializer.getTweets(); - - - if (typeof(view_type) === "undefined") { - var view_type = this._serializer.getTweetIds()[0]; - if (typeof(view_type) === "undefined") { - // default to guessing if nothing else works. - var view = json.views[0]; - - if(typeof(view.annotation_types) !== "undefined") { - /* we need to be backward compatible with the old files which used to - feature only two lines : Chapitrage and Tweets. We've added a - "Contributions" line so we need to discriminate against that */ - if (view.annotation_types.length === 2 && typeof(this._serializer.getContributions()) === "undefined") { - var view_type = view.annotation_types[1]; - } else { - console.log("PolemicWidget: invalid file - minimizing"); - return; - } - } - } - } - - // Make and define the Raphael area - this.paper = Raphael(document.getElementById(this._id), this._config.width, this._config.height); - - // event handlers - this._Popcorn.listen("IriSP.search", IriSP.wrap(this, function(searchString) { this.searchHandler(searchString); })); - this._Popcorn.listen("IriSP.search.closed", IriSP.wrap(this, this.searchFieldClosedHandler)); - this._Popcorn.listen("IriSP.search.cleared", IriSP.wrap(this, this.searchFieldClearedHandler)); - this.selector.mouseleave(IriSP.wrap(this, function() { self.TooltipWidget.hide.call(self.TooltipWidget); })); - this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.sliderUpdater)); - this._Popcorn.listen("IriSP.Mediafragment.showAnnotation", IriSP.wrap(this, this.showAnnotation)); - - for(var i = 0; i < json.annotations.length; i++) { - var item = json.annotations[i]; - var MyTime = Math.floor(item.begin/duration*lineSize); - var Myframe = Math.floor(MyTime/lineSize*frameLength); - - if (typeof(item.meta) !== "undefined" - && typeof(item.meta["id-ref"]) !== "undefined" - && item.meta["id-ref"] === view_type) { - - var MyTJson = {}, - _source = IriSP.get_aliased(item.meta, ['dc:source', 'source']); - if (_source !== null) { - var MyTJson = JSON.parse(_source['content']); - } - - if (item.content['polemics'] != undefined - && item.content['polemics'][0] != null) { - - // a tweet can have many polemics at the same time. - for(var j=0; j max) { - max = moy; - } - } - - var tweetDrawed = new Array(); - var TweetHeight = 5; - var newHeight = TweetHeight * max + 10; - - - if (newHeight > this.height) { - this.paper.setSize(this.width, newHeight); - this.height = newHeight; - console.log("resizeing"); - } - - - // DRAW TWEETS ============================================ - for(var i = 0; i < nbrframes; i++) { - var addEheight = 5; - if (frames[i] != undefined){ - // by type - - for (var j = 6; j > -1; j--) { - if (frames[i].qualifVol[j] != undefined) { - // show tweet by type - for (var k = 0; k < frames[i].mytweetsID.length; k++) { - - if (frames[i].mytweetsID[k].qualification == j) { - var x = i * frameSize; - var y = this.height - addEheight; - - if (this.yMax > y) { - this.yMax = y; - } - - /* some tweets seem to be duplicated - so we make a check before - creating a new rect */ - if (this.svgElements.hasOwnProperty(frames[i].mytweetsID[k].cinecast_id)) - continue; - - var e = this.paper.rect(x, y, frameSize - margin, TweetHeight /* height */) - .attr({stroke:"#00","stroke-width":0.1, fill: colors[j]}); - - addEheight += TweetHeight; - - /* stick a lot of things into e because that's the easiest way - to do it */ - e.color = colors[j]; - e.time = frames[i].mytweetsID[k].timeframe; - e.title = frames[i].mytweetsID[k].title; - e.id = frames[i].mytweetsID[k].cinecast_id; - this.svgElements[e.id] = e; - - IriSP.jQuery(e.node).mouseenter(function(element) { return function (_e) { - self.TooltipWidget.show.call(self.TooltipWidget, element.title, element.attr("fill"), element.attrs.x + element.attrs.width / 2, element.attrs.y - 2); - element.displayed = true; - self._Popcorn.trigger("IriSP.TraceWidget.MouseEvents", { - "widget" : "StackGraphWidget", - "type": "mousemove", - "x": _e.pageX, - "y": _e.pageY, - "annotation_id": element.id - }); - }}(e)).mousedown(function(element) { return function () { - self._Popcorn.currentTime(element.time/1000); - self._Popcorn.trigger("IriSP.PolemicTweet.click", element.id); - } - }(e)); - - IriSP.jQuery(e.node).attr('id', 't' + k + ''); - IriSP.jQuery(e.node).attr('title', frames[i].mytweetsID[k].title); - IriSP.jQuery(e.node).attr('begin', frames[i].mytweetsID[k].timeframe); - } - } - } - } - } - - } - // DRAW UI :: resize border and bgd - this.paperBackground = this.paper.rect(0, 0, this.width, this.height).attr({fill:"#F8F8F8","stroke-width":0.1,opacity: 1}); - - // outer borders - this.outerBorders = []; - this.outerBorders.push(this.paper.rect(0, this.height - 1, this.width, 1).attr({fill:"#ababab",stroke: "none",opacity: 1})); - this.outerBorders.push(this.paper.rect(0, 0, this.width, 1).attr({fill:"#ababab",stroke: "none",opacity: 1})); - - // inner borders - this.innerBorders = []; - this.innerBorders.push(this.paper.rect(1, this.height - 2, this.width, 1).attr({fill:"#efefef",stroke: "none",opacity: 1})); - this.innerBorders.push(this.paper.rect(1, 1, this.width, 1).attr({fill:"#efefef",stroke: "none",opacity: 1})); - this.innerBorders.push(this.paper.rect(1, 1, 1, this.height - 2).attr({fill:"#d0d1d1",stroke: "none",opacity: 0.8})); - this.innerBorders.push(this.paper.rect(this.width - 2, 1, 1, this.height - 2).attr({fill:"#efefef",stroke: "none",opacity: 1})); - - - - this.paperSlider = this.paper.rect(0, 0, 0, this.height).attr({fill:"#D4D5D5", stroke: "none", opacity: 1}); - - // the small white line displayed over the slider. - this.sliderTip = this.paper.rect(0, 0, 1, this.height).attr({fill:"#fc00ff", stroke: "none", opacity: 1}); - // decalage - // tweetSelection = this.paper.rect(-100,-100,5,5).attr({fill:"#fff",stroke: "none",opacity: 1}); - - - this.paperSlider.toBack(); - this.paperBackground.toBack(); - this.sliderTip.toFront(); - } - - -} - -/** update the positionMarker as time passes */ -IriSP.PolemicWidget.prototype.sliderUpdater = function() { - - var time = +this._Popcorn.currentTime(); - var duration = this.getDuration(); - - this.paperSlider.attr("width", time * (this.width / (duration / 1000))); - - this.sliderTip.attr("x", time * (this.width / (duration / 1000))); -}; - -/** reacts to IriSP.search events */ -IriSP.PolemicWidget.prototype.searchHandler = function(searchString) { - if (searchString == "") - return; - - var matches = this._serializer.searchTweetsOccurences(searchString); - - if (IriSP.countProperties(matches) > 0) { - this._Popcorn.trigger("IriSP.search.matchFound"); - } else { - this._Popcorn.trigger("IriSP.search.noMatchFound"); - } - - - // decrease the opacity of the other elements. - for (var id in this.svgElements) { - var e = this.svgElements[id]; - e.attr({fill: e.color, opacity: 0.4}); - } - - - for (var id in matches) { - if (this.svgElements.hasOwnProperty(id)) { - var e = this.svgElements[id]; - this.svgElements[id].attr({fill: "#fc00ff", opacity: 1}); - } - } - - this.oldSearchMatches = matches; -}; - -/** reacts to IriSP.search.cleared messages */ -IriSP.PolemicWidget.prototype.searchFieldClearedHandler = function() { - for (var id in this.svgElements) { - var e = this.svgElements[id]; - e.attr({fill: e.color, opacity: 1}); - } -}; - -/** reacts to IriSP.search.closed messages by clearing the highlighted elements */ -IriSP.PolemicWidget.prototype.searchFieldClosedHandler = function() { - for (var id in this.svgElements) { - var e = this.svgElements[id]; - e.attr({fill: e.color, opacity: 1}); - } - -}; - -IriSP.PolemicWidget.prototype.showAnnotation = function(id) { - if (this.svgElements.hasOwnProperty(id)) { - var e = this.svgElements[id]; - this.TooltipWidget.show(e.title, e.attr("fill"), e.x - 103, e.y - 160); - } -}; -IriSP.SegmentsWidget = function(Popcorn, config, Serializer) { - - var self = this; - IriSP.Widget.call(this, Popcorn, config, Serializer); - this.oldSearchMatches = []; - - // event handlers - this._Popcorn.listen("IriSP.search", function(searchString) { self.searchHandler.call(self, searchString); }); - this._Popcorn.listen("IriSP.search.closed", function() { self.searchFieldClosedHandler.call(self); }); - this._Popcorn.listen("IriSP.search.cleared", function() { self.searchFieldClearedHandler.call(self); }); - - this.defaultColors = ["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"] -}; - -IriSP.SegmentsWidget.prototype = new IriSP.Widget(); - -IriSP.SegmentsWidget.prototype.draw = function() { - - var self = this; - var annotations = this._serializer._data.annotations; - - this.selector.addClass("Ldt-SegmentsWidget"); - this.selector.append(Mustache.to_html(IriSP.overlay_marker_template)); - - this.positionMarker = this.selector.find(".Ldt-SegmentPositionMarker"); - - this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.positionUpdater)); - var duration = this.getDuration(); - - if (this.cinecast_version) { - var segments_annotations = IriSP.underscore.filter( - this._serializer._data.annotations, - function(_a) { - return _a.type == "cinecast:MovieExtract"; - } - ); - } - else { - - var view_type = this._serializer.getChapitrage(); - if (typeof(view_type) === "undefined") { - view_type = this._serializer.getNonTweetIds()[0]; - } - - - var i = 0; - - var segments_annotations = []; - - for (i = 0; i < annotations.length; i++) { - var annotation = annotations[i]; - - /* filter the annotations whose type is not the one we want */ - if (view_type != "" && typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined" - && annotation.meta["id-ref"] != view_type) { - continue; - } - - segments_annotations.push(annotation); - } -} - var _w = this.selector.width(); - var lastSegment = IriSP.underscore.max(segments_annotations, function(annotation) { return annotation.end; }); - - for (i = 0; i < segments_annotations.length; i++) { - - var annotation = segments_annotations[i]; - var begin = (+ annotation.begin); - var end = (+ annotation.end); - var id = annotation.id; - - var startPixel = Math.floor(_w * (begin / duration)); - - var endPixel = Math.floor(_w * (end / duration)); - if (annotation.id !== lastSegment.id) - var pxWidth = endPixel - startPixel -1; - else - /* the last segment has no segment following it */ - var pxWidth = endPixel - startPixel; - - var divTitle = this.cinecast_version - ? annotation.content.data - : annotation.content.title + ( annotation.content.title ? "
" : "" ) + annotation.content.description.replace(/(^.{120,140})[\s].+$/,'$1…'); - - var thumbUrl = annotation.meta.thumbnail || ''; - - var hexa_color = typeof(annotation.content.color) !== "undefined" - ? '#' + IriSP.DEC_HEXA_COLOR(annotation.content.color) - : typeof(annotation.color) !== "undefined" - ? '#' + IriSP.DEC_HEXA_COLOR(annotation.color) - : this.defaultColors[i % this.defaultColors.length]; - - /* - if (hexa_color === "FFCC00") - hexa_color = "333"; - */ - if (hexa_color.length == 5) - hexa_color = hexa_color + '00'; - - - var annotationTemplate = Mustache.to_html(IriSP.annotation_template, - {"divTitle" : divTitle, "id" : id, "startPixel" : startPixel, - "pxWidth" : pxWidth, "hexa_color" : hexa_color, - "seekPlace" : Math.round(begin/1000), "thumbnailUrl": thumbUrl}); - - - this.selector.append(annotationTemplate); - - /* add a special class to the last segment and change its border */ - if (annotation.id === lastSegment.id) { - IriSP.jqId(id).addClass("Ldt-lastSegment").css("border-color", hexa_color); - } - } - // react to mediafragment messages. - this._Popcorn.listen("IriSP.Mediafragment.showAnnotation", - function(id, divTitle) { - - var divObject = IriSP.jqId(id); - if (divObject.length) { - divObject.fadeTo(0,1); - var offset_x = divObject.position().left + divObject.outerWidth() / 2; - self.TooltipWidget.show(divObject.attr("title"), IriSP.jQuery(this).css("background-color"), offset_x, 0); - IriSP.jQuery(document).one("mousemove", function() { divObject.fadeTo(0,.5); - self.TooltipWidget.hide(); }); - } - }); - - this.selector.find(".Ldt-iri-chapter") - .fadeTo(0, .5) - .click(function() { - self._Popcorn.trigger("IriSP.SegmentsWidget.click", this.id); - self._Popcorn.currentTime(IriSP.jQuery(this).attr("data-seek")); - }) - .mouseover( function(event) { - var divObject = IriSP.jQuery(this); - divObject.fadeTo(0,1); - var offset_x = divObject.position().left + divObject.outerWidth() / 2; - var thumb = divObject.attr("thumbnail-url"); - var txt = divObject.attr("title") + (thumb && thumb.length ? '
' : ''); - self.TooltipWidget.show(txt, IriSP.jQuery(this).css("background-color"), offset_x, 0); - }) - .mouseout(function(){ - IriSP.jQuery(this).fadeTo(0,.5); - self.TooltipWidget.hide(); - }); -}; - -/* restores the view after a search */ -IriSP.SegmentsWidget.prototype.clear = function() { - this.selector.children(".Ldt-iri-chapter").fadeTo(0,.5); -}; - -IriSP.SegmentsWidget.prototype.clickHandler = function(annotation) { - this._Popcorn.trigger("IriSP.SegmentsWidget.click", annotation.id); - var begin = (+ annotation.begin) / 1000; - this._Popcorn.currentTime(Math.round(begin)); -}; - -IriSP.SegmentsWidget.prototype.searchHandler = function(searchString) { - - if (searchString == "") - return; - - var matches = this._serializer.searchOccurences(searchString); - - if (IriSP.countProperties(matches) > 0) { - this._Popcorn.trigger("IriSP.search.matchFound"); - } else { - this._Popcorn.trigger("IriSP.search.noMatchFound"); - } - - // un-highlight all the blocks - this.selector.children(".Ldt-iri-chapter").css("opacity", 0.1); - - // then highlight the ones with matches. - for (var id in matches) { - var factor = 0.5 + matches[id] * 0.2; - this.selector.find("#"+id).dequeue(); - this.selector.find("#"+id).animate({opacity:factor}, 200); - } - - - this.oldSearchMatches = matches; -}; - -IriSP.SegmentsWidget.prototype.searchFieldClearedHandler = function() { - this.clear(); -}; - -IriSP.SegmentsWidget.prototype.searchFieldClosedHandler = function() { - this.clear(); -}; - -IriSP.SegmentsWidget.prototype.positionUpdater = function() { - var duration = this.getDuration() / 1000; - var time = this._Popcorn.currentTime(); - //var position = ((time / duration) * 100).toFixed(2); - var position = ((time / duration) * 100).toFixed(2); - - this.positionMarker.css("left", position + "%"); -}; - -IriSP.SegmentsWidget.prototype.showAnnotation = function() { - -}; -/** A widget to create a new segment */ -IriSP.SliceWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); - -}; - -IriSP.SliceWidget.prototype = new IriSP.Widget(); - -IriSP.SliceWidget.prototype.draw = function() { - var templ = Mustache.to_html(IriSP.sliceWidget_template); - this.selector.append(templ); - - this.sliceZone = this.selector.find(".Ldt-sliceZone"); - - /* global variables used to keep the position and width - of the zone. - */ - this.zoneLeft = 0; - this.zoneWidth = 0; - - this.leftHandle = this.selector.find(".Ldt-sliceLeftHandle"); - this.rightHandle = this.selector.find(".Ldt-sliceRightHandle"); - - var left = this.selector.offset().left; - var top = this.selector.offset().top; - - // a bug in firefox makes it use the wrong format - if (!IriSP.jQuery.browser.mozilla) { - // contain the handles correctly - we cannot set - // containment: parent because it wouldn't allow to select the - // whole slice, so we have to compute a box in which the slice is - // allowed to move. - var containment = [left - 8, top, this.selector.width() + left, top]; - - // var containment = [left - 16, top, this.selector.width() + left - 8, top]; - this.leftHandle.draggable({axis: "x", - drag: IriSP.wrap(this, this.leftHandleDragged), - containment: containment - }); - - containment = [left, top, this.selector.width() + left, top]; - // containment = [left, top, this.selector.width() + left - 8, top]; - this.rightHandle.draggable({axis: "x", - drag: IriSP.wrap(this, this.rightHandleDragged), - containment: containment - }); - - } else { // firefox - // we need to define a containment specific to firefox. - - var containment = [left - 16, top, this.selector.width() + left - 8, top]; - this.leftHandle.draggable({axis: "x", - drag: IriSP.wrap(this, this.leftHandleDragged), - containment: containment - }); - - containment = [left, top, this.selector.width() + left - 8, top]; - this.rightHandle.draggable({axis: "x", - drag: IriSP.wrap(this, this.rightHandleDragged), - containment: containment - }); - } - - this.leftHandle.css("position", "absolute"); - this.rightHandle.css("position", "absolute"); - - this._Popcorn.listen("IriSP.SliceWidget.position", - IriSP.wrap(this, this.positionSliceHandler)); - - this._Popcorn.listen("IriSP.SliceWidget.show", IriSP.wrap(this, this.show)); - this._Popcorn.listen("IriSP.SliceWidget.hide", IriSP.wrap(this, this.hide)); - this.selector.hide(); -}; - -/** responds to an "IriSP.SliceWidget.position" message - @param params an array with the first element being the left distance in - percents and the second element the width of the slice in pixels -*/ -IriSP.SliceWidget.prototype.positionSliceHandler = function(params) { - left = params[0]; - width = params[1]; - - this.zoneLeft = left; - this.zoneWidth = width; - this.sliceZone.css("left", left + "px"); - this.sliceZone.css("width", width + "px"); - this.leftHandle.css("left", (left - 7) + "px"); - this.rightHandle.css("left", left + width + "px"); - - this._leftHandleOldLeft = left - 7; - this._rightHandleOldLeft = left + width; -}; - -/** handle a dragging of the left handle */ -IriSP.SliceWidget.prototype.leftHandleDragged = function(event, ui) { - /* we have a special variable, this._leftHandleOldLeft, to keep the - previous position of the handle. We do that to know in what direction - is the handle being dragged - */ - - var currentX = this.leftHandle.offset().left; - var rightHandleX = Math.floor(this.rightHandle.position()["left"]); - - var container_offset = this.selector.offset().left; - - if (Math.floor(ui.position.left) >= rightHandleX - 7) { - /* prevent the handle from moving past the right handle */ - ui.position.left = rightHandleX - 7; - } - - this.zoneWidth = rightHandleX - Math.floor(ui.position.left) - 7; - this.zoneLeft = Math.floor(ui.position.left) + 8; - - this.sliceZone.css("width", this.zoneWidth); - this.sliceZone.css("left", this.zoneLeft + "px"); - - this._leftHandleOldLeft = ui.position.left; - this.broadcastChanges(); - -}; - -/** handle a dragging of the right handle */ -IriSP.SliceWidget.prototype.rightHandleDragged = function(event, ui) { - /* we have a special variable, this._leftHandleOldLeft, to keep the - previous position of the handle. We do that to know in what direction - is the handle being dragged - */ - - var currentX = this.leftHandle.position()["left"]; - var leftHandleX = Math.floor(this.leftHandle.position()["left"]); - - var container_offset = this.selector.offset().left + this.selector.width(); - - if (Math.floor(ui.position.left) < leftHandleX + 7) { - /* prevent the handle from moving past the left handle */ - ui.position.left = leftHandleX + 7; - } - - this.zoneWidth = Math.floor(ui.position.left) - (leftHandleX + 7); - - this.sliceZone.css("width", this.zoneWidth); - //this.sliceZone.css("left", this.zoneLeft + "px"); - this._rightHandleOldLeft = Math.floor(this._rightHandleOldLeft); - this.broadcastChanges(); -}; - -/** tell to the world that the coordinates of the slice have - changed -*/ -IriSP.SliceWidget.prototype.broadcastChanges = function() { - var leftPercent = (this.zoneLeft / this.selector.width()) * 100; - var zonePercent = (this.zoneWidth / this.selector.width()) * 100; - - this._Popcorn.trigger("IriSP.SliceWidget.zoneChange", [leftPercent, zonePercent]); -}; - -IriSP.SliceWidget.prototype.show = function() { - this.selector.show(); -}; - -IriSP.SliceWidget.prototype.hide = function() { - this.selector.hide(); -}; -/** A widget to display slide show from embed slide share */ -IriSP.SlideShareWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); - // Default flash embed size - this.embed_width = 425; - this.embed_height = 355; - if(this._config.embed_width){ - this.embed_width = this._config.embed_width; - } - if(this._config.embed_height){ - this.embed_height = this._config.embed_height; - } -}; - -IriSP.SlideShareWidget.prototype = new IriSP.Widget(); - -IriSP.SlideShareWidget.prototype.draw = function() { - var self = this; - - // If the div supposed to host the slides does not exist, we cancel - if(this.selector.length==0){ - if(console){ if(console.log){ console.log("No div for slideshare widget, this widget is canceled. id = " + this._id); } } - return; - } - var templ = Mustache.to_html(IriSP.slideShareWidget_template); - this.selector.append(templ); - - // global variables used to keep the position and width of the zone. - this.zoneLeft = 0; - this.zoneWidth = 0; - // global variable to save the last slide url - this.lastSSFullUrl = ""; - this.lastSSUrl = ""; - this.lastSSId = ""; - this.containerDiv = this.selector.find('.SlideShareContainer'); - - // Synchro management - this._disableUpdate = false; - this.buttonsDiv = this.selector.find('.SlideShareButtons'); - this.buttonsDiv.width(this.embed_width - 2); // -2 because of css borders 328 -> 235px - this.buttonsDiv.find('.left_icon').css("margin-left",(this.embed_width-96)+"px"); - this.buttonsDiv.find('.ss_sync_on').click(function(event) { self.unSyncHandler.call(self, event); }); - this.buttonsDiv.find('.ss_sync_off').click(function(event) { self.syncHandler.call(self, event); }); - this.buttonsDiv.find('.ss_sync_off').hide(); - this.buttonsDiv.hide(); - - // Update the slide from timeupdate event - this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.slideShareUpdater)); - - this._Popcorn.listen("IriSP.SlideShareWidget.show", IriSP.wrap(this, this.show)); - this._Popcorn.listen("IriSP.SlideShareWidget.hide", IriSP.wrap(this, this.hide)); - - // Get data from "slideshare" cutting/annotation-type - var annotations = this._serializer._data.annotations; - var view_type = this._serializer.getSlideShareType(); - if(typeof(view_type) === "undefined") { - if(console){ if(console.log){ console.log("No annotation-type for slideshare widget, this widget is canceled and the container is visible hidden."); } } - this.selector.hide(); - return; - } - var i = 0; - this.segments_slides = []; - var nb_annot = annotations.length; - for (i = 0; i < nb_annot; i++) { - var annotation = annotations[i]; - /* filter the annotations whose type is not the one we want */ - if (view_type != "" && typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined" - && annotation.meta["id-ref"] != view_type) { - continue; - } - this.segments_slides.push(annotation); - } -}; - -/* update the slider and the position marker as time passes */ -IriSP.SlideShareWidget.prototype.slideShareUpdater = function() { - // If it is asked not to synchronize, we do nothing - if(this._disableUpdate) - return; - - var self = this; - - // We search if a segments_slides is in the current timecode - var time = this._Popcorn.currentTime() * 1000; - var nb_slides = this.segments_slides.length; - var forceEmpty = false; - for (i = 0; i < nb_slides; i++) { - var segment_slide = this.segments_slides[i]; - if(segment_slide.begin
'; - this.containerDiv.html(embed_code); - } - else{ - // If the presentation was already loaded, we only use the ss js api to load the wanted slide number - var embed = null; - if(this.lastSSId!=""){ - // If the presentation was loaded from a public url, we get the div from its id. - embed = document.getElementsByName("__sse" + this.lastSSId)[0]; - } - else if(this.lastSSUrl.substring(0,7)!="http://"){ - // If the presentation was loaded from a private id, we get the div from dom tree. - embed = this.containerDiv.children()[0].children[0]; - } - if(embed){ - embed.jumpTo(parseInt(slideNb)); - } - } - return; - } - } - } - } - if(forceEmpty==true){ - this.lastSSFullUrl = ""; - this.lastSSUrl = ""; - this.lastSSId = ""; - this.containerDiv.html(""); - this.buttonsDiv.hide(); - } - -}; - -// Functions to stop or trigger sync between timeupdate event and slides -IriSP.SlideShareWidget.prototype.unSyncHandler = function() { - //console.log("slideShare NO SYNC !"); - this._disableUpdate = true; - this.buttonsDiv.find('.ss_sync_on').hide(); - this.buttonsDiv.find('.ss_sync_off').show(); -}; -IriSP.SlideShareWidget.prototype.syncHandler = function() { - //console.log("slideShare SYNC PLEASE !"); - this._disableUpdate = false; - this.buttonsDiv.find('.ss_sync_on').show(); - this.buttonsDiv.find('.ss_sync_off').hide(); -}; - - -/** responds to an "IriSP.SlideShareWidget.position" message - @param params an array with the first element being the left distance in - percents and the second element the width of the slice in pixels -*/ -IriSP.SlideShareWidget.prototype.positionSlideShareHandler = function(params) { - //console.log("positionSlideShareHandler"); -}; - - -IriSP.SlideShareWidget.prototype.show = function() { - this.selector.show(); -}; - -IriSP.SlideShareWidget.prototype.hide = function() { - this.selector.hide(); -}; -IriSP.SliderWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); -}; - -IriSP.SliderWidget.prototype = new IriSP.Widget(); - -IriSP.SliderWidget.prototype.draw = function() { - var self = this; - - this.selector.append(Mustache.to_html(IriSP.sliderWidget_template, {})); - this.selector.addClass("Ldt-SliderMinimized"); - - this.sliderBackground = this.selector.find(".Ldt-sliderBackground"); - this.sliderForeground = this.selector.find(".Ldt-sliderForeground"); - this.positionMarker = this.selector.find(".Ldt-sliderPositionMarker"); - - - // a special variable to stop methods from tinkering - // with the positionMarker when the user is dragging it - this.draggingOngoing = false; - - // another special variable used by the timeout handler to - // open or close the slider. - this.sliderMaximized = false; - this.timeOutId = null; - - - this.positionMarker.draggable({axis: "x", - start: IriSP.wrap(this, this.positionMarkerDraggingStartedHandler), - stop: IriSP.wrap(this, this.positionMarkerDraggedHandler), - containment: "parent" - }); - this.positionMarker.css("position", "absolute"); - - this.sliderBackground.click(function(event) { self.backgroundClickHandler.call(self, event); }); - this.sliderForeground.click(function(event) { self.foregroundClickHandler.call(self, event); }); - - this.selector.hover(IriSP.wrap(this, this.mouseOverHandler), IriSP.wrap(this, this.mouseOutHandler)); - - // update the positions - this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.sliderUpdater)); - - // special messages : - this._Popcorn.listen("IriSP.PlayerWidget.MouseOver", IriSP.wrap(this, this.mouseOverHandler)); - this._Popcorn.listen("IriSP.PlayerWidget.MouseOut", IriSP.wrap(this, this.mouseOutHandler)); -}; - -/* update the slider and the position marker as time passes */ -IriSP.SliderWidget.prototype.sliderUpdater = function() { - if(this.draggingOngoing || this._disableUpdate) - return; - - var time = this._Popcorn.currentTime(); - - var duration = this.getDuration() / 1000; - var percents = time / duration; - - /* we do these complicated calculations to center exactly - the position Marker */ - - var divWidth = this.selector.width(); - var pixels = Math.floor(this.selector.width() * percents); - var positionMarker_width = this.positionMarker.width(); - var correction = (positionMarker_width / 2); - - /* check that we don't leave the left side */ - var newPos = pixels - correction; - if (newPos <= 0) - newPos = 0; - - /* check that we don't leave the right side */ - var rightEdgePos = pixels + 1 * correction; - - if (rightEdgePos >= divWidth) - newPos = divWidth - 1 * correction - 1; - - this.sliderForeground.css("width", pixels + "px"); - this.positionMarker.css("left", newPos + "px"); - -}; - -IriSP.SliderWidget.prototype.backgroundClickHandler = function(event) { - /* this piece of code is a little bit convoluted - here's how it works : - we want to handle clicks on the progress bar and convert those to seeks in the media. - However, jquery only gives us a global position, and we want a number of pixels relative - to our container div, so we get the parent position, and compute an offset to this position, - and finally compute the progress ratio in the media. - Finally we multiply this ratio with the duration to get the correct time - */ - - var parentOffset = this.sliderBackground.parent().offset(); - var width = this.sliderBackground.width(); - var relX = event.pageX - parentOffset.left; - - var duration = this.getDuration() / 1000; - var newTime = ((relX / width) * duration).toFixed(2); - - this._Popcorn.currentTime(newTime); -}; - -/* same function as the previous one, except that it handles clicks - on the foreground element */ -IriSP.SliderWidget.prototype.foregroundClickHandler = function(event) { - var parentOffset = this.sliderForeground.parent().offset(); - var width = this.sliderBackground.width(); - var relX = event.pageX - parentOffset.left; - - var duration = this.getDuration() / 1000; - var newTime = ((relX / width) * duration).toFixed(2); - - this._Popcorn.currentTime(newTime); -}; - -/* handles mouse over the slider */ -IriSP.SliderWidget.prototype.mouseOverHandler = function(event) { - - if (this.timeOutId !== null) { - window.clearTimeout(this.timeOutId); - } - - this.sliderMaximized = true; - - this.sliderBackground.animate({"height": "9px"}, 100); - this.sliderForeground.animate({"height": "9px"}, 100); - this.positionMarker.animate({"height": "9px", "width": "9px"}, 100); - //this.positionMarker.css("margin-top", "-4px"); - -// this.selector.removeClass("Ldt-SliderMinimized"); -// this.selector.addClass("Ldt-SliderMaximized"); -}; - -/* handles when the mouse leaves the slider */ -IriSP.SliderWidget.prototype.mouseOutHandler = function(event) { - - this.timeOutId = window.setTimeout(IriSP.wrap(this, this.minimizeOnTimeout), - this.minimize_period); -}; - -IriSP.SliderWidget.prototype.minimizeOnTimeout = function(event) { - this.sliderBackground.animate({"height": "5px"}, 100); - this.sliderForeground.animate({"height": "5px"}, 100); - this.positionMarker.animate({"height": "5px", "width": "5px"}, 100); - this.positionMarker.css("margin-top", "0px"); - this.sliderMinimized = true; - -// this.selector.removeClass("Ldt-SliderMaximized"); -// this.selector.addClass("Ldt-SliderMinimized"); - -}; - -// called when the user starts dragging the position indicator -IriSP.SliderWidget.prototype.positionMarkerDraggingStartedHandler = function(event, ui) { - this.draggingOngoing = true; -}; - -IriSP.SliderWidget.prototype.positionMarkerDraggedHandler = function(event, ui) { - -/* this._disableUpdate = true; // disable slider position updates while dragging is ongoing. - window.setTimeout(IriSP.wrap(this, function() { this._disableUpdate = false; }), 500); -*/ - var parentOffset = this.sliderForeground.parent().offset(); - var width = this.sliderBackground.width(); - var relX = event.originalEvent.pageX - parentOffset.left; - - var duration = this.getDuration() / 1000; - var newTime = ((relX / width) * duration).toFixed(2); - this._Popcorn.currentTime(newTime); - - this.draggingOngoing = false; -}; - -/** @class The constructor for the sparkline widget */ -IriSP.SparklineWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); - - this._oldAnnotation = null; - this._results = []; - - this.slices = this._config.slices || Math.floor(this.width/20); - if (!this.width) { - this.width = this.selector.width(); - } - if (!this.height) { - this.height = 40; - } - this.selector.css("height", this.height + "px"); - if (this._config.background) { - this.selector.css("background", this._config.background); - } -}; - - -IriSP.SparklineWidget.prototype = new IriSP.Widget(); - -IriSP.SparklineWidget.prototype.clear = function() { - -}; - -/** draw the sparkline using jquery sparkline */ -IriSP.SparklineWidget.prototype.draw = function() { - this.duration = this.getDuration(); - this.paper = new Raphael(this.selector[0], this.width, this.height); - var _this = this; - - var views = this._serializer._data.views; - var stat_view; - if (!IriSP.null_or_undefined(views)) { - for (var i = 0; i < views.length; i++) { - var view = views[i]; - if (view.id === "stat") { - stat_view = view; - break; - } - } - } - - var _ = IriSP.underscore; - // If we've found the correct view, feed the directly the data from the view - // to jquery sparkline. Otherwise, compute it ourselves. - if (!IriSP.null_or_undefined(stat_view)) { - //console.log("sparklinewidget : using stats embedded in the json"); - var _results = stat_view.meta.stat.split(","); - } else { - var _annotations = this._serializer._data.annotations; - if (this.cinecast_version) { - _annotations = _(_annotations).filter(function(_a) { - return _a.type !== "cinecast:MovieExtract"; - }); - } - var _sliceDuration = Math.floor( this.duration / this.slices), - _results = _(_.range(this.slices)).map(function(_i) { - return _(_annotations).filter(function(_a){ - return (_a.begin <= (1 + _i) * _sliceDuration) && (_a.end >= _i * _sliceDuration) - }).length; - }); - } - var _max = Math.max(1, _(_results).max()), - _h = this.height, - _scale = (_h - this.lineWidth) / _max, - _width = this.width / this.slices, - _y = _(_results).map(function(_v) { - return _h - (_scale * _v); - }), - _d = _(_y).reduce(function(_memo, _v, _k) { - return _memo + ( _k - ? 'C' + (_k * _width) + ' ' + _y[_k - 1] + ' ' + (_k * _width) + ' ' + _v + ' ' + ((_k + .5) * _width) + ' ' + _v - : 'M0 ' + _v + 'L' + (.5*_width) + ' ' + _v ) - },'') + 'L' + this.width + ' ' + _y[_y.length - 1], - _d2 = _d + 'L' + this.width + ' ' + this.height + 'L0 ' + this.height; - this.paper.path(_d2).attr({ - "stroke" : "none", - "fill" : this.fillColor - }); - - this.paper.path(_d).attr({ - "fill" : "none", - "stroke" : this.lineColor, - "stroke-width" : this.lineWidth - }); - - this.rectangleProgress = this.paper.rect(0,0,0,this.height) - .attr({ - "stroke" : "none", - "fill" : "#808080", - "opacity" : .3 - }); - this.ligneProgress = this.paper.path("M0 0L0 "+this.height).attr({"stroke":"#ff00ff", "line-width" : 2}); - // save the results in an array so that we can re-use them when a new annotation - // is added. - this._results = _results; - - this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeUpdateHandler)); -// this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", IriSP.wrap(this, this.handleNewAnnotation)); - - this.selector.click(IriSP.wrap(this, this.clickHandler)); -}; - -/** react to a timeupdate event */ -IriSP.SparklineWidget.prototype.timeUpdateHandler = function() { - var _currentTime = this._Popcorn.currentTime(), - _x = (1000 * _currentTime / this.duration) * this.width; - this.rectangleProgress.attr({ - "width" : _x - }); - this.ligneProgress.attr({ - "path" : "M" + _x + " 0L" + _x + " " + this.height - }); - -} - -/** handle clicks on the widget */ -IriSP.SparklineWidget.prototype.clickHandler = function(event) { - var relX = event.pageX - this.selector.offset().left; - var newTime = ((relX / this.width) * this.duration/1000).toFixed(2); - - this._Popcorn.trigger("IriSP.SparklineWidget.clicked", newTime); - this._Popcorn.currentTime(newTime); -}; - -/** react when a new annotation is added */ -IriSP.SparklineWidget.prototype.handleNewAnnotation = function(annotation) { -// var num_columns = this._results.length; -// var duration = this._serializer.getDuration(); -// var time_step = Math.round(duration / num_columns); /* the time interval between two columns */ -// var begin = +annotation.begin; -// var end = +annotation.end; -// -// /* increment all the values between the beginning and the end of the annotation */ -// var index_begin = Math.floor(begin / time_step); -// var index_end = Math.floor(end / time_step); -// -// for (var i = index_begin; i < Math.min(index_end, this._results.length); i++) { -// this._results[i]++; -// } -// -// this.selector.find(".Ldt-sparkLine").sparkline(this._results, {lineColor: "#7492b4", fillColor: "#aeaeb8", -// spotColor: "#b70056", -// width: this.width, height: this.height}); -};IriSP.StackGraphWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); -} - -IriSP.StackGraphWidget.prototype = new IriSP.Widget(); - -IriSP.StackGraphWidget.prototype.draw = function() { - var _ = IriSP._; - this.height = this._config.height || 50; - this.width = this.selector.width(); - this.slices = this._config.slices || ~~(this.width/(this.streamgraph ? 20 : 5)); - _(this.tags).each(function(_a) { - _a.regexp = new RegExp(_(_a.keywords).map(function(_k) { - return _k.replace(/([\W])/gm,'\\$1'); - }).join("|"),"im") - }); - this.paper = new Raphael(this.selector[0], this.width, this.height); - this.groups = []; - this.duration = this.getDuration(); - - var _annotationType = this._serializer.getTweets(), - _sliceDuration = ~~ ( this.duration / this.slices), - _annotations = this._serializer._data.annotations, - _groupedAnnotations = _(_.range(this.slices)).map(function(_i) { - return _(_annotations).filter(function(_a){ - return (_a.begin <= (1 + _i) * _sliceDuration) && (_a.end >= _i * _sliceDuration) - }); - }), - _max = IriSP._(_groupedAnnotations).max(function(_g) { - return _g.length - }).length, - _scale = this.height / _max, - _width = this.width / this.slices, - _showTitle = !this._config.excludeTitle, - _showDescription = !this._config.excludeDescription; - - - var _paths = _(this.tags).map(function() { - return []; - }); - _paths.push([]); - - for (var i = 0; i < this.slices; i++) { - var _group = _groupedAnnotations[i]; - if (_group) { - var _vol = _(this.tags).map(function() { - return 0; - }); - for (var j = 0; j < _group.length; j++){ - var _txt = (_showTitle ? _group[j].content.title : '') + ' ' + (_showDescription ? _group[j].content.description : '') - var _tags = _(this.tags).map(function(_tag) { - return (_txt.search(_tag.regexp) == -1 ? 0 : 1) - }), - _nbtags = _(_tags).reduce(function(_a,_b) { - return _a + _b; - }, 0); - if (_nbtags) { - IriSP._(_tags).each(function(_v, _k) { - _vol[_k] += (_v / _nbtags); - }); - } - } - var _nbtags = _(_vol).reduce(function(_a,_b) { - return _a + _b; - }, 0), - _nbneutre = _group.length - _nbtags, - _h = _nbneutre * _scale, - _base = this.height - _h; - if (!this.streamgraph) { - this.paper.rect(i * _width, _base, _width - 1, _h ).attr({ - "stroke" : "none", - "fill" : this.defaultcolor - }); - } - _paths[0].push(_base); - for (var j = 0; j < this.tags.length; j++) { - _h = _vol[j] * _scale; - _base = _base - _h; - if (!this.streamgraph) { - this.paper.rect(i * _width, _base, _width - 1, _h ).attr({ - "stroke" : "none", - "fill" : this.tags[j].color - }); - } - _paths[j+1].push(_base); - } - this.groups.push(_(_vol).map(function(_v) { - return _v / _group.length; - })) - } else { - for (var j = 0; j < _paths.length; j++) { - _paths[j].push(this.height); - } - this.groups.push(_(this.tags).map(function() { - return 0; - })); - } - } - - if (this.streamgraph) { - for (var j = _paths.length - 1; j >= 0; j--) { - var _d = _(_paths[j]).reduce(function(_memo, _v, _k) { - return _memo + ( _k - ? 'C' + (_k * _width) + ' ' + _paths[j][_k - 1] + ' ' + (_k * _width) + ' ' + _v + ' ' + ((_k + .5) * _width) + ' ' + _v - : 'M0 ' + _v + 'L' + (.5*_width) + ' ' + _v ) - },'') + 'L' + this.width + ' ' + _paths[j][_paths[j].length - 1] + 'L' + this.width + ' ' + this.height + 'L0 ' + this.height; - this.paper.path(_d).attr({ - "stroke" : "none", - "fill" : (j ? this.tags[j-1].color : this.defaultcolor) - }); - } - } - this.rectangleFocus = this.paper.rect(0,0,_width,this.height) - .attr({ - "stroke" : "none", - "fill" : "#ff00ff", - "opacity" : 0 - }) - this.rectangleProgress = this.paper.rect(0,0,0,this.height) - .attr({ - "stroke" : "none", - "fill" : "#808080", - "opacity" : .3 - }); - this.ligneProgress = this.paper.path("M0 0L0 "+this.height).attr({"stroke":"#ff00ff", "line-width" : 2}) - - this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeUpdateHandler)); - var _this = this; - this.selector - .click(IriSP.wrap(this, this.clickHandler)) - .mousemove(function(_e) { - _this.updateTooltip(_e); - // Trace - var relX = _e.pageX - _this.selector.offset().left; - var _duration = _this.getDuration(); - var _time = parseInt((relX / _this.width) * _duration); - _this._Popcorn.trigger("IriSP.TraceWidget.MouseEvents", { - "widget" : "StackGraphWidget", - "type": "mousemove", - "x": _e.pageX, - "y": _e.pageY, - "time": _time - }); - - }) - .mouseout(function() { - _this.TooltipWidget.hide(); - _this.rectangleFocus.attr({ - "opacity" : 0 - }) - }) -} - -IriSP.StackGraphWidget.prototype.timeUpdateHandler = function() { - var _currentTime = this._Popcorn.currentTime(), - _x = (1000 * _currentTime / this.duration) * this.width; - this.rectangleProgress.attr({ - "width" : _x - }); - this.ligneProgress.attr({ - "path" : "M" + _x + " 0L" + _x + " " + this.height - }) -} - -IriSP.StackGraphWidget.prototype.clickHandler = function(event) { - /* Ctrl-C Ctrl-V'ed from another widget - */ - - var relX = event.pageX - this.selector.offset().left; - var newTime = ((relX / this.width) * this.duration/1000).toFixed(2); - this._Popcorn.trigger("IriSP.StackGraphWidget.clicked", newTime); - this._Popcorn.currentTime(newTime); -}; - -IriSP.StackGraphWidget.prototype.updateTooltip = function(event) { - var _segment = Math.max(0,Math.min(this.groups.length - 1, Math.floor(this.slices * (event.pageX - this.selector.offset().left)/this.width))), - _valeurs = this.groups[_segment], - _width = this.width / this.slices, - _html = '
    ' + IriSP._(this.tags).map(function(_tag, _i) { - return '
  • ' - + ~~(100 * _valeurs[_i]) - + '% de ' - + _tag.description - + '
  • '; - }).join('') + '
'; - this.TooltipWidget._shown = false; // Vraiment, on ne peut pas ouvrir le widget s'il n'est pas encore ouvert ? - this.TooltipWidget.show('','',(_segment + .5)* this.width / this.slices, 0); - this.TooltipWidget.selector.find(".tip").html(_html); - this.rectangleFocus.attr({ - "x" : _segment * _width, - "opacity" : .4 - }) -} - -IriSP.TagCloudWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); -} - -IriSP.TagCloudWidget.prototype = new IriSP.Widget(); - -IriSP.TagCloudWidget.prototype.draw = function() { - - var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g, - _stopWords = [ - 'aussi', 'and', 'avec', 'aux', 'bien', 'car', 'cette', 'comme', 'dans', 'donc', 'des', 'elle', 'encore', 'entre', 'est', - 'être', 'eux', 'faire', 'fait', 'http', 'ici', 'ils', 'les', 'leur', 'leurs', 'mais', 'mes', 'même', 'mon', 'notre', - 'non', 'nos', 'nous', 'ont', 'par', 'pas', 'peu', 'peut', 'plus', 'pour', 'que', 'qui', 'sans', 'ses' ,'son', 'sont', 'sur', - 'tes', 'très', 'the', 'ton', 'tous', 'tout', 'une', 'votre', 'vos', 'vous' ], - _regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g, - _words = {}, - _showTitle = !this._config.excludeTitle, - _showDescription = !this._config.excludeDescription, - _excludePattern = this._config.excludePattern || null, - _tagCount = this._config.tagCount || 30; - if (typeof this._config.excludeWords !== "undefined" && this._config.excludeWords.length) { - IriSP._(this._config.excludeWords).each(function(_w) { - _stopWords.push(_w.toLowerCase()); - }); - } - - IriSP._(this._serializer._data.annotations).each(function(_annotation) { - if (_annotation.content && _annotation.content.description) { - var _txt = (_showTitle ? _annotation.content.title : '') + ' ' + (_showDescription ? _annotation.content.description : '') - IriSP._(_txt.toLowerCase().replace(_urlRegExp, '').match(_regexpword)).each(function(_mot) { - if (_stopWords.indexOf(_mot) == -1 && (_excludePattern == null || !_excludePattern.test(_mot))) { - _words[_mot] = 1 + (_words[_mot] || 0); - } - }) - } - }); - - _words = IriSP._(_words) - .chain() - .map(function(_v, _k) { - return { - "word" : _k, - "count" : _v - } - }) - .filter(function(_v) { - return _v.count > 2; - }) - .sortBy(function(_v) { - return - _v.count; - }) - .first(_tagCount) - .value(); - var _max = _words[0].count, - _min = Math.min(_words[_words.length - 1].count, _max - 1), - _scale = 16 / Math.sqrt(_max - _min), - _this = this, - _html = '
    ' - + IriSP._(_words) - .chain() - .shuffle() - .map(function(_word) { - var _size = 10 + _scale * Math.sqrt(_word.count - _min); - return '
  • ' - + _word.word - + '
  • ' - }) - .value() - .join("") - + '
'; - this.selector - .addClass("Ldt-TagCloud") - .html(_html); - this.selector.find("li").click(function() { - var _txt = this.textContent.replace(/(^[\s]+|[\s]+$)/g,''); - _this._Popcorn.trigger("IriSP.search.triggeredSearch", _txt); - }); - this._Popcorn.listen("IriSP.search", IriSP.wrap(this, function(searchString) { - var _rgxp = new RegExp("(" + searchString.replace(/(\W)/g,'\\$1') + ")","gi"); - this.selector.find("li").each(function(_i, _e) { - _e.innerHTML = searchString.length ? - _e.textContent.replace(_rgxp,'$1') - : _e.textContent; - }); - })); - this._Popcorn.listen("IriSP.search.closed", IriSP.wrap(this, this.endsearch)); - this._Popcorn.listen("IriSP.search.cleared", IriSP.wrap(this, this.endsearch)); -} - -IriSP.TagCloudWidget.prototype.endsearch = function() { - this.selector.find("li").each(function(_i, _e) { - _e.innerHTML = _e.textContent; - }); -} -/* this widget displays a small tooltip */ -IriSP.TooltipWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); - this._shown = false; - this._displayedText = ""; - this._hideTimeout = -1; -}; - - -IriSP.TooltipWidget.prototype = new IriSP.Widget(); - -IriSP.TooltipWidget.prototype.draw = function() { - var templ = Mustache.to_html(IriSP.tooltipWidget_template); - // position the widget absolutely relative to document. --- NOOOO !!!! - this.selector.css({ - "position": "absolute", - "top": 0, - "left": 0 - }); - this.selector.parent().css({ - "position": "relative" - }); - this.selector.append(templ); - var _this = this; - this.selector.mouseover(function() { - _this.hide(); - }); - this.hide(); - -}; - -IriSP.TooltipWidget.prototype.clear = function() { - this.selector.find(".tiptext").html(""); -}; - -IriSP.TooltipWidget.prototype.show = function(text, color, x, y) { - - if (this._displayedText == text && this._shown) - return; - - this.selector.find(".tipcolor").css("background-color", color); - this._displayedText = text; - this.selector.find(".tiptext").html(text); - - var _tip = this.selector.find(".tip"); - _tip.show(); - _tip.css({ - "left": Math.floor(x - _tip.outerWidth() / 2)+"px", - "top": Math.floor(y - _tip.outerHeight())+"px" - }); - this._shown = true; -}; - -IriSP.TooltipWidget.prototype.hide = function() { - this.selector.find(".tip").hide(); - this._shown = false; -};IriSP.TraceWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); - this.lastEvent = ""; - var _this = this, - _listeners = { - "IriSP.createAnnotationWidget.addedAnnotation" : 0, - "IriSP.search.open" : 0, - "IriSP.search.closed" : 0, - "IriSP.search" : 0, - "IriSP.search.cleared" : 0, - "IriSP.search.matchFound" : 0, - "IriSP.search.noMatchFound" : 0, - "IriSP.search.triggeredSearch" : 0, - "IriSP.TraceWidget.MouseEvents" : 0, - "play" : 0, - "pause" : 0, - "volumechange" : 0, - "seeked" : 0, - "play" : 0, - "pause" : 0, - "timeupdate" : 2000 - }; - IriSP._(_listeners).each(function(_ms, _listener) { - var _f = function(_arg) { - _this.eventHandler(_listener, _arg); - } - if (_ms) { - _f = IriSP.underscore.throttle(_f, _ms); - } - _this._Popcorn.listen(_listener, _f); - }); - this._Popcorn.listen("timeupdate", IriSP.underscore.throttle(function(_arg) { - _this.eventHandler(_listener, _arg); - })); - - this.tracer = IriSP.TraceManager(IriSP.jQuery).init_trace("test", this._config); - this.tracer.set_default_subject("default_subject"); - this.tracer.trace("StartTracing", { "hello": "world" }); - -} - -IriSP.TraceWidget.prototype = new IriSP.Widget(); - -IriSP.TraceWidget.prototype.draw = function() { - this.mouseLocation = ''; - var _this = this; - IriSP.jQuery(".Ldt-Widget").bind("click mouseover mouseout dragstart dragstop", function(_e) { - var _widget = IriSP.jQuery(this).attr("widget-type"), - _class = _e.target.className; - var _data = { - "type": _e.type, - "x": _e.clientX, - "y": _e.clientY, - "widget": _widget - } - if (typeof _class == "string" && _class.indexOf('Ldt-TraceMe') != -1) { - var _name = _e.target.localName, - _id = _e.target.id, - _text = _e.target.textContent.trim(), - _title = _e.target.title, - _value = _e.target.value; - _data.target = _name + (_id.length ? '#' + IriSP.jqEscape(_id) : '') + (_class.length ? ('.' + IriSP.jqEscape(_class).replace(/\s/g,'.')).replace(/\.Ldt-(Widget|TraceMe)/g,'') : ''); - if (typeof _title == "string" && _title.length && _title.length < 140) { - _data.title = _title; - } - if (typeof _text == "string" && _text.length && _text.length < 140) { - _data.text = _text; - } - if (typeof _value == "string" && _value.length) { - _data.value = _value; - } - _this._Popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data); - } else { - //console.log(_e.type+','+_this.mouseLocation+','+_widget); - if (_e.type == "mouseover") { - if (_this.mouseLocation != _widget) { - _this._Popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data); - } else { - if (typeof _this.moTimeout != "undefined") { - clearTimeout(_this.moTimeout); - delete _this.moTimeout; - } - } - } - if (_e.type == "click") { - _this._Popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data); - } - if (_e.type == "mouseout") { - if (typeof _this.moTimeout != "undefined") { - clearTimeout(_this.moTimeout); - } - _this.moTimeout = setTimeout(function() { - if (_data.widget != _this.mouseLocation) { - _this._Popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data); - } - },100); - } - } - _this.mouseLocation = _widget; - }); -} - -IriSP.TraceWidget.prototype.eventHandler = function(_listener, _arg) { - var _traceName = 'Mdp_'; - if (typeof _arg == "string" || typeof _arg == "number") { - _arg = { "value" : _arg } - } - if (typeof _arg == "undefined") { - _arg = {} - } - switch(_listener) { - case 'IriSP.TraceWidget.MouseEvents': - _traceName += _arg.widget + '_' + _arg.type; - delete _arg.widget; - delete _arg.type; - break; - case 'timeupdate': - case 'play': - case 'pause': - _arg.time = this._Popcorn.currentTime() * 1000; - case 'seeked': - case 'volumechange': - _traceName += 'Popcorn_' + _listener; - break; - default: - _traceName += _listener.replace('IriSP.','').replace('.','_'); - } - this.lastEvent = _traceName; - this.tracer.trace(_traceName, _arg); - if (this._config.js_console) { - console.log("tracer.trace('" + _traceName + "', " + JSON.stringify(_arg) + ");"); - } -} -/* a widget that displays tweet - used in conjunction with the polemicWidget */ - -IriSP.TweetsWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); - - this._displayingTweet = false; - this._timeoutId = undefined; - this._hidden = false; /* hidden means that the createAnnotationWidget is shown */ -}; - - -IriSP.TweetsWidget.prototype = new IriSP.Widget(); - - -IriSP.TweetsWidget.prototype.drawTweet = function(annotation) { - if (this._hidden) - return; - - var title = IriSP.formatTweet(annotation.content.title); - var img = annotation.content.img.src; - if (typeof(img) === "undefined" || img === "" || img === "None") { - img = this.default_profile_picture; - } - - var imageMarkup = IriSP.templToHTML("user image", - {src : img}); - - if (typeof(IriSP.get_aliased(annotation.meta, ["dc:source", "source"]).content) !== "undefined") { - var tweetContents = JSON.parse(IriSP.get_aliased(annotation.meta, ["dc:source", "source"]).content); - var creator = tweetContents.user.screen_name; - var real_name = tweetContents.user.name; - - imageMarkup = IriSP.templToHTML("user image", - {src : img, creator: creator}); - - var formatted_date = new Date(tweetContents.created_at).toLocaleDateString(); - title = IriSP.templToHTML("@{{creator}} - " + - "
{{real_name}}
" + - "
{{{ contents }}}
" + - "
{{ date }}
", - {creator: creator, real_name: real_name, contents : title, date : formatted_date}); - - this.selector.find(".Ldt-TweetReply").attr("href", "http://twitter.com/home?status=@" + creator + ":%20"); - - - var rtText = Mustache.to_html("http://twitter.com/home?status=RT @{{creator}}: {{text}}", - {creator: creator, text: IriSP.encodeURI(annotation.content.title)}); - this.selector.find(".Ldt-Retweet").attr("href", rtText); - } - - this.selector.find(".Ldt-tweetContents").html(title); - this.selector.find(".Ldt-tweetAvatar").html(imageMarkup); - this.selector.show("blind", 250); -}; - -IriSP.TweetsWidget.prototype.displayTweet = function(annotation) { - if (this._displayingTweet === false) { - this._displayingTweet = true; - } else { - window.clearTimeout(this._timeoutId); - } - - this.drawTweet(annotation); - - var time = this._Popcorn.currentTime(); - this._timeoutId = window.setTimeout(IriSP.wrap(this, this.clearPanel), this.tweet_display_period); -}; - - -IriSP.TweetsWidget.prototype.clearPanel = function() { - this._displayingTweet = false; - this._timeoutId = undefined; - this.closePanel(); - -}; - -IriSP.TweetsWidget.prototype.closePanel = function() { - if (this._timeoutId != undefined) { - /* we're called from the "close window" link */ - /* cancel the timeout */ - window.clearTimeout(this._timeoutId); - this._timeoutId = null; - } - - this.selector.hide("blind", 400); - -}; - -/* cancel the timeout if the user clicks on the keep panel open button */ -IriSP.TweetsWidget.prototype.keepPanel = function() { - if (this._timeoutId != undefined) { - /* we're called from the "close window" link */ - /* cancel the timeout */ - window.clearTimeout(this._timeoutId); - this._timeoutId = null; - } -}; - -IriSP.TweetsWidget.prototype.draw = function() { - var _this = this; - - var tweetMarkup = IriSP.templToHTML(IriSP.tweetWidget_template, {"share_template" : IriSP.share_template}); - this.selector.append(tweetMarkup); - this.selector.hide(); - this.selector.find(".Ldt-tweetWidgetMinimize").click(IriSP.wrap(this, this.closePanel)); - this.selector.find(".Ldt-tweetWidgetKeepOpen").click(IriSP.wrap(this, this.keepPanel)); - - this._Popcorn.listen("IriSP.PolemicTweet.click", IriSP.wrap(this, this.PolemicTweetClickHandler)); - this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked", - IriSP.wrap(this, this.handleAnnotateSignal)); -}; - -IriSP.TweetsWidget.prototype.PolemicTweetClickHandler = function(tweet_id) { - var index, annotation; - for (index in this._serializer._data.annotations) { - annotation = this._serializer._data.annotations[index]; - - if (annotation.id === tweet_id) - break; - } - - if (annotation.id !== tweet_id) - /* we haven't found it */ - return; - - this.displayTweet(annotation); - return; -}; - -/** handle clicks on the annotate button by hiding/showing itself */ -IriSP.TweetsWidget.prototype.handleAnnotateSignal = function() { - if (this._hidden == false) { - this.selector.hide(); - this._hidden = true; - } else { - if (this._displayingTweet !== false) - this.selector.show(); - - - this._hidden = false; - } -};/** @class This class implement a serializer for the JSON-Cinelab format - @params DataLoader a dataloader reference - @url the url from which to get our cinelab - */ -IriSP.JSONSerializer = function(DataLoader, url) { - IriSP.Serializer.call(this, DataLoader, url); -}; - -IriSP.JSONSerializer.prototype = new IriSP.Serializer(); - -/** serialize data */ -IriSP.JSONSerializer.prototype.serialize = function(data) { - return JSON.stringify(data); -}; - -/** deserialize data */ -IriSP.JSONSerializer.prototype.deserialize = function(data) { - return JSON.parse(data); -}; - -/** load JSON-cinelab data and also sort the annotations by start time - @param callback function to call when the data is ready. - */ -IriSP.JSONSerializer.prototype.sync = function(callback, force_refresh) { - /* we don't have to do much because jQuery handles json for us */ - - var self = this; - - var fn = function(data) { - //TODO: seems taht data can be null here - if (data !== null) { - self._data = data; - if (typeof(self._data["annotations"]) === "undefined" || - self._data["annotations"] === null) - self._data["annotations"] = []; - - // sort the data too - self._data["annotations"].sort(function(a, b) - { var a_begin = +a.begin; - var b_begin = +b.begin; - return a_begin - b_begin; - }); - } - callback(data); - }; - this._DataLoader.get(this._url, fn, force_refresh); -}; - -/** @return the metadata about the media being read FIXME: always return the first media. */ -IriSP.JSONSerializer.prototype.currentMedia = function() { - return (typeof this._data.medias == "object" && this._data.medias.length) ? this._data.medias[0] : IriSP.__jsonMetadata.medias[0]; -}; - -IriSP.JSONSerializer.prototype.getDuration = function() { - var _m = this.currentMedia(); - if (_m === null || typeof _m.meta == "undefined") { - return 0; - } - return +(IriSP.get_aliased(_m.meta, ["dc:duration", "duration"]) || 0); -} - - -/** searches for an annotation which matches title, description and keyword - "" matches any field. - Note: it ignores tweets. - @return a list of matching ids. -*/ -IriSP.JSONSerializer.prototype.searchAnnotations = function(title, description, keyword) { - /* we can have many types of annotations. We want search to only look for regular segments */ - /* the next two lines are a bit verbose because for some test data, _serializer.data.view is either - null or undefined. - */ - var view; - - if (typeof(this._data.views) !== "undefined" && this._data.views !== null) - view = this._data.views[0]; - - var searchViewType = ""; - - if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) { - searchViewType = view.annotation_types[0]; - } - - var filterfn = function(annotation) { - if( searchViewType != "" && - typeof(annotation.meta) !== "undefined" && - typeof(annotation.meta["id-ref"]) !== "undefined" && - annotation.meta["id-ref"] !== searchViewType) { - return true; // don't pass - } else { - return false; - } - }; - - return this.searchAnnotationsFilter(title, description, keyword, filterfn); - -}; - -/* only look for tweets */ -IriSP.JSONSerializer.prototype.searchTweets = function(title, description, keyword) { - /* we can have many types of annotations. We want search to only look for regular segments */ - /* the next two lines are a bit verbose because for some test data, _serializer.data.view is either - null or undefined. - */ - - var searchViewType = this.getTweets(); - if (typeof(searchViewType) === "undefined") { - var view; - - if (typeof(this._data.views) !== "undefined" && this._data.views !== null) - view = this._data.views[0]; - - if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) { - searchViewType = view.annotation_types[0]; - } - } - var filterfn = function(annotation) { - if( searchViewType != "" && - typeof(annotation.meta) !== "undefined" && - typeof(annotation.meta["id-ref"]) !== "undefined" && - annotation.meta["id-ref"] === searchViewType) { - return false; // pass - } else { - return true; - } - }; - - return this.searchAnnotationsFilter(title, description, keyword, filterfn); - -}; - -/** - search an annotation according to its title, description and keyword - @param filter a function to filter the results with. Used to select between annotation types. - */ -IriSP.JSONSerializer.prototype.searchAnnotationsFilter = function(title, description, keyword, filter) { - - var rTitle; - var rDescription; - var rKeyword; - /* match anything if given the empty string */ - if (title == "") - title = ".*"; - if (description == "") - description = ".*"; - if (keyword == "") - keyword = ".*"; - - rTitle = new RegExp(title, "i"); - rDescription = new RegExp(description, "i"); - rKeyword = new RegExp(keyword, "i"); - - var ret_array = []; - - var i; - for (i in this._data.annotations) { - var annotation = this._data.annotations[i]; - - /* filter the annotations whose type is not the one we want */ - if (filter(annotation)) { - continue; - } - - if (rTitle.test(annotation.content.title) && - rDescription.test(annotation.content.description)) { - /* FIXME : implement keyword support */ - ret_array.push(annotation); - } - } - - return ret_array; -}; - -/** breaks a string in words and searches each of these words. Returns an array - of objects with the id of the annotation and its number of occurences. - - @param searchString a string of words. - FIXME: optimize ? seems to be n^2 in the worst case. -*/ -IriSP.JSONSerializer.prototype.searchOccurences = function(searchString) { - var ret = { }; - var keywords = searchString.split(/\s+/); - - for (var i in keywords) { - var keyword = keywords[i]; - - // search this keyword in descriptions and title - var found_annotations = [] - found_annotations = found_annotations.concat(this.searchAnnotations(keyword, "", "")); - found_annotations = found_annotations.concat(this.searchAnnotations("", keyword, "")); - - for (var j in found_annotations) { - var current_annotation = found_annotations[j]; - - if (!ret.hasOwnProperty(current_annotation.id)) { - ret[current_annotation.id] = 1; - } else { - ret[current_annotation.id] += 1; - } - - } - - }; - - return ret; -}; - -/** breaks a string in words and searches each of these words. Returns an array - of objects with the id of the annotation and its number of occurences. - - FIXME: optimize ? seems to be n^2 in the worst case. -*/ -IriSP.JSONSerializer.prototype.searchTweetsOccurences = function(searchString) { - var ret = { }; - var keywords = searchString.split(/\s+/); - - for (var i in keywords) { - var keyword = keywords[i]; - - // search this keyword in descriptions and title - var found_annotations = [] - found_annotations = found_annotations.concat(this.searchTweets(keyword, "", "")); - found_annotations = found_annotations.concat(this.searchTweets("", keyword, "")); - - for (var j in found_annotations) { - var current_annotation = found_annotations[j]; - - if (!ret.hasOwnProperty(current_annotation.id)) { - ret[current_annotation.id] = 1; - } else { - ret[current_annotation.id] += 1; - } - - } - - }; - - return ret; -}; - -/** returns all the annotations that are displayable at the moment - NB: only takes account the first type of annotations - ignores tweets - currentTime is in seconds. - - @param currentTime the time at which we search. - @param (optional) the if of the type of the annotations we want to get. - */ - -IriSP.JSONSerializer.prototype.currentAnnotations = function(currentTime, id) { - var view; - var currentTimeMs = 1000 * currentTime; - - if (typeof(id) === "undefined") { - var legal_ids = this.getNonTweetIds(); - } else { - legal_ids = [id]; - } - - var ret_array = []; - - var i; - - for (i in this._data.annotations) { - var annotation = this._data.annotations[i]; - - if (IriSP.underscore.include(legal_ids, annotation.meta["id-ref"]) && - annotation.begin <= currentTimeMs && - annotation.end >= currentTimeMs) - ret_array.push(annotation); - } - - if (ret_array == []) { - console.log("ret_array empty, ", legal_ids); - } - - return ret_array; -}; - -/** return the current chapitre - @param currentTime the current time, in seconds. -*/ -IriSP.JSONSerializer.prototype.currentChapitre = function(currentTime) { - return this.currentAnnotations(currentTime, this.getChapitrage())[0]; -}; - -/** returns a list of ids of tweet lines (aka: groups in cinelab) */ -IriSP.JSONSerializer.prototype.getTweetIds = function() { - if (IriSP.null_or_undefined(this._data.lists) || IriSP.null_or_undefined(this._data.lists) || - IriSP.null_or_undefined(this._data.views) || IriSP.null_or_undefined(this._data.views[0])) - return []; - - - /* Get the displayable types - We've got to jump through a few hoops because the json sometimes defines - fields with underscores and sometimes with dashes - */ - var annotation_types = IriSP.get_aliased(this._data.views[0], ["annotation_types", "annotation-types"]); - if (annotation_types === null) { - console.log("neither view.annotation_types nor view.annotation-types are defined"); - return; - } - - var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]); - if (available_types === null) { - console.log("neither view.annotation_types nor view.annotation-types are defined"); - return; - } - - var potential_types = []; - - // Get the list of types which contain "Tw" in their content - for (var i = 0; i < available_types.length; i++) { - if (/Tw/i.test(IriSP.get_aliased(available_types[i], ['dc:title', 'title']))) { - potential_types.push(available_types[i].id); - } - } - - // Get the intersection of both. - var tweetsId = IriSP.underscore.intersection(annotation_types, potential_types); - - return tweetsId; -}; - -/** this function returns a list of lines which are not tweet lines */ -IriSP.JSONSerializer.prototype.getNonTweetIds = function() { - if (IriSP.null_or_undefined(this._data.lists) || IriSP.null_or_undefined(this._data.lists) || - IriSP.null_or_undefined(this._data.views) || IriSP.null_or_undefined(this._data.views[0])) - return []; - - /* Get the displayable types - We've got to jump through a few hoops because the json sometimes defines - fields with underscores and sometimes with dashes - */ - var annotation_types = IriSP.get_aliased(this._data.views[0], ["annotation_types", "annotation-types"]); - if (annotation_types === null) { - console.log("neither view.annotation_types nor view.annotation-types are defined"); - return; - } - - var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]); - if (available_types === null) { - console.log("neither view.annotation_types nor view.annotation-types are defined"); - return; - } - - var potential_types = []; - - // Get the list of types which do not contain "Tw" in their content - for (var i = 0; i < available_types.length; i++) { - if (!(/Tw/i.test(IriSP.get_aliased(available_types[i], ['dc:title', 'title'])))) { - potential_types.push(available_types[i].id); - } - } - - // Get the intersection of both. - var nonTweetsId = IriSP.underscore.intersection(annotation_types, potential_types); - - return nonTweetsId; - -}; - -/** return the id of the ligne de temps which contains name - @param name of the ligne de temps -*/ -IriSP.JSONSerializer.prototype.getId = function(name) { - var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]); - - if (available_types == null) - return; - - name = name.toUpperCase(); - var e; - e = IriSP.underscore.find(available_types, - function(entry) { - if (IriSP.get_aliased(entry, ['dc:title', 'title']) === null) - return false; - return (entry["dc:title"].toUpperCase().indexOf(name) !== -1); - }); - - if (typeof(e) === "undefined") - return; - - var id = e.id; - - return id; -}; - -/** return the list of id's of the ligne de temps which contains name - @param name of the ligne de temps -*/ -IriSP.JSONSerializer.prototype.getIds = function(name) { - var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]); - - if (available_types == null) - return; - - name = name.toUpperCase(); - var e = []; - e = IriSP.underscore.filter(available_types, - function(entry) { return (IriSP.get_aliased(entry, ['dc:title', 'title']).toUpperCase().indexOf(name) !== -1) }); - return IriSP.underscore.pluck(e, "id"); -}; - -/** return the id of the ligne de temps named "Chapitrage" */ -IriSP.JSONSerializer.prototype.getChapitrage = function() { - var val = this.getId("Chapitrage"); - if (typeof(val) === "undefined") - val = this.getId("Chapter"); - if (typeof(val) === "undefined") - val = this.getId("Chapit"); - if (typeof(val) === "undefined") - val = this.getId("Chap"); - - return val; -}; - -/** return the id of the ligne de temps named "Tweets" */ -IriSP.JSONSerializer.prototype.getTweets = function() { - var val = this.getId("Tweets"); - if (typeof(val) === "undefined") - val = this.getId("Tweet"); - if (typeof(val) === "undefined") - val = this.getId("Twitter"); - if (typeof(val) === "undefined") - val = this.getId("twit"); - if (typeof(val) === "undefined") - val = this.getId("Polemic"); - - return val; -}; - -/** return the id of the ligne de temps named "Contributions" */ -IriSP.JSONSerializer.prototype.getContributions = function() { - var val = this.getId("Contribution"); - if (typeof(val) === "undefined") - val = this.getId("Particip"); - if (typeof(val) === "undefined") - val = this.getId("Contr"); - if (typeof(val) === "undefined") - val = this.getId("Publ"); - - return val; -}; - -/** return the id of the ligne de temps named "Slideshare" */ -IriSP.JSONSerializer.prototype.getSlideShareType = function() { - var val = this.getId("slideshare"); - if (typeof(val) === "undefined") - val = this.getId("Slides"); - if (typeof(val) === "undefined") - val = this.getId("Slide"); - if (typeof(val) === "undefined") - val = this.getId("slide-Share"); - if (typeof(val) === "undefined") - val = this.getId("slide Share"); - - return val; -}; \ No newline at end of file diff -r 8c8fd6a5bba9 -r 638ad584ca27 server/src/remie/static/remie/js/LdtPlayer.min.js --- a/server/src/remie/static/remie/js/LdtPlayer.min.js Fri Sep 18 17:21:49 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,264 +0,0 @@ -/* - * - * Copyright 2010-2012 Institut de recherche et d'innovation - * contributor(s) : Karim Hamidou, Samuel Huron - * - * contact@iri.centrepompidou.fr - * http://www.iri.centrepompidou.fr - * - * This software is a computer program whose purpose is to show and add annotations on a video . - * This software is governed by the CeCILL-C license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL-C - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL-C license and that you accept its terms. -*/ -(function(a){function b(x,F){var I=/^\w+\:\/\//;if(/^\/\/\/?/.test(x))x=location.protocol+x;else if(!I.test(x)&&x.charAt(0)!="/")x=(F||"")+x;return I.test(x)?x:(x.charAt(0)=="/"?L:D)+x}function c(x,F){for(var I in x)if(x.hasOwnProperty(I))F[I]=x[I];return F}function g(x,F,I,N){x.onload=x.onreadystatechange=function(){if(!(x.readyState&&x.readyState!="complete"&&x.readyState!="loaded"||F[I])){x.onload=x.onreadystatechange=null;N()}}}function h(x){x.ready=x.finished=true;for(var F=0;F0){for(var M=0;M=0;){r=d.shift();l=l[r.type].apply(null,r.args)}return l},noConflict:function(){a.$LAB=u;return j},sandbox:function(){return p()}}}var u=a.$LAB,z="UseLocalXHR",n="AlwaysPreserveOrder",s="AllowDuplicates",q="CacheBust",m="Debug",w="BasePath",D=/^[^?#]*\//.exec(location.href)[0],L=/^\w+\:\/\/\/?[^\/]+/.exec(D)[0],J=document.head||document.getElementsByTagName("head"),H=a.opera&&Object.prototype.toString.call(a.opera)== -"[object Opera]"||"MozAppearance"in document.documentElement.style,G=function(){},y=G,C=document.createElement("script"),v=typeof C.preload=="boolean",f=v||C.readyState&&C.readyState=="uninitialized",B=!f&&C.async===true,P=!f&&!B&&!H;if(a.console&&a.console.log){if(!a.console.error)a.console.error=a.console.log;G=function(x){a.console.log(x)};y=function(x,F){a.console.error(x,F)}}a.$LAB=p();(function(x,F,I){if(document.readyState==null&&document[x]){document.readyState="loading";document[x](F,I=function(){document.removeEventListener(F, -I,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this); -var Mustache=function(){function a(n){return String(n).replace(/&(?!\w+;)|[<>"']/g,function(s){return p[s]||s})}var b=Object.prototype.toString;Array.isArray=Array.isArray||function(n){return b.call(n)=="[object Array]"};var c=String.prototype.trim,g;if(c)g=function(n){return n==null?"":c.call(n)};else{var h,k;if(/\S/.test("\u00a0")){h=/^[\s\xA0]+/;k=/[\s\xA0]+$/}else{h=/^\s+/;k=/\s+$/}g=function(n){return n==null?"":n.toString().replace(h,"").replace(k,"")}}var p={"&":"&","<":"<",">":">", -'"':""","'":"'"},u={},z=function(){};z.prototype={otag:"{{",ctag:"}}",pragmas:{},buffer:[],pragmas_implemented:{"IMPLICIT-ITERATOR":true},context:{},render:function(n,s,q,m){if(!m){this.context=s;this.buffer=[]}if(!this.includes("",n))if(m)return n;else{this.send(n);return}n=this.render_pragmas(n);var w=this.render_section(n,s,q);if(w===false)w=this.render_tags(n,s,q,m);if(m)return w;else this.sendLines(w)},send:function(n){n!==""&&this.buffer.push(n)},sendLines:function(n){if(n){n=n.split("\n"); -for(var s=0;s|&|\\{|%)?([^#\\^]+?)\\1?"+y+"+","g")})},L=D(),J=function(G,y,C){switch(y){case "!":return"";case "=":w.set_delimiters(C);L=D();return"";case ">":return w.render_partial(C,s,q);case "{":case "&":return w.find(C,s);default:return a(w.find(C,s))}};n=n.split("\n");for(var H=0;H0;){m=w;w=w[q.shift()]}if(typeof w=="function")return w.apply(m);return w},includes:function(n,s){return s.indexOf(this.otag+n)!=-1},create_context:function(n){if(this.is_object(n))return n;else{var s=".";if(this.pragmas["IMPLICIT-ITERATOR"])s=this.pragmas["IMPLICIT-ITERATOR"].iterator;var q={};q[s]=n;return q}},is_object:function(n){return n&&typeof n=="object"},map:function(n,s){if(typeof n.map=="function")return n.map(s);else{for(var q=[],m=n.length,w=0;w2;d==null&&(d=[]);if(w&&d.reduce===w)return l&&(e=f.bind(e,l)),o?d.reduce(e,j):d.reduce(e);B(d,function(r,A,E){o?j=e.call(l,j,r,A,E):(j=r,o=true)});if(!o)throw new TypeError("Reduce of empty array with no initial value");return j};f.reduceRight=f.foldr=function(d,e,j,l){var o=arguments.length>2;d==null&&(d=[]);if(D&&d.reduceRight===D)return l&&(e=f.bind(e,l)),o?d.reduceRight(e,j):d.reduceRight(e);var r=f.toArray(d).reverse();l&&!o&&(e=f.bind(e,l));return o?f.reduce(r, -e,j,l):f.reduce(r,e)};f.find=f.detect=function(d,e,j){var l;P(d,function(o,r,A){if(e.call(j,o,r,A))return l=o,true});return l};f.filter=f.select=function(d,e,j){var l=[];if(d==null)return l;if(L&&d.filter===L)return d.filter(e,j);B(d,function(o,r,A){e.call(j,o,r,A)&&(l[l.length]=o)});return l};f.reject=function(d,e,j){var l=[];if(d==null)return l;B(d,function(o,r,A){e.call(j,o,r,A)||(l[l.length]=o)});return l};f.every=f.all=function(d,e,j){var l=true;if(d==null)return l;if(J&&d.every===J)return d.every(e, -j);B(d,function(o,r,A){if(!(l=l&&e.call(j,o,r,A)))return g});return l};var P=f.some=f.any=function(d,e,j){e||(e=f.identity);var l=false;if(d==null)return l;if(H&&d.some===H)return d.some(e,j);B(d,function(o,r,A){if(l||(l=e.call(j,o,r,A)))return g});return!!l};f.include=f.contains=function(d,e){var j=false;if(d==null)return j;return G&&d.indexOf===G?d.indexOf(e)!=-1:j=P(d,function(l){return l===e})};f.invoke=function(d,e){var j=p.call(arguments,2);return f.map(d,function(l){return(e.call?e||l:l[e]).apply(l, -j)})};f.pluck=function(d,e){return f.map(d,function(j){return j[e]})};f.max=function(d,e,j){if(!e&&f.isArray(d))return Math.max.apply(Math,d);if(!e&&f.isEmpty(d))return-Infinity;var l={computed:-Infinity};B(d,function(o,r,A){r=e?e.call(j,o,r,A):o;r>=l.computed&&(l={value:o,computed:r})});return l.value};f.min=function(d,e,j){if(!e&&f.isArray(d))return Math.min.apply(Math,d);if(!e&&f.isEmpty(d))return Infinity;var l={computed:Infinity};B(d,function(o,r,A){r=e?e.call(j,o,r,A):o;rA?1:0}),"value")};f.groupBy=function(d,e){var j={},l=f.isFunction(e)?e:function(o){return o[e]};B(d,function(o,r){var A=l(o,r);(j[A]||(j[A]=[])).push(o)});return j};f.sortedIndex= -function(d,e,j){j||(j=f.identity);for(var l=0,o=d.length;l>1;j(d[r])=0})})};f.difference=function(d){var e=f.flatten(p.call(arguments,1));return f.filter(d,function(j){return!f.include(e,j)})};f.zip=function(){for(var d=p.call(arguments),e=f.max(f.pluck(d,"length")),j=Array(e),l=0;l=0;j--)e=[d[j].apply(this,e)];return e[0]}};f.after=function(d, -e){return d<=0?e():function(){if(--d<1)return e.apply(this,arguments)}};f.keys=C||function(d){if(d!==Object(d))throw new TypeError("Invalid object");var e=[],j;for(j in d)s.call(d,j)&&(e[e.length]=j);return e};f.values=function(d){return f.map(d,f.identity)};f.functions=f.methods=function(d){var e=[],j;for(j in d)f.isFunction(d[j])&&e.push(j);return e.sort()};f.extend=function(d){B(p.call(arguments,1),function(e){for(var j in e)e[j]!==void 0&&(d[j]=e[j])});return d};f.defaults=function(d){B(p.call(arguments, -1),function(e){for(var j in e)d[j]==null&&(d[j]=e[j])});return d};f.clone=function(d){return!f.isObject(d)?d:f.isArray(d)?d.slice():f.extend({},d)};f.tap=function(d,e){e(d);return d};f.isEqual=function(d,e){return a(d,e,[])};f.isEmpty=function(d){if(f.isArray(d)||f.isString(d))return d.length===0;for(var e in d)if(s.call(d,e))return false;return true};f.isElement=function(d){return!!(d&&d.nodeType==1)};f.isArray=k||function(d){return n.call(d)=="[object Array]"};f.isObject=function(d){return d=== -Object(d)};f.isArguments=function(d){return n.call(d)=="[object Arguments]"};if(!f.isArguments(arguments))f.isArguments=function(d){return!(!d||!s.call(d,"callee"))};f.isFunction=function(d){return n.call(d)=="[object Function]"};f.isString=function(d){return n.call(d)=="[object String]"};f.isNumber=function(d){return n.call(d)=="[object Number]"};f.isNaN=function(d){return d!==d};f.isBoolean=function(d){return d===true||d===false||n.call(d)=="[object Boolean]"};f.isDate=function(d){return n.call(d)== -"[object Date]"};f.isRegExp=function(d){return n.call(d)=="[object RegExp]"};f.isNull=function(d){return d===null};f.isUndefined=function(d){return d===void 0};f.noConflict=function(){b._=c;return this};f.identity=function(d){return d};f.times=function(d,e,j){for(var l=0;l/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};f.mixin=function(d){B(f.functions(d),function(e){V(e, -f[e]=d[e])})};var F=0;f.uniqueId=function(d){var e=F++;return d?d+e:e};f.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};f.template=function(d,e){var j=f.templateSettings;j="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+d.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(j.escape,function(o,r){return"',_.escape("+r.replace(/\\'/g,"'")+"),'"}).replace(j.interpolate,function(o,r){return"',"+r.replace(/\\'/g, -"'")+",'"}).replace(j.evaluate||null,function(o,r){return"');"+r.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";var l=new Function("obj","_",j);return e?l(e,f):function(o){return l.call(this,o,f)}};var I=function(d){this._wrapped=d};f.prototype=I.prototype;var N=function(d,e){return e?f(d).chain():d},V=function(d,e){I.prototype[d]=function(){var j=p.call(arguments);z.call(j,this._wrapped);return N(e.apply(f, -j),this._chain)}};f.mixin(f);B("pop,push,reverse,shift,sort,splice,unshift".split(","),function(d){var e=h[d];I.prototype[d]=function(){e.apply(this._wrapped,arguments);return N(this._wrapped,this._chain)}});B(["concat","join","slice"],function(d){var e=h[d];I.prototype[d]=function(){return N(e.apply(this._wrapped,arguments),this._chain)}});I.prototype.chain=function(){this._chain=true;return this};I.prototype.value=function(){return this._wrapped}}).call(this); -if(window.IriSP===undefined&&window.__IriSP===undefined)__IriSP=IriSP={};IriSP._=window._.noConflict();IriSP.underscore=IriSP._; -IriSP.loadLibs=function(a,b,c,g){IriSP.jQuery=null;var h=$LAB.script(a.jQuery).script(a.swfObject).wait().script(a.jQueryUI);if(b.player.type==="jwplayer")h=h.script(a.jwplayer);else{h=h.script(a.popcorn).script(a["popcorn.code"]);if(b.player.type==="youtube")h=h.script(a["popcorn.youtube"]);if(b.player.type==="vimeo")h=h.script(a["popcorn.vimeo"])}for(var k in b.gui.widgets){if(b.gui.widgets[k].type==="PolemicWidget"||b.gui.widgets[k].type==="StackGraphWidget")h.script(a.raphael);b.gui.widgets[k].type=== -"SparklineWidget"&&h.script(a.jquery_sparkline)}h.wait(function(){IriSP.jQuery=window.jQuery.noConflict(true);var p=IriSP.jQuery("",{rel:"stylesheet",type:"text/css",href:a.cssjQueryUI,"class":"dynamic_css"}),u=IriSP.jQuery("",{rel:"stylesheet",type:"text/css",href:b.gui.css,"class":"dynamic_css"});p.appendTo("head");u.appendTo("head");IriSP.setupDataLoader();IriSP.__dataloader.get(c,function(z){IriSP.__jsonMetadata=z;g.call(window)})})};IriSP.SparklineWidget_template="
Loading
"; -IriSP.annotation_template="{{! template for an annotation displayed in a segmentWidget }}
";IriSP.annotationWidget_template="{{! template for the annotation widget }}
")&&c[0]);return a>4?a:!1}();return a},m.isInternetExplorer=function(){var a=m.isInternetExplorer.cached=typeof m.isInternetExplorer.cached!="undefined"?m.isInternetExplorer.cached:Boolean(m.getInternetExplorerMajorVersion());return a},m.emulated={pushState:!Boolean(a.history&&a.history.pushState&&a.history.replaceState&&!/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(e.userAgent)&&!/AppleWebKit\/5([0-2]|3[0-2])/i.test(e.userAgent)),hashChange:Boolean(!("onhashchange"in a||"onhashchange"in d)||m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8)},m.enabled=!m.emulated.pushState,m.bugs={setHash:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),safariPoll:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),ieDoubleCheck:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8),hashEscape:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<7)},m.isEmptyObject=function(a){for(var b in a)return!1;return!0},m.cloneObject=function(a){var b,c;return a?(b=k.stringify(a),c=k.parse(b)):c={},c},m.getRootUrl=function(){var a=d.location.protocol+"//"+(d.location.hostname||d.location.host);if(d.location.port||!1)a+=":"+d.location.port;return a+="/",a},m.getBaseHref=function(){var a=d.getElementsByTagName("base"),b=null,c="";return a.length===1&&(b=a[0],c=b.href.replace(/[^\/]+$/,"")),c=c.replace(/\/+$/,""),c&&(c+="/"),c},m.getBaseUrl=function(){var a=m.getBaseHref()||m.getBasePageUrl()||m.getRootUrl();return a},m.getPageUrl=function(){var a=m.getState(!1,!1),b=(a||{}).url||d.location.href,c;return c=b.replace(/\/+$/,"").replace(/[^\/]+$/,function(a,b,c){return/\./.test(a)?a:a+"/"}),c},m.getBasePageUrl=function(){var a=d.location.href.replace(/[#\?].*/,"").replace(/[^\/]+$/,function(a,b,c){return/[^\/]$/.test(a)?"":a}).replace(/\/+$/,"")+"/";return a},m.getFullUrl=function(a,b){var c=a,d=a.substring(0,1);return b=typeof b=="undefined"?!0:b,/[a-z]+\:\/\//.test(a)||(d==="/"?c=m.getRootUrl()+a.replace(/^\/+/,""):d==="#"?c=m.getPageUrl().replace(/#.*/,"")+a:d==="?"?c=m.getPageUrl().replace(/[\?#].*/,"")+a:b?c=m.getBaseUrl()+a.replace(/^(\.\/)+/,""):c=m.getBasePageUrl()+a.replace(/^(\.\/)+/,"")),c.replace(/\#$/,"")},m.getShortUrl=function(a){var b=a,c=m.getBaseUrl(),d=m.getRootUrl();return m.emulated.pushState&&(b=b.replace(c,"")),b=b.replace(d,"/"),m.isTraditionalAnchor(b)&&(b="./"+b),b=b.replace(/^(\.\/)+/g,"./").replace(/\#$/,""),b},m.store={},m.idToState=m.idToState||{},m.stateToId=m.stateToId||{},m.urlToId=m.urlToId||{},m.storedStates=m.storedStates||[],m.savedStates=m.savedStates||[],m.normalizeStore=function(){m.store.idToState=m.store.idToState||{},m.store.urlToId=m.store.urlToId||{},m.store.stateToId=m.store.stateToId||{}},m.getState=function(a,b){typeof a=="undefined"&&(a=!0),typeof b=="undefined"&&(b=!0);var c=m.getLastSavedState();return!c&&b&&(c=m.createStateObject()),a&&(c=m.cloneObject(c),c.url=c.cleanUrl||c.url),c},m.getIdByState=function(a){var b=m.extractId(a.url),c;if(!b){c=m.getStateString(a);if(typeof m.stateToId[c]!="undefined")b=m.stateToId[c];else if(typeof m.store.stateToId[c]!="undefined")b=m.store.stateToId[c];else{for(;;){b=(new Date).getTime()+String(Math.random()).replace(/\D/g,"");if(typeof m.idToState[b]=="undefined"&&typeof m.store.idToState[b]=="undefined")break}m.stateToId[c]=b,m.idToState[b]=a}}return b},m.normalizeState=function(a){var b,c;if(!a||typeof a!="object")a={};if(typeof a.normalized!="undefined")return a;if(!a.data||typeof a.data!="object")a.data={};b={},b.normalized=!0,b.title=a.title||"",b.url=m.getFullUrl(m.unescapeString(a.url||d.location.href)),b.hash=m.getShortUrl(b.url),b.data=m.cloneObject(a.data),b.id=m.getIdByState(b),b.cleanUrl=b.url.replace(/\??\&_suid.*/,""),b.url=b.cleanUrl,c=!m.isEmptyObject(b.data);if(b.title||c)b.hash=m.getShortUrl(b.url).replace(/\??\&_suid.*/,""),/\?/.test(b.hash)||(b.hash+="?"),b.hash+="&_suid="+b.id;return b.hashedUrl=m.getFullUrl(b.hash),(m.emulated.pushState||m.bugs.safariPoll)&&m.hasUrlDuplicate(b)&&(b.url=b.hashedUrl),b},m.createStateObject=function(a,b,c){var d={data:a,title:b,url:c};return d=m.normalizeState(d),d},m.getStateById=function(a){a=String(a);var c=m.idToState[a]||m.store.idToState[a]||b;return c},m.getStateString=function(a){var b,c,d;return b=m.normalizeState(a),c={data:b.data,title:a.title,url:a.url},d=k.stringify(c),d},m.getStateId=function(a){var b,c;return b=m.normalizeState(a),c=b.id,c},m.getHashByState=function(a){var b,c;return b=m.normalizeState(a),c=b.hash,c},m.extractId=function(a){var b,c,d;return c=/(.*)\&_suid=([0-9]+)$/.exec(a),d=c?c[1]||a:a,b=c?String(c[2]||""):"",b||!1},m.isTraditionalAnchor=function(a){var b=!/[\/\?\.]/.test(a);return b},m.extractState=function(a,b){var c=null,d,e;return b=b||!1,d=m.extractId(a),d&&(c=m.getStateById(d)),c||(e=m.getFullUrl(a),d=m.getIdByUrl(e)||!1,d&&(c=m.getStateById(d)),!c&&b&&!m.isTraditionalAnchor(a)&&(c=m.createStateObject(null,null,e))),c},m.getIdByUrl=function(a){var c=m.urlToId[a]||m.store.urlToId[a]||b;return c},m.getLastSavedState=function(){return m.savedStates[m.savedStates.length-1]||b},m.getLastStoredState=function(){return m.storedStates[m.storedStates.length-1]||b},m.hasUrlDuplicate=function(a){var b=!1,c;return c=m.extractState(a.url),b=c&&c.id!==a.id,b},m.storeState=function(a){return m.urlToId[a.url]=a.id,m.storedStates.push(m.cloneObject(a)),a},m.isLastSavedState=function(a){var b=!1,c,d,e;return m.savedStates.length&&(c=a.id,d=m.getLastSavedState(),e=d.id,b=c===e),b},m.saveState=function(a){return m.isLastSavedState(a)?!1:(m.savedStates.push(m.cloneObject(a)),!0)},m.getStateByIndex=function(a){var b=null;return typeof a=="undefined"?b=m.savedStates[m.savedStates.length-1]:a<0?b=m.savedStates[m.savedStates.length+a]:b=m.savedStates[a],b},m.getHash=function(){var a=m.unescapeHash(d.location.hash);return a},m.unescapeString=function(b){var c=b,d;for(;;){d=a.unescape(c);if(d===c)break;c=d}return c},m.unescapeHash=function(a){var b=m.normalizeHash(a);return b=m.unescapeString(b),b},m.normalizeHash=function(a){var b=a.replace(/[^#]*#/,"").replace(/#.*/,"");return b},m.setHash=function(a,b){var c,e,f;return b!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.setHash,args:arguments,queue:b}),!1):(c=m.escapeHash(a),m.busy(!0),e=m.extractState(a,!0),e&&!m.emulated.pushState?m.pushState(e.data,e.title,e.url,!1):d.location.hash!==c&&(m.bugs.setHash?(f=m.getPageUrl(),m.pushState(null,null,f+"#"+c,!1)):d.location.hash=c),m)},m.escapeHash=function(b){var c=m.normalizeHash(b);return c=a.escape(c),m.bugs.hashEscape||(c=c.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?")),c},m.getHashByUrl=function(a){var b=String(a).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");return b=m.unescapeHash(b),b},m.setTitle=function(a){var b=a.title,c;b||(c=m.getStateByIndex(0),c&&c.url===a.url&&(b=c.title||m.options.initialTitle));try{d.getElementsByTagName("title")[0].innerHTML=b.replace("<","<").replace(">",">").replace(" & "," & ")}catch(e){}return d.title=b,m},m.queues=[],m.busy=function(a){typeof a!="undefined"?m.busy.flag=a:typeof m.busy.flag=="undefined"&&(m.busy.flag=!1);if(!m.busy.flag){h(m.busy.timeout);var b=function(){var a,c,d;if(m.busy.flag)return;for(a=m.queues.length-1;a>=0;--a){c=m.queues[a];if(c.length===0)continue;d=c.shift(),m.fireQueueItem(d),m.busy.timeout=g(b,m.options.busyDelay)}};m.busy.timeout=g(b,m.options.busyDelay)}return m.busy.flag},m.busy.flag=!1,m.fireQueueItem=function(a){return a.callback.apply(a.scope||m,a.args||[])},m.pushQueue=function(a){return m.queues[a.queue||0]=m.queues[a.queue||0]||[],m.queues[a.queue||0].push(a),m},m.queue=function(a,b){return typeof a=="function"&&(a={callback:a}),typeof b!="undefined"&&(a.queue=b),m.busy()?m.pushQueue(a):m.fireQueueItem(a),m},m.clearQueue=function(){return m.busy.flag=!1,m.queues=[],m},m.stateChanged=!1,m.doubleChecker=!1,m.doubleCheckComplete=function(){return m.stateChanged=!0,m.doubleCheckClear(),m},m.doubleCheckClear=function(){return m.doubleChecker&&(h(m.doubleChecker),m.doubleChecker=!1),m},m.doubleCheck=function(a){return m.stateChanged=!1,m.doubleCheckClear(),m.bugs.ieDoubleCheck&&(m.doubleChecker=g(function(){return m.doubleCheckClear(),m.stateChanged||a(),!0},m.options.doubleCheckInterval)),m},m.safariStatePoll=function(){var b=m.extractState(d.location.href),c;if(!m.isLastSavedState(b))c=b;else return;return c||(c=m.createStateObject()),m.Adapter.trigger(a,"popstate"),m},m.back=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.back,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.back(!1)}),n.go(-1),!0)},m.forward=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.forward,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.forward(!1)}),n.go(1),!0)},m.go=function(a,b){var c;if(a>0)for(c=1;c<=a;++c)m.forward(b);else{if(!(a<0))throw new Error("History.go: History.go requires a positive or negative integer passed.");for(c=-1;c>=a;--c)m.back(b)}return m};if(m.emulated.pushState){var o=function(){};m.pushState=m.pushState||o,m.replaceState=m.replaceState||o}else m.onPopState=function(b,c){var e=!1,f=!1,g,h;return m.doubleCheckComplete(),g=m.getHash(),g?(h=m.extractState(g||d.location.href,!0),h?m.replaceState(h.data,h.title,h.url,!1):(m.Adapter.trigger(a,"anchorchange"),m.busy(!1)),m.expectedStateId=!1,!1):(e=m.Adapter.extractEventData("state",b,c)||!1,e?f=m.getStateById(e):m.expectedStateId?f=m.getStateById(m.expectedStateId):f=m.extractState(d.location.href),f||(f=m.createStateObject(null,null,d.location.href)),m.expectedStateId=!1,m.isLastSavedState(f)?(m.busy(!1),!1):(m.storeState(f),m.saveState(f),m.setTitle(f),m.Adapter.trigger(a,"statechange"),m.busy(!1),!0))},m.Adapter.bind(a,"popstate",m.onPopState),m.pushState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.pushState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.pushState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0},m.replaceState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.replaceState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.replaceState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0};if(f){try{m.store=k.parse(f.getItem("History.store"))||{}}catch(p){m.store={}}m.normalizeStore()}else m.store={},m.normalizeStore();m.Adapter.bind(a,"beforeunload",m.clearAllIntervals),m.Adapter.bind(a,"unload",m.clearAllIntervals),m.saveState(m.storeState(m.extractState(d.location.href,!0))),f&&(m.onUnload=function(){var a,b;try{a=k.parse(f.getItem("History.store"))||{}}catch(c){a={}}a.idToState=a.idToState||{},a.urlToId=a.urlToId||{},a.stateToId=a.stateToId||{};for(b in m.idToState){if(!m.idToState.hasOwnProperty(b))continue;a.idToState[b]=m.idToState[b]}for(b in m.urlToId){if(!m.urlToId.hasOwnProperty(b))continue;a.urlToId[b]=m.urlToId[b]}for(b in m.stateToId){if(!m.stateToId.hasOwnProperty(b))continue;a.stateToId[b]=m.stateToId[b]}m.store=a,m.normalizeStore(),f.setItem("History.store",k.stringify(a))},m.intervalList.push(i(m.onUnload,m.options.storeInterval)),m.Adapter.bind(a,"beforeunload",m.onUnload),m.Adapter.bind(a,"unload",m.onUnload));if(!m.emulated.pushState){m.bugs.safariPoll&&m.intervalList.push(i(m.safariStatePoll,m.options.safariPollInterval));if(e.vendor==="Apple Computer, Inc."||(e.appCodeName||"")==="Mozilla")m.Adapter.bind(a,"hashchange",function(){m.Adapter.trigger(a,"popstate")}),m.getHash()&&m.Adapter.onDomLoad(function(){m.Adapter.trigger(a,"hashchange")})}},m.init()}(window) \ No newline at end of file diff -r 8c8fd6a5bba9 -r 638ad584ca27 server/src/remie/static/remie/js/jquery.js --- a/server/src/remie/static/remie/js/jquery.js Fri Sep 18 17:21:49 2015 +0200 +++ b/server/src/remie/static/remie/js/jquery.js Fri Sep 18 18:01:36 2015 +0200 @@ -1,81 +1,84 @@ /*! - * jQuery JavaScript Library v2.0.3 + * jQuery JavaScript Library v2.1.4 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * - * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors + * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * - * Date: 2013-07-03T13:30Z + * Date: 2015-04-28T16:01Z */ -(function( window, undefined ) { - -// Can't do this because several apps including ASP.NET trace + +(function( global, factory ) { + + if ( typeof module === "object" && typeof module.exports === "object" ) { + // For CommonJS and CommonJS-like environments where a proper `window` + // is present, execute the factory and get jQuery. + // For environments that do not have a `window` with a `document` + // (such as Node.js), expose a factory as module.exports. + // This accentuates the need for the creation of a real `window`. + // e.g. var jQuery = require("jquery")(window); + // See ticket #14549 for more info. + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } + +// Pass this if window is not defined yet +}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Support: Firefox 18+ +// Can't be in strict mode, several libs including ASP.NET trace // the stack via arguments.caller.callee and Firefox dies if // you try to trace through "use strict" call chains. (#13335) -// Support: Firefox 18+ -//"use strict"; +// + +var arr = []; + +var slice = arr.slice; + +var concat = arr.concat; + +var push = arr.push; + +var indexOf = arr.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; + +var support = {}; + + + var - // A central reference to the root jQuery(document) - rootjQuery, - - // The deferred used on DOM ready - readyList, - - // Support: IE9 - // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined` - core_strundefined = typeof undefined, - // Use the correct document accordingly with window argument (sandbox) - location = window.location, document = window.document, - docElem = document.documentElement, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // [[Class]] -> type pairs - class2type = {}, - - // List of deleted data cache ids, so we can reuse them - core_deletedIds = [], - - core_version = "2.0.3", - - // Save a reference to some core methods - core_concat = core_deletedIds.concat, - core_push = core_deletedIds.push, - core_slice = core_deletedIds.slice, - core_indexOf = core_deletedIds.indexOf, - core_toString = class2type.toString, - core_hasOwn = class2type.hasOwnProperty, - core_trim = core_version.trim, + + version = "2.1.4", // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Used for matching numbers - core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, - - // Used for splitting on whitespace - core_rnotwhite = /\S+/g, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }, + + // Support: Android<4.1 + // Make sure we trim BOM and NBSP + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, @@ -84,114 +87,13 @@ // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return letter.toUpperCase(); - }, - - // The ready event handler and self cleanup method - completed = function() { - document.removeEventListener( "DOMContentLoaded", completed, false ); - window.removeEventListener( "load", completed, false ); - jQuery.ready(); }; jQuery.fn = jQuery.prototype = { // The current version of jQuery being used - jquery: core_version, + jquery: version, constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - - // scripts is true for back-compat - jQuery.merge( this, jQuery.parseHTML( - match[1], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - // Properties of context are called as methods if possible - if ( jQuery.isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, // Start with an empty selector selector: "", @@ -200,19 +102,19 @@ length: 0, toArray: function() { - return core_slice.call( this ); + return slice.call( this ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); + return num != null ? + + // Return just the one element from the set + ( num < 0 ? this[ num + this.length ] : this[ num ] ) : + + // Return all the elements in a clean array + slice.call( this ); }, // Take an array of elements and push it onto the stack @@ -237,15 +139,14 @@ return jQuery.each( this, callback, args ); }, - ready: function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); }, slice: function() { - return this.pushStack( core_slice.apply( this, arguments ) ); + return this.pushStack( slice.apply( this, arguments ) ); }, first: function() { @@ -262,26 +163,17 @@ return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); }, - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - end: function() { return this.prevObject || this.constructor(null); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. - push: core_push, - sort: [].sort, - splice: [].splice + push: push, + sort: arr.sort, + splice: arr.splice }; -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - jQuery.extend = jQuery.fn.extend = function() { var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, @@ -292,9 +184,10 @@ // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; + + // Skip the boolean and the target + target = arguments[ i ] || {}; + i++; } // Handle case when target is a string or something (possible in deep copy) @@ -302,10 +195,10 @@ target = {}; } - // extend jQuery itself if only one argument is passed - if ( length === i ) { + // Extend jQuery itself if only one argument is passed + if ( i === length ) { target = this; - --i; + i--; } for ( ; i < length; i++ ) { @@ -348,64 +241,17 @@ jQuery.extend({ // Unique for each copy of jQuery on the page - expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), - - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger("ready").off("ready"); - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + isFunction: function( obj ) { return jQuery.type(obj) === "function"; }, @@ -417,17 +263,11 @@ }, isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - if ( obj == null ) { - return String( obj ); - } - // Support: Safari <= 5.1 (functionish RegExp) - return typeof obj === "object" || typeof obj === "function" ? - class2type[ core_toString.call(obj) ] || "object" : - typeof obj; + // parseFloat NaNs numeric-cast false positives (null|true|false|"") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + // adding 1 corrects loss of precision from parseFloat (#15100) + return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0; }, isPlainObject: function( obj ) { @@ -439,16 +279,8 @@ return false; } - // Support: Firefox <20 - // The try/catch suppresses exceptions thrown when attempting to access - // the "constructor" property of certain host objects, ie. |window.location| - // https://bugzilla.mozilla.org/show_bug.cgi?id=814622 - try { - if ( obj.constructor && - !core_hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { - return false; - } - } catch ( e ) { + if ( obj.constructor && + !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { return false; } @@ -465,69 +297,20 @@ return true; }, - error: function( msg ) { - throw new Error( msg ); - }, - - // data: string of html - // context (optional): If specified, the fragment will be created in this context, defaults to document - // keepScripts (optional): If true, will include scripts passed in the html string - parseHTML: function( data, context, keepScripts ) { - if ( !data || typeof data !== "string" ) { - return null; - } - if ( typeof context === "boolean" ) { - keepScripts = context; - context = false; - } - context = context || document; - - var parsed = rsingleTag.exec( data ), - scripts = !keepScripts && []; - - // Single tag - if ( parsed ) { - return [ context.createElement( parsed[1] ) ]; - } - - parsed = jQuery.buildFragment( [ data ], context, scripts ); - - if ( scripts ) { - jQuery( scripts ).remove(); - } - - return jQuery.merge( [], parsed.childNodes ); - }, - - parseJSON: JSON.parse, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - if ( !data || typeof data !== "string" ) { - return null; - } - - // Support: IE9 - try { - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } catch ( e ) { - xml = undefined; - } - - if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, + type: function( obj ) { + if ( obj == null ) { + return obj + ""; + } + // Support: Android<4.0, iOS<6 (functionish RegExp) + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call(obj) ] || "object" : + typeof obj; + }, // Evaluates a script in a global context globalEval: function( code ) { var script, - indirect = eval; + indirect = eval; code = jQuery.trim( code ); @@ -548,6 +331,7 @@ }, // Convert dashed to camelCase; used by the css and data modules + // Support: IE9-11+ // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); @@ -607,8 +391,11 @@ return obj; }, + // Support: Android<4.1 trim: function( text ) { - return text == null ? "" : core_trim.call( text ); + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only @@ -622,7 +409,7 @@ [ arr ] : arr ); } else { - core_push.call( ret, arr ); + push.call( ret, arr ); } } @@ -630,22 +417,16 @@ }, inArray: function( elem, arr, i ) { - return arr == null ? -1 : core_indexOf.call( arr, elem, i ); + return arr == null ? -1 : indexOf.call( arr, elem, i ); }, merge: function( first, second ) { - var l = second.length, - i = first.length, - j = 0; - - if ( typeof l === "number" ) { - for ( ; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } + var len = +second.length, + j = 0, + i = first.length; + + for ( ; j < len; j++ ) { + first[ i++ ] = second[ j ]; } first.length = i; @@ -653,23 +434,23 @@ return first; }, - grep: function( elems, callback, inv ) { - var retVal, - ret = [], + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], i = 0, - length = elems.length; - inv = !!inv; + length = elems.length, + callbackExpect = !invert; // Go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; }, // arg is for internal usage only @@ -680,13 +461,13 @@ isArray = isArraylike( elems ), ret = []; - // Go through the array, translating each of the items to their + // Go through the array, translating each of the items to their new values if ( isArray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { - ret[ ret.length ] = value; + ret.push( value ); } } @@ -696,13 +477,13 @@ value = callback( elems[ i ], i, arg ); if ( value != null ) { - ret[ ret.length ] = value; + ret.push( value ); } } } // Flatten any nested arrays - return core_concat.apply( [], ret ); + return concat.apply( [], ret ); }, // A global GUID counter for objects @@ -726,9 +507,9 @@ } // Simulated bind - args = core_slice.call( arguments, 2 ); + args = slice.call( arguments, 2 ); proxy = function() { - return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed @@ -737,119 +518,28 @@ return proxy; }, - // Multifunctional method to get and set values of a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - length = elems.length, - bulk = key == null; - - // Sets many values - if ( jQuery.type( key ) === "object" ) { - chainable = true; - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !jQuery.isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < length; i++ ) { - fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); - } - } - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - now: Date.now, - // A method for quickly swapping in/out CSS properties to get correct calculations. - // Note: this method belongs to the css module but it's needed here for the support module. - // If support gets modularized, this method should be moved back to the css module. - swap: function( elem, options, callback, args ) { - var ret, name, - old = {}; - - // 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; - } + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support }); -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { - - readyList = jQuery.Deferred(); - - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready ); - - } else { - - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed, false ); - } - } - return readyList.promise( obj ); -}; - // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); function isArraylike( obj ) { - var length = obj.length, + + // Support: iOS 8.2 (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = "length" in obj && obj.length, type = jQuery.type( obj ); - if ( jQuery.isWindow( obj ) ) { + if ( type === "function" || jQuery.isWindow( obj ) ) { return false; } @@ -857,34 +547,33 @@ return true; } - return type === "array" || type !== "function" && - ( length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj ); + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; } - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); +var Sizzle = /*! - * Sizzle CSS Selector Engine v1.9.4-pre + * Sizzle CSS Selector Engine v2.2.0-pre * http://sizzlejs.com/ * - * Copyright 2013 jQuery Foundation, Inc. and other contributors + * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * - * Date: 2013-06-03 + * Date: 2014-12-16 */ -(function( window, undefined ) { +(function( window ) { var i, support, - cachedruns, Expr, getText, isXML, + tokenize, compile, + select, outermostContext, sortInput, + hasDuplicate, // Local document vars setDocument, @@ -897,24 +586,21 @@ contains, // Instance-specific data - expando = "sizzle" + -(new Date()), + expando = "sizzle" + 1 * new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), - hasDuplicate = false, sortOrder = function( a, b ) { if ( a === b ) { hasDuplicate = true; - return 0; } return 0; }, // General-purpose constants - strundefined = typeof undefined, MAX_NEGATIVE = 1 << 31, // Instance methods @@ -924,12 +610,13 @@ push_native = arr.push, push = arr.push, slice = arr.slice, - // Use a stripped-down indexOf if we can't use a native one - indexOf = arr.indexOf || function( elem ) { + // Use a stripped-down indexOf as it's faster than native + // http://jsperf.com/thor-indexof-vs-for/5 + indexOf = function( list, elem ) { var i = 0, - len = this.length; + len = list.length; for ( ; i < len; i++ ) { - if ( this[i] === elem ) { + if ( list[i] === elem ) { return i; } } @@ -950,26 +637,32 @@ // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = characterEncoding.replace( "w", "w#" ), - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - - // Prefer arguments quoted, - // then not containing pseudos/brackets, - // then attribute selectors/non-parenthetical expressions, - // then anything else - // These preferences are here to reduce the number of selectors - // needing tokenize in the PSEUDO preFilter - pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + + "*\\]", + + pseudos = ":(" + characterEncoding + ")(?:\\((" + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rwhitespace = new RegExp( whitespace + "+", "g" ), rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), - rsibling = new RegExp( whitespace + "*[+~]" ), - rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ), + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), rpseudo = new RegExp( pseudos ), ridentifier = new RegExp( "^" + identifier + "$" ), @@ -990,14 +683,15 @@ whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + rnative = /^[^{]+\{\s*\[native \w/, // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - + rsibling = /[+~]/, rescape = /'|\\/g, // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters @@ -1005,15 +699,23 @@ funescape = function( _, escaped, escapedWhitespace ) { var high = "0x" + escaped - 0x10000; // NaN means non-codepoint - // Support: Firefox + // Support: Firefox<24 // Workaround erroneous numeric interpretation of +"0x" return high !== high || escapedWhitespace ? escaped : - // BMP codepoint high < 0 ? + // BMP codepoint String.fromCharCode( high + 0x10000 ) : // Supplemental Plane codepoint (surrogate pair) String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }, + + // Used for iframes + // See setDocument() + // Removing the function wrapper causes a "Permission Denied" + // error in IE + unloadHandler = function() { + setDocument(); }; // Optimize for push.apply( _, NodeList ) @@ -1056,25 +758,24 @@ context = context || document; results = results || []; - - if ( !selector || typeof selector !== "string" ) { + nodeType = context.nodeType; + + if ( typeof selector !== "string" || !selector || + nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { + return results; } - if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { - return []; - } - - if ( documentIsHTML && !seed ) { - - // Shortcuts - if ( (match = rquickExpr.exec( selector )) ) { + if ( !seed && documentIsHTML ) { + + // Try to shortcut find operations when possible (e.g., not under DocumentFragment) + if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { // Speed-up: Sizzle("#ID") if ( (m = match[1]) ) { if ( nodeType === 9 ) { elem = context.getElementById( m ); // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 + // nodes that are no longer in the document (jQuery #6963) if ( elem && elem.parentNode ) { // Handle the case where IE, Opera, and Webkit return items // by name instead of ID @@ -1100,7 +801,7 @@ return results; // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { + } else if ( (m = match[3]) && support.getElementsByClassName ) { push.apply( results, context.getElementsByClassName( m ) ); return results; } @@ -1110,7 +811,7 @@ if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { nid = old = expando; newContext = context; - newSelector = nodeType === 9 && selector; + newSelector = nodeType !== 1 && selector; // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root @@ -1130,7 +831,7 @@ while ( i-- ) { groups[i] = nid + toSelector( groups[i] ); } - newContext = rsibling.test( selector ) && context.parentNode || context; + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; newSelector = groups.join(","); } @@ -1165,11 +866,11 @@ function cache( key, value ) { // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key += " " ) > Expr.cacheLength ) { + if ( keys.push( key + " " ) > Expr.cacheLength ) { // Only keep the most recent entries delete cache[ keys.shift() ]; } - return (cache[ key ] = value); + return (cache[ key + " " ] = value); } return cache; } @@ -1292,8 +993,21 @@ } /** - * Detect xml + * Checks a node for validity as a Sizzle context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */ +function testContext( context ) { + return context && typeof context.getElementsByTagName !== "undefined" && context; +} + +// Expose support vars for convenience +support = Sizzle.support = {}; + +/** + * Detects XML nodes * @param {Element|Object} elem An element or a document + * @returns {Boolean} True iff elem is a non-HTML XML node */ isXML = Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist @@ -1302,17 +1016,14 @@ return documentElement ? documentElement.nodeName !== "HTML" : false; }; -// Expose support vars for convenience -support = Sizzle.support = {}; - /** * Sets document-related variables once based on the current document * @param {Element|Object} [doc] An element or document object to use to set the document * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { - var doc = node ? node.ownerDocument || node : preferredDoc, - parent = doc.defaultView; + var hasCompare, parent, + doc = node ? node.ownerDocument || node : preferredDoc; // If no document and documentElement is available, return if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { @@ -1322,25 +1033,31 @@ // Set our document document = doc; docElem = doc.documentElement; - - // Support tests - documentIsHTML = !isXML( doc ); + parent = doc.defaultView; // Support: IE>8 // If iframe document is assigned to "document" variable and if iframe has been reloaded, // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 // IE6-8 do not support the defaultView property so parent will be undefined - if ( parent && parent.attachEvent && parent !== parent.top ) { - parent.attachEvent( "onbeforeunload", function() { - setDocument(); - }); - } + if ( parent && parent !== parent.top ) { + // IE11 does not have attachEvent, so all must suffer + if ( parent.addEventListener ) { + parent.addEventListener( "unload", unloadHandler, false ); + } else if ( parent.attachEvent ) { + parent.attachEvent( "onunload", unloadHandler ); + } + } + + /* Support tests + ---------------------------------------------------------------------- */ + documentIsHTML = !isXML( doc ); /* Attributes ---------------------------------------------------------------------- */ // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) + // Verify that getAttribute really returns attributes and not properties + // (excepting IE8 booleans) support.attributes = assert(function( div ) { div.className = "i"; return !div.getAttribute("className"); @@ -1355,17 +1072,8 @@ return !div.getElementsByTagName("*").length; }); - // Check if getElementsByClassName can be trusted - support.getElementsByClassName = assert(function( div ) { - div.innerHTML = "
"; - - // Support: Safari<4 - // Catch class over-caching - div.firstChild.className = "i"; - // Support: Opera<10 - // Catch gEBCN failure to find non-leading classes - return div.getElementsByClassName("i").length === 2; - }); + // Support: IE<9 + support.getElementsByClassName = rnative.test( doc.getElementsByClassName ); // Support: IE<10 // Check if getElementById returns elements by name @@ -1379,11 +1087,11 @@ // ID find and filter if ( support.getById ) { Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && documentIsHTML ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { var m = context.getElementById( id ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; + return m && m.parentNode ? [ m ] : []; } }; Expr.filter["ID"] = function( id ) { @@ -1400,7 +1108,7 @@ Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); return node && node.value === attrId; }; }; @@ -1409,14 +1117,20 @@ // Tag Expr.find["TAG"] = support.getElementsByTagName ? function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { return context.getElementsByTagName( tag ); + + // DocumentFragment nodes don't have gEBTN + } else if ( support.qsa ) { + return context.querySelectorAll( tag ); } } : + function( tag, context ) { var elem, tmp = [], i = 0, + // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too results = context.getElementsByTagName( tag ); // Filter out possible comments @@ -1434,7 +1148,7 @@ // Class Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { + if ( documentIsHTML ) { return context.getElementsByClassName( className ); } }; @@ -1463,7 +1177,17 @@ // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 - div.innerHTML = ""; + docElem.appendChild( div ).innerHTML = "" + + ""; + + // Support: IE8, Opera 11-12.16 + // Nothing should be selected when empty strings follow ^= or $= or *= + // The test attribute must be unknown in Opera but "safe" for WinRT + // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( div.querySelectorAll("[msallowcapture^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + } // Support: IE8 // Boolean attributes and "value" are not treated correctly @@ -1471,27 +1195,37 @@ rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); } + // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+ + if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { + rbuggyQSA.push("~="); + } + // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } + + // Support: Safari 8+, iOS 8+ + // https://bugs.webkit.org/show_bug.cgi?id=136851 + // In-page `selector#id sibing-combinator selector` fails + if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { + rbuggyQSA.push(".#.+[+~]"); + } }); assert(function( div ) { - - // Support: Opera 10-12/IE8 - // ^= $= *= and empty values - // Should not select anything // Support: Windows 8 Native Apps - // The type attribute is restricted during .innerHTML assignment + // The type and name attributes are restricted during .innerHTML assignment var input = doc.createElement("input"); input.setAttribute( "type", "hidden" ); - div.appendChild( input ).setAttribute( "t", "" ); - - if ( div.querySelectorAll("[t^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + div.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE8 + // Enforce case-sensitivity of name attribute + if ( div.querySelectorAll("[name=d]").length ) { + rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) @@ -1506,7 +1240,8 @@ }); } - if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || + if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || + docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { @@ -1528,11 +1263,12 @@ /* Contains ---------------------------------------------------------------------- */ + hasCompare = rnative.test( docElem.compareDocumentPosition ); // Element contains another // Purposefully does not implement inclusive descendent // As in, an element does not contain itself - contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ? + contains = hasCompare || rnative.test( docElem.contains ) ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; @@ -1557,7 +1293,7 @@ ---------------------------------------------------------------------- */ // Document order sorting - sortOrder = docElem.compareDocumentPosition ? + sortOrder = hasCompare ? function( a, b ) { // Flag for duplicate removal @@ -1566,34 +1302,46 @@ return 0; } - var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b ); - + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; if ( compare ) { - // Disconnected nodes - if ( compare & 1 || - (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { - - // Choose the first element that is related to our preferred document - if ( a === doc || contains(preferredDoc, a) ) { - return -1; - } - if ( b === doc || contains(preferredDoc, b) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } - - // Not directly comparable, sort on existence of method - return a.compareDocumentPosition ? -1 : 1; + return compare; + } + + // Calculate position if both inputs belong to the same document + compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : + + // Otherwise we know they are disconnected + 1; + + // Disconnected nodes + if ( compare & 1 || + (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { + + // Choose the first element that is related to our preferred document + if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { + return -1; + } + if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; } : function( a, b ) { + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + } + var cur, i = 0, aup = a.parentNode, @@ -1601,19 +1349,14 @@ ap = [ a ], bp = [ b ]; - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - // Parentless nodes are either documents or disconnected - } else if ( !aup || !bup ) { + if ( !aup || !bup ) { return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 0; // If the nodes are siblings, we can do a quick check @@ -1676,10 +1419,10 @@ elem.document && elem.document.nodeType !== 11 ) { return ret; } - } catch(e) {} - } - - return Sizzle( expr, document, null, [elem] ).length > 0; + } catch (e) {} + } + + return Sizzle( expr, document, null, [ elem ] ).length > 0; }; Sizzle.contains = function( context, elem ) { @@ -1702,13 +1445,13 @@ fn( elem, name, !documentIsHTML ) : undefined; - return val === undefined ? + return val !== undefined ? + val : support.attributes || !documentIsHTML ? elem.getAttribute( name ) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : - null : - val; + null; }; Sizzle.error = function( msg ) { @@ -1741,6 +1484,10 @@ } } + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + return results; }; @@ -1756,13 +1503,13 @@ if ( !nodeType ) { // If no nodeType, this is expected to be an array - for ( ; (node = elem[i]); i++ ) { + while ( (node = elem[i++]) ) { // Do not traverse comment nodes ret += getText( node ); } } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements - // innerText usage removed for consistency of new lines (see #11153) + // innerText usage removed for consistency of new lines (jQuery #11153) if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { @@ -1804,7 +1551,7 @@ match[1] = match[1].replace( runescape, funescape ); // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); + match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; @@ -1847,15 +1594,15 @@ "PSEUDO": function( match ) { var excess, - unquoted = !match[5] && match[2]; + unquoted = !match[6] && match[2]; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } // Accept quoted arguments as-is - if ( match[3] && match[4] !== undefined ) { - match[2] = match[4]; + if ( match[3] ) { + match[2] = match[4] || match[5] || ""; // Strip excess characters from unquoted arguments } else if ( unquoted && rpseudo.test( unquoted ) && @@ -1891,7 +1638,7 @@ return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { - return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); + return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); }); }, @@ -1913,7 +1660,7 @@ operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : false; }; @@ -2033,7 +1780,7 @@ matched = fn( seed, argument ), i = matched.length; while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); + idx = indexOf( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : @@ -2072,6 +1819,8 @@ function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); + // Don't keep the element (issue #299) + input[0] = null; return !results.pop(); }; }), @@ -2083,6 +1832,7 @@ }), "contains": markFunction(function( text ) { + text = text.replace( runescape, funescape ); return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; @@ -2159,12 +1909,11 @@ // Contents "empty": function( elem ) { // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), - // not comment, processing instructions, or others - // Thanks to Diego Perini for the nodeName shortcut - // Greater than "@" means alpha characters (specifically not starting with "#" or "?") + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { + if ( elem.nodeType < 6 ) { return false; } } @@ -2191,11 +1940,12 @@ "text": function( elem ) { var attr; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); + + // Support: IE<8 + // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); }, // Position-in-collection @@ -2260,7 +2010,7 @@ setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); -function tokenize( selector, parseOnly ) { +tokenize = Sizzle.tokenize = function( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; @@ -2281,7 +2031,7 @@ // Don't consume trailing commas as valid soFar = soFar.slice( match[0].length ) || soFar; } - groups.push( tokens = [] ); + groups.push( (tokens = []) ); } matched = false; @@ -2325,7 +2075,7 @@ Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); -} +}; function toSelector( tokens ) { var i = 0, @@ -2354,8 +2104,8 @@ // Check against all ancestor/preceding elements function( elem, context, xml ) { - var data, cache, outerCache, - dirkey = dirruns + " " + doneName; + var oldCache, outerCache, + newCache = [ dirruns, doneName ]; // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching if ( xml ) { @@ -2370,14 +2120,17 @@ while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { outerCache = elem[ expando ] || (elem[ expando ] = {}); - if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { - if ( (data = cache[1]) === true || data === cachedruns ) { - return data === true; - } + if ( (oldCache = outerCache[ dir ]) && + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { + + // Assign to newCache so results back-propagate to previous elements + return (newCache[ 2 ] = oldCache[ 2 ]); } else { - cache = outerCache[ dir ] = [ dirkey ]; - cache[1] = matcher( elem, context, xml ) || cachedruns; - if ( cache[1] === true ) { + // Reuse newcache so results back-propagate to previous elements + outerCache[ dir ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { return true; } } @@ -2401,6 +2154,15 @@ matchers[0]; } +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], @@ -2492,7 +2254,7 @@ i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } @@ -2527,13 +2289,16 @@ return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; + return indexOf( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); + // Avoid hanging onto element (issue #299) + checkContext = null; + return ret; } ]; for ( ; i < len; i++ ) { @@ -2571,31 +2336,30 @@ } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - // A counter to specify which element is currently being matched - var matcherCachedRuns = 0, - bySet = setMatchers.length > 0, + var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, expandContext ) { + superMatcher = function( seed, context, xml, results, outermost ) { var elem, j, matcher, - setMatched = [], matchedCount = 0, i = "0", unmatched = seed && [], - outermost = expandContext != null, + setMatched = [], contextBackup = outermostContext, - // We must always have either seed elements or context - elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), + // We must always have either seed elements or outermost context + elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), + len = elems.length; if ( outermost ) { outermostContext = context !== document && context; - cachedruns = matcherCachedRuns; } // Add elements passing elementMatchers directly to results // Keep `i` a string if there are no elements so `matchedCount` will be "00" below - for ( ; (elem = elems[i]) != null; i++ ) { + // Support: IE<9, Safari + // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id + for ( ; i !== len && (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { j = 0; while ( (matcher = elementMatchers[j++]) ) { @@ -2606,7 +2370,6 @@ } if ( outermost ) { dirruns = dirrunsUnique; - cachedruns = ++matcherCachedRuns; } } @@ -2671,7 +2434,7 @@ superMatcher; } -compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { +compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], @@ -2679,12 +2442,12 @@ if ( !cached ) { // Generate a function of recursive functions that can be used to check each element - if ( !group ) { - group = tokenize( selector ); - } - i = group.length; + if ( !match ) { + match = tokenize( selector ); + } + i = match.length; while ( i-- ) { - cached = matcherFromTokens( group[i] ); + cached = matcherFromTokens( match[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { @@ -2694,91 +2457,100 @@ // Cache the compiled function cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + + // Save selector and tokenization + cached.selector = selector; } return cached; }; -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function select( selector, context, results, seed ) { +/** + * A low-level selection function that works with Sizzle's compiled + * selector functions + * @param {String|Function} selector A selector or a pre-compiled + * selector function built with Sizzle.compile + * @param {Element} context + * @param {Array} [results] + * @param {Array} [seed] A set of elements to match against + */ +select = Sizzle.select = function( selector, context, results, seed ) { var i, tokens, token, type, find, - match = tokenize( selector ); - - if ( !seed ) { - // Try to minimize operations if there is only one group - if ( match.length === 1 ) { - - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - support.getById && context.nodeType === 9 && documentIsHTML && - Expr.relative[ tokens[1].type ] ) { - - context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; - if ( !context ) { - return results; - } - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { + compiled = typeof selector === "function" && selector, + match = !seed && tokenize( (selector = compiled.selector || selector) ); + + results = results || []; + + // Try to minimize operations if there is no seed and only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + support.getById && context.nodeType === 9 && documentIsHTML && + Expr.relative[ tokens[1].type ] ) { + + context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; + if ( !context ) { + return results; + + // Precompiled matchers will still verify ancestry, so step up a level + } else if ( compiled ) { + context = context.parentNode; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + break; } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && context.parentNode || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - } - - // Compile and execute a filtering function + } + } + } + + // Compile and execute a filtering function if one is not provided // Provide `match` to avoid retokenization if we modified the selector above - compile( selector, match )( + ( compiled || compile( selector, match ) )( seed, context, !documentIsHTML, results, - rsibling.test( selector ) + rsibling.test( selector ) && testContext( context.parentNode ) || context ); return results; -} +}; // One-time assignments // Sort stability support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; -// Support: Chrome<14 +// Support: Chrome 14-35+ // Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = hasDuplicate; +support.detectDuplicates = !!hasDuplicate; // Initialize against the default document setDocument(); @@ -2826,13 +2598,20 @@ addHandle( booleans, function( elem, name, isXML ) { var val; if ( !isXML ) { - return (val = elem.getAttributeNode( name )) && val.specified ? - val.value : - elem[ name ] === true ? name.toLowerCase() : null; + return elem[ name ] === true ? name.toLowerCase() : + (val = elem.getAttributeNode( name )) && val.specified ? + val.value : + null; } }); } +return Sizzle; + +})( window ); + + + jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.pseudos; @@ -2842,14 +2621,421 @@ jQuery.contains = Sizzle.contains; -})( window ); + +var rneedsContext = jQuery.expr.match.needsContext; + +var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); + + + +var risSimple = /^.[^:#\[\.,]*$/; + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, not ) { + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep( elements, function( elem, i ) { + /* jshint -W018 */ + return !!qualifier.call( elem, i, elem ) !== not; + }); + + } + + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + }); + + } + + if ( typeof qualifier === "string" ) { + if ( risSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + + qualifier = jQuery.filter( qualifier, elements ); + } + + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) >= 0 ) !== not; + }); +} + +jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 && elem.nodeType === 1 ? + jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : + jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + })); +}; + +jQuery.fn.extend({ + find: function( selector ) { + var i, + len = this.length, + ret = [], + self = this; + + if ( typeof selector !== "string" ) { + return this.pushStack( jQuery( selector ).filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }) ); + } + + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + // Needed because $( selector, context ) becomes $( context ).find( selector ) + ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); + ret.selector = this.selector ? this.selector + " " + selector : selector; + return ret; + }, + filter: function( selector ) { + return this.pushStack( winnow(this, selector || [], false) ); + }, + not: function( selector ) { + return this.pushStack( winnow(this, selector || [], true) ); + }, + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + } +}); + + +// Initialize a jQuery object + + +// A central reference to the root jQuery(document) +var rootjQuery, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, + + init = jQuery.fn.init = function( selector, context ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + + // Option to run scripts is true for back-compat + // Intentionally let the error be thrown if parseHTML is not present + jQuery.merge( this, jQuery.parseHTML( + match[1], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Support: Blackberry 4.6 + // gEBID returns nodes no longer in the document (#6963) + if ( elem && elem.parentNode ) { + // Inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return typeof rootjQuery.ready !== "undefined" ? + rootjQuery.ready( selector ) : + // Execute immediately if ready is not present + selector( jQuery ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }; + +// Give the init function the jQuery prototype for later instantiation +init.prototype = jQuery.fn; + +// Initialize central reference +rootjQuery = jQuery( document ); + + +var rparentsprev = /^(?:parents|prev(?:Until|All))/, + // Methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.extend({ + dir: function( elem, dir, until ) { + var matched = [], + truncate = until !== undefined; + + while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) { + if ( elem.nodeType === 1 ) { + if ( truncate && jQuery( elem ).is( until ) ) { + break; + } + matched.push( elem ); + } + } + return matched; + }, + + sibling: function( n, elem ) { + var matched = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + matched.push( n ); + } + } + + return matched; + } +}); + +jQuery.fn.extend({ + has: function( target ) { + var targets = jQuery( target, this ), + l = targets.length; + + return this.filter(function() { + var i = 0; + for ( ; i < l; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + matched = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { + // Always skip document fragments + if ( cur.nodeType < 11 && (pos ? + pos.index(cur) > -1 : + + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && + jQuery.find.matchesSelector(cur, selectors)) ) { + + matched.push( cur ); + break; + } + } + } + + return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); + }, + + // Determine the position of an element within the set + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; + } + + // Index in selector + if ( typeof elem === "string" ) { + return indexOf.call( jQuery( elem ), this[ 0 ] ); + } + + // Locate the position of the desired element + return indexOf.call( this, + + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[ 0 ] : elem + ); + }, + + add: function( selector, context ) { + return this.pushStack( + jQuery.unique( + jQuery.merge( this.get(), jQuery( selector, context ) ) + ) + ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } +}); + +function sibling( cur, dir ) { + while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {} + return cur; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return elem.contentDocument || jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var matched = jQuery.map( this, fn, until ); + + if ( name.slice( -5 ) !== "Until" ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + matched = jQuery.filter( selector, matched ); + } + + if ( this.length > 1 ) { + // Remove duplicates + if ( !guaranteedUnique[ name ] ) { + jQuery.unique( matched ); + } + + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { + matched.reverse(); + } + } + + return this.pushStack( matched ); + }; +}); +var rnotwhite = (/\S+/g); + + + // String to Object options format cache var optionsCache = {}; // Convert String-formatted options into Object-formatted ones and store in cache function createOptions( options ) { var object = optionsCache[ options ] = {}; - jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { + jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { object[ flag ] = true; }); return object; @@ -2966,7 +3152,7 @@ if ( list ) { jQuery.each( arguments, function( _, arg ) { var index; - while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // Handle firing indexes if ( firing ) { @@ -3040,6 +3226,8 @@ return self; }; + + jQuery.extend({ Deferred: function( func ) { @@ -3062,8 +3250,7 @@ var fns = arguments; return jQuery.Deferred(function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { - var action = tuple[ 0 ], - fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; + var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; // deferred[ done | fail | progress ] for forwarding actions to newDefer deferred[ tuple[1] ](function() { var returned = fn && fn.apply( this, arguments ); @@ -3073,7 +3260,7 @@ .fail( newDefer.reject ) .progress( newDefer.notify ); } else { - newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); + newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); } }); }); @@ -3132,7 +3319,7 @@ // Deferred helper when: function( subordinate /* , ..., subordinateN */ ) { var i = 0, - resolveValues = core_slice.call( arguments ), + resolveValues = slice.call( arguments ), length = resolveValues.length, // the count of uncompleted subordinates @@ -3145,8 +3332,8 @@ updateFunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; - if( values === progressValues ) { + values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( values === progressValues ) { deferred.notifyWith( contexts, values ); } else if ( !( --remaining ) ) { deferred.resolveWith( contexts, values ); @@ -3156,7 +3343,7 @@ progressValues, progressContexts, resolveContexts; - // add listeners to Deferred subordinates; treat others as resolved + // Add listeners to Deferred subordinates; treat others as resolved if ( length > 1 ) { progressValues = new Array( length ); progressContexts = new Array( length ); @@ -3173,7 +3360,7 @@ } } - // if we're not waiting on anything, resolve the master + // If we're not waiting on anything, resolve the master if ( !remaining ) { deferred.resolveWith( resolveContexts, resolveValues ); } @@ -3181,136 +3368,172 @@ return deferred.promise(); } }); -jQuery.support = (function( support ) { - var input = document.createElement("input"), - fragment = document.createDocumentFragment(), - div = document.createElement("div"), - select = document.createElement("select"), - opt = select.appendChild( document.createElement("option") ); - - // Finish early in limited environments - if ( !input.type ) { - return support; - } - - input.type = "checkbox"; - - // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 - // Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere) - support.checkOn = input.value !== ""; - - // Must access the parent to make an option select properly - // Support: IE9, IE10 - support.optSelected = opt.selected; - - // Will be defined later - support.reliableMarginRight = true; - support.boxSizingReliable = true; - support.pixelPosition = false; - - // Make sure checked status is properly cloned - // Support: IE9, IE10 - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Check if an input maintains its value after becoming a radio - // Support: IE9, IE10 - input = document.createElement("input"); - input.value = "t"; - input.type = "radio"; - support.radioValue = input.value === "t"; - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "checked", "t" ); - input.setAttribute( "name", "t" ); - - fragment.appendChild( input ); - - // Support: Safari 5.1, Android 4.x, Android 2.3 - // old WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: Firefox, Chrome, Safari - // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) - support.focusinBubbles = "onfocusin" in window; - - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, marginDiv, - // Support: Firefox, Android 2.3 (Prefixed box-sizing versions). - divReset = "padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box", - body = document.getElementsByTagName("body")[ 0 ]; - - if ( !body ) { - // Return for frameset docs that don't have a body + + +// The deferred used on DOM ready +var readyList; + +jQuery.fn.ready = function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); + + return this; +}; + +jQuery.extend({ + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { return; } - container = document.createElement("div"); - container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; - - // Check box-sizing and margin behavior. - body.appendChild( container ).appendChild( div ); - div.innerHTML = ""; - // Support: Firefox, Android 2.3 (Prefixed box-sizing versions). - div.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%"; - - // Workaround failing boxSizing test due to offsetWidth returning wrong value - // with some non-1 values of body zoom, ticket #13543 - jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() { - support.boxSizing = div.offsetWidth === 4; - }); - - // Use window.getComputedStyle because jsdom on node.js will break without it. - if ( window.getComputedStyle ) { - support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; - support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; - - // Support: Android 2.3 - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. (#3333) - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - marginDiv = div.appendChild( document.createElement("div") ); - marginDiv.style.cssText = div.style.cssText = divReset; - marginDiv.style.marginRight = marginDiv.style.width = "0"; - div.style.width = "1px"; - - support.reliableMarginRight = - !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); - } - - body.removeChild( container ); - }); - - return support; -})( {} ); - -/* - Implementation Summary - - 1. Enforce API surface and semantic compatibility with 1.9.x branch - 2. Improve the module's maintainability by reducing the storage - paths to a single mechanism. - 3. Use the same single mechanism to support "private" and "user" data. - 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) - 5. Avoid exposing implementation details on user objects (eg. expando properties) - 6. Provide a clear path for implementation upgrade to WeakMap in 2014 -*/ -var data_user, data_priv, - rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, - rmultiDash = /([A-Z])/g; + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.triggerHandler ) { + jQuery( document ).triggerHandler( "ready" ); + jQuery( document ).off( "ready" ); + } + } +}); + +/** + * The ready event handler and self cleanup method + */ +function completed() { + document.removeEventListener( "DOMContentLoaded", completed, false ); + window.removeEventListener( "load", completed, false ); + jQuery.ready(); +} + +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { + + readyList = jQuery.Deferred(); + + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // We once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready ); + + } else { + + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed, false ); + } + } + return readyList.promise( obj ); +}; + +// Kick off the DOM ready check even if the user does not +jQuery.ready.promise(); + + + + +// Multifunctional method to get and set values of a collection +// The value/s can optionally be executed if it's a function +var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + len = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < len; i++ ) { + fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); + } + } + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + len ? fn( elems[0], key ) : emptyGet; +}; + + +/** + * Determines whether an object can have data + */ +jQuery.acceptData = function( owner ) { + // Accepts only: + // - Node + // - Node.ELEMENT_NODE + // - Node.DOCUMENT_NODE + // - Object + // - Any + /* jshint -W018 */ + return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); +}; + function Data() { - // Support: Android < 4, + // Support: Android<4, // Old WebKit does not have Object.preventExtensions/freeze method, // return new empty object instead with no [[set]] accessor Object.defineProperty( this.cache = {}, 0, { @@ -3319,21 +3542,11 @@ } }); - this.expando = jQuery.expando + Math.random(); + this.expando = jQuery.expando + Data.uid++; } Data.uid = 1; - -Data.accepts = function( owner ) { - // Accepts only: - // - Node - // - Node.ELEMENT_NODE - // - Node.DOCUMENT_NODE - // - Object - // - Any - return owner.nodeType ? - owner.nodeType === 1 || owner.nodeType === 9 : true; -}; +Data.accepts = jQuery.acceptData; Data.prototype = { key: function( owner ) { @@ -3357,7 +3570,7 @@ descriptor[ this.expando ] = { value: unlock }; Object.defineProperties( owner, descriptor ); - // Support: Android < 4 + // Support: Android<4 // Fallback to a less secure definition } catch ( e ) { descriptor[ this.expando ] = unlock; @@ -3470,7 +3683,7 @@ // Otherwise, create an array by matching non-whitespace name = camel; name = name in cache ? - [ name ] : ( name.match( core_rnotwhite ) || [] ); + [ name ] : ( name.match( rnotwhite ) || [] ); } } @@ -3491,15 +3704,55 @@ } } }; - -// These may be used throughout the jQuery core codebase -data_user = new Data(); -data_priv = new Data(); - +var data_priv = new Data(); + +var data_user = new Data(); + + + +// Implementation Summary +// +// 1. Enforce API surface and semantic compatibility with 1.9.x branch +// 2. Improve the module's maintainability by reducing the storage +// paths to a single mechanism. +// 3. Use the same single mechanism to support "private" and "user" data. +// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) +// 5. Avoid exposing implementation details on user objects (eg. expando properties) +// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 + +var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, + rmultiDash = /([A-Z])/g; + +function dataAttr( elem, key, data ) { + var name; + + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + data_user.set( elem, key, data ); + } else { + data = undefined; + } + } + return data; +} jQuery.extend({ - acceptData: Data.accepts, - hasData: function( elem ) { return data_user.hasData( elem ) || data_priv.hasData( elem ); }, @@ -3525,10 +3778,9 @@ jQuery.fn.extend({ data: function( key, value ) { - var attrs, name, + var i, name, data, elem = this[ 0 ], - i = 0, - data = null; + attrs = elem && elem.attributes; // Gets all values if ( key === undefined ) { @@ -3536,13 +3788,17 @@ data = data_user.get( elem ); if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) { - attrs = elem.attributes; - for ( ; i < attrs.length; i++ ) { - name = attrs[ i ].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.slice(5) ); - dataAttr( elem, name, data[ name ] ); + i = attrs.length; + while ( i-- ) { + + // Support: IE11+ + // The attrs elements can be null (#14894) + if ( attrs[ i ] ) { + name = attrs[ i ].name; + if ( name.indexOf( "data-" ) === 0 ) { + name = jQuery.camelCase( name.slice(5) ); + dataAttr( elem, name, data[ name ] ); + } } } data_priv.set( elem, "hasDataAttrs", true ); @@ -3559,7 +3815,7 @@ }); } - return jQuery.access( this, function( value ) { + return access( this, function( value ) { var data, camelKey = jQuery.camelCase( key ); @@ -3622,34 +3878,7 @@ } }); -function dataAttr( elem, key, data ) { - var name; - - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? JSON.parse( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - data_user.set( elem, key, data ); - } else { - data = undefined; - } - } - return data; -} + jQuery.extend({ queue: function( elem, type, data ) { var queue; @@ -3695,7 +3924,7 @@ queue.unshift( "inprogress" ); } - // clear up the last queue stop function + // Clear up the last queue stop function delete hooks.stop; fn.call( elem, next, hooks ); } @@ -3705,7 +3934,7 @@ } }, - // not intended for public consumption - generates a queueHooks object, or returns the current one + // Not public - generate a queueHooks object, or return the current one _queueHooks: function( elem, type ) { var key = type + "queueHooks"; return data_priv.get( elem, key ) || data_priv.access( elem, key, { @@ -3735,7 +3964,7 @@ this.each(function() { var queue = jQuery.queue( this, type, data ); - // ensure a hooks for this queue + // Ensure a hooks for this queue jQuery._queueHooks( this, type ); if ( type === "fx" && queue[0] !== "inprogress" ) { @@ -3748,19 +3977,6 @@ jQuery.dequeue( this, type ); }); }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, @@ -3784,7 +4000,7 @@ } type = type || "fx"; - while( i-- ) { + while ( i-- ) { tmp = data_priv.get( elements[ i ], type + "queueHooks" ); if ( tmp && tmp.empty ) { count++; @@ -3795,510 +4011,55 @@ return defer.promise( obj ); } }); -var nodeHook, boolHook, - rclass = /[\t\r\n\f]/g, - rreturn = /\r/g, - rfocusable = /^(?:input|select|textarea|button)$/i; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - return this.each(function() { - delete this[ jQuery.propFix[ name ] || name ]; - }); - }, - - addClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call( this, j, this.className ) ); - }); - } - - if ( proceed ) { - // The disjunction here is for better compressibility (see removeClass) - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - " " - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - elem.className = jQuery.trim( cur ); - - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = arguments.length === 0 || typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call( this, j, this.className ) ); - }); - } - if ( proceed ) { - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - "" - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - elem.className = value ? jQuery.trim( cur ) : ""; - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value; - - if ( typeof stateVal === "boolean" && type === "string" ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - classNames = value.match( core_rnotwhite ) || []; - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - if ( self.hasClass( className ) ) { - self.removeClass( className ); - } else { - self.addClass( className ); - } - } - - // Toggle whole class name - } else if ( type === core_strundefined || type === "boolean" ) { - if ( this.className ) { - // store className if set - data_priv.set( this, "__className__", this.className ); - } - - // If the element has a class name or if we're passed "false", - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, option, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one" || index < 0, - values = one ? null : [], - max = one ? index + 1 : options.length, - i = index < 0 ? - max : - one ? index : 0; - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // IE6-9 doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - // Don't return options that are disabled or in a disabled optgroup - ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && - ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) { - optionSet = true; - } - } - - // force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attr: function( elem, name, value ) { - var hooks, ret, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === core_strundefined ) { - return jQuery.prop( elem, name, value ); - } - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - - } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, value + "" ); - return value; - } - - } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var name, propName, - i = 0, - attrNames = value && value.match( core_rnotwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( (name = attrNames[i++]) ) { - propName = jQuery.propFix[ name ] || name; - - // Boolean attributes get special treatment (#10870) - if ( jQuery.expr.match.bool.test( name ) ) { - // Set corresponding property to false - elem[ propName ] = false; - } - - elem.removeAttribute( name ); - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to default in case type is set after value during creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? - ret : - ( elem[ name ] = value ); - - } else { - return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? - ret : - elem[ name ]; - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ? - elem.tabIndex : - -1; - } - } - } -}); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - elem.setAttribute( name, name ); - } - return name; - } -}; -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { - var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr; - - jQuery.expr.attrHandle[ name ] = function( elem, name, isXML ) { - var fn = jQuery.expr.attrHandle[ name ], - ret = isXML ? - undefined : - /* jshint eqeqeq: false */ - // Temporarily disable this handler to check existence - (jQuery.expr.attrHandle[ name ] = undefined) != - getter( elem, name, isXML ) ? - - name.toLowerCase() : - null; - - // Restore handler - jQuery.expr.attrHandle[ name ] = fn; - - return ret; +var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; + +var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; + +var isHidden = function( elem, el ) { + // isHidden might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); }; -}); - -// Support: IE9+ -// Selectedness for an option in an optgroup can be inaccurate -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - var parent = elem.parentNode; - if ( parent && parent.parentNode ) { - parent.parentNode.selectedIndex; - } - return null; - } - }; -} - -jQuery.each([ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -}); - -// Radios and checkboxes getter/setter -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }; - if ( !jQuery.support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - // Support: Webkit - // "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - }; - } -}); -var rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, + +var rcheckableType = (/^(?:checkbox|radio)$/i); + + + +(function() { + var fragment = document.createDocumentFragment(), + div = fragment.appendChild( document.createElement( "div" ) ), + input = document.createElement( "input" ); + + // Support: Safari<=5.1 + // Check state lost if the name is set (#11217) + // Support: Windows Web Apps (WWA) + // `name` and `type` must use .setAttribute for WWA (#14901) + input.setAttribute( "type", "radio" ); + input.setAttribute( "checked", "checked" ); + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + + // Support: Safari<=5.1, Android<4.2 + // Older WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE<=11+ + // Make sure textarea (and checkbox) defaultValue is properly cloned + div.innerHTML = ""; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; +})(); +var strundefined = typeof undefined; + + + +support.focusinBubbles = "onfocusin" in window; + + +var + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; @@ -4356,16 +4117,13 @@ eventHandle = elemData.handle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded - return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; + return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ? + jQuery.event.dispatch.apply( elem, arguments ) : undefined; }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; } // Handle multiple events separated by a space - types = ( types || "" ).match( core_rnotwhite ) || [""]; + types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; @@ -4430,8 +4188,6 @@ jQuery.event.global[ type ] = true; } - // Nullify elem to prevent memory leaks in IE - elem = null; }, // Detach an event or set of events from an element @@ -4447,7 +4203,7 @@ } // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( core_rnotwhite ) || [""]; + types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; @@ -4509,8 +4265,8 @@ var i, cur, tmp, bubbleType, ontype, handle, special, eventPath = [ elem || document ], - type = core_hasOwn.call( event, "type" ) ? event.type : event, - namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; cur = tmp = elem = elem || document; @@ -4596,8 +4352,11 @@ // Native handler handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { - event.preventDefault(); + if ( handle && handle.apply && jQuery.acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } } } event.type = type; @@ -4641,7 +4400,7 @@ var i, j, ret, matched, handleObj, handlerQueue = [], - args = core_slice.call( arguments ), + args = slice.call( arguments ), handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [], special = jQuery.event.special[ event.type ] || {}; @@ -4665,8 +4424,8 @@ j = 0; while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { - // Triggered event must either 1) have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + // Triggered event must either 1) have no namespace, or 2) have namespace(s) + // a subset or equal to those in the bound event (both can have no namespace). if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { event.handleObj = handleObj; @@ -4816,13 +4575,13 @@ event.target = document; } - // Support: Safari 6.0+, Chrome < 28 + // Support: Safari 6.0+, Chrome<28 // Target should not be a text node (#504, #13143) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; }, special: { @@ -4869,7 +4628,7 @@ // Support: Firefox 20+ // Firefox doesn't alert if the returnValue field is not set. - if ( event.result !== undefined ) { + if ( event.result !== undefined && event.originalEvent ) { event.originalEvent.returnValue = event.result; } } @@ -4919,8 +4678,12 @@ // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && + // Support: Android<4.0 + src.returnValue === false ? + returnTrue : + returnFalse; // Event type } else { @@ -4965,7 +4728,14 @@ } }, stopImmediatePropagation: function() { + var e = this.originalEvent; + this.isImmediatePropagationStopped = returnTrue; + + if ( e && e.stopImmediatePropagation ) { + e.stopImmediatePropagation(); + } + this.stopPropagation(); } }; @@ -4974,7 +4744,9 @@ // Support: Chrome 15+ jQuery.each({ mouseenter: "mouseover", - mouseleave: "mouseout" + mouseleave: "mouseout", + pointerenter: "pointerover", + pointerleave: "pointerout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, @@ -4998,26 +4770,36 @@ }; }); +// Support: Firefox, Chrome, Safari // Create "bubbling" focus and blur events -// Support: Firefox, Chrome, Safari -if ( !jQuery.support.focusinBubbles ) { +if ( !support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); }; jQuery.event.special[ fix ] = { setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } + var doc = this.ownerDocument || this, + attaches = data_priv.access( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); + } + data_priv.access( doc, fix, ( attaches || 0 ) + 1 ); }, teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); + var doc = this.ownerDocument || this, + attaches = data_priv.access( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + data_priv.remove( doc, fix ); + + } else { + data_priv.access( doc, fix, attaches ); } } }; @@ -5126,294 +4908,13 @@ } } }); -var isSimple = /^.[^:#\[\.,]*$/, - rparentsprev = /^(?:parents|prev(?:Until|All))/, - rneedsContext = jQuery.expr.match.needsContext, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var i, - ret = [], - self = this, - len = self.length; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }) ); - } - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - // Needed because $( selector, context ) becomes $( context ).find( selector ) - ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); - ret.selector = this.selector ? this.selector + " " + selector : selector; - return ret; - }, - - has: function( target ) { - var targets = jQuery( target, this ), - l = targets.length; - - return this.filter(function() { - var i = 0; - for ( ; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector || [], true) ); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector || [], false) ); - }, - - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - matched = [], - pos = ( rneedsContext.test( selectors ) || typeof selectors !== "string" ) ? - jQuery( selectors, context || this.context ) : - 0; - - for ( ; i < l; i++ ) { - for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { - // Always skip document fragments - if ( cur.nodeType < 11 && (pos ? - pos.index(cur) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector(cur, selectors)) ) { - - cur = matched.push( cur ); - break; - } - } - } - - return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return core_indexOf.call( jQuery( elem ), this[ 0 ] ); - } - - // Locate the position of the desired element - return core_indexOf.call( this, - - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[ 0 ] : elem - ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( jQuery.unique(all) ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter(selector) - ); - } -}); - -function sibling( cur, dir ) { - while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {} - - return cur; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return elem.contentDocument || jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var matched = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - matched = jQuery.filter( selector, matched ); - } - - if ( this.length > 1 ) { - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - jQuery.unique( matched ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - matched.reverse(); - } - } - - return this.pushStack( matched ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 && elem.nodeType === 1 ? - jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : - jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - })); - }, - - dir: function( elem, dir, until ) { - var matched = [], - truncate = until !== undefined; - - while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) { - if ( elem.nodeType === 1 ) { - if ( truncate && jQuery( elem ).is( until ) ) { - break; - } - matched.push( elem ); - } - } - return matched; - }, - - sibling: function( n, elem ) { - var matched = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - matched.push( n ); - } - } - - return matched; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - /* jshint -W018 */ - return !!qualifier.call( elem, i, elem ) !== not; - }); - - } - - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - }); - - } - - if ( typeof qualifier === "string" ) { - if ( isSimple.test( qualifier ) ) { - return jQuery.filter( qualifier, elements, not ); - } - - qualifier = jQuery.filter( qualifier, elements ); - } - - return jQuery.grep( elements, function( elem ) { - return ( core_indexOf.call( qualifier, elem ) >= 0 ) !== not; - }); -} -var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + + +var + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, rhtml = /<|&#?\w+;/, rnoInnerhtml = /<(?:script|style|link)/i, - manipulation_rcheckableType = /^(?:checkbox|radio)$/i, // checked="checked" or checked rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscriptType = /^$|\/(?:java|ecma)script/i, @@ -5423,7 +4924,7 @@ // We have to close these tags to support XHTML (#13200) wrapMap = { - // Support: IE 9 + // Support: IE9 option: [ 1, "" ], thead: [ 1, "", "
" ], @@ -5434,284 +4935,109 @@ _default: [ 0, "", "" ] }; -// Support: IE 9 +// Support: IE9 wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; -jQuery.fn.extend({ - text: function( value ) { - return jQuery.access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, - - append: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - }); - }, - - before: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - }); - }, - - after: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - }); - }, - - // keepData is for internal use only--do not document - remove: function( selector, keepData ) { - var elem, - elems = selector ? jQuery.filter( selector, this ) : this, - i = 0; - - for ( ; (elem = elems[i]) != null; i++ ) { - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem ) ); - } - - if ( elem.parentNode ) { - if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { - setGlobalEval( getAll( elem, "script" ) ); - } - elem.parentNode.removeChild( elem ); - } - } - - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - if ( elem.nodeType === 1 ) { - - // Prevent memory leaks - jQuery.cleanData( getAll( elem, false ) ); - - // Remove any remaining nodes - elem.textContent = ""; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function () { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - return jQuery.access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined && elem.nodeType === 1 ) { - return elem.innerHTML; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { - - value = value.replace( rxhtmlTag, "<$1>" ); - - try { - for ( ; i < l; i++ ) { - elem = this[ i ] || {}; - - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch( e ) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var - // Snapshot the DOM in case .domManip sweeps something relevant into its fragment - args = jQuery.map( this, function( elem ) { - return [ elem.nextSibling, elem.parentNode ]; - }), - i = 0; - - // Make the changes, replacing each context element with the new content - this.domManip( arguments, function( elem ) { - var next = args[ i++ ], - parent = args[ i++ ]; - - if ( parent ) { - // Don't use the snapshot next if it has moved (#13810) - if ( next && next.parentNode !== parent ) { - next = this.nextSibling; - } - jQuery( this ).remove(); - parent.insertBefore( elem, next ); - } - // Allow new content to include elements from the context set - }, true ); - - // Force removal if there was no new content (e.g., from empty arguments) - return i ? this : this.remove(); - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, callback, allowIntersection ) { - - // Flatten any nested arrays - args = core_concat.apply( [], args ); - - var fragment, first, scripts, hasScripts, node, doc, - i = 0, - l = this.length, - set = this, - iNoClone = l - 1, - value = args[ 0 ], - isFunction = jQuery.isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { - return this.each(function( index ) { - var self = set.eq( index ); - if ( isFunction ) { - args[ 0 ] = value.call( this, index, self.html() ); - } - self.domManip( args, callback, allowIntersection ); - }); - } - - if ( l ) { - fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - if ( first ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - // Support: QtWebKit - // jQuery.merge because core_push.apply(_, arraylike) throws - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( this[ i ], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - - if ( node.src ) { - // Hope ajax is available... - jQuery._evalUrl( node.src ); - } else { - jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); - } - } - } - } - } - } - - return this; - } -}); - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1, - i = 0; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone( true ); - jQuery( insert[ i ] )[ original ]( elems ); - - // Support: QtWebKit - // .get() because core_push.apply(_, arraylike) throws - core_push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -}); +// Support: 1.x compatibility +// Manipulating tables requires a tbody +function manipulationTarget( elem, content ) { + return jQuery.nodeName( elem, "table" ) && + jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? + + elem.getElementsByTagName("tbody")[0] || + elem.appendChild( elem.ownerDocument.createElement("tbody") ) : + elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + + if ( match ) { + elem.type = match[ 1 ]; + } else { + elem.removeAttribute("type"); + } + + return elem; +} + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + data_priv.set( + elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" ) + ); + } +} + +function cloneCopyEvent( src, dest ) { + var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; + + if ( dest.nodeType !== 1 ) { + return; + } + + // 1. Copy private data: events, handlers, etc. + if ( data_priv.hasData( src ) ) { + pdataOld = data_priv.access( src ); + pdataCur = data_priv.set( dest, pdataOld ); + events = pdataOld.events; + + if ( events ) { + delete pdataCur.handle; + pdataCur.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + } + + // 2. Copy user data + if ( data_user.hasData( src ) ) { + udataOld = data_user.access( src ); + udataCur = jQuery.extend( {}, udataOld ); + + data_user.set( dest, udataCur ); + } +} + +function getAll( context, tag ) { + var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) : + context.querySelectorAll ? context.querySelectorAll( tag || "*" ) : + []; + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], ret ) : + ret; +} + +// Fix IE bugs, see support tests +function fixInput( src, dest ) { + var nodeName = dest.nodeName.toLowerCase(); + + // Fails to persist the checked state of a cloned checkbox or radio button. + if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + dest.checked = src.checked; + + // Fails to return the selected option to the default selected state when cloning options + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} jQuery.extend({ clone: function( elem, dataAndEvents, deepDataAndEvents ) { @@ -5719,9 +5045,9 @@ clone = elem.cloneNode( true ), inPage = jQuery.contains( elem.ownerDocument, elem ); - // Support: IE >= 9 - // Fix Cloning issues - if ( !jQuery.support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { + // Fix IE cloning issues + if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && + !jQuery.isXMLDoc( elem ) ) { // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 destElements = getAll( clone ); @@ -5758,10 +5084,10 @@ buildFragment: function( elems, context, scripts, selection ) { var elem, tmp, tag, wrap, contains, j, + fragment = context.createDocumentFragment(), + nodes = [], i = 0, - l = elems.length, - fragment = context.createDocumentFragment(), - nodes = []; + l = elems.length; for ( ; i < l; i++ ) { elem = elems[ i ]; @@ -5770,8 +5096,8 @@ // Add nodes directly if ( jQuery.type( elem ) === "object" ) { - // Support: QtWebKit - // jQuery.merge because core_push.apply(_, arraylike) throws + // Support: QtWebKit, PhantomJS + // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); // Convert non-html into a text node @@ -5783,7 +5109,7 @@ tmp = tmp || fragment.appendChild( context.createElement("div") ); // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || ["", ""] )[ 1 ].toLowerCase(); + tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); wrap = wrapMap[ tag ] || wrapMap._default; tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[ 2 ]; @@ -5793,15 +5119,14 @@ tmp = tmp.lastChild; } - // Support: QtWebKit - // jQuery.merge because core_push.apply(_, arraylike) throws + // Support: QtWebKit, PhantomJS + // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( nodes, tmp.childNodes ); // Remember the top-level container tmp = fragment.firstChild; - // Fixes #12346 - // Support: Webkit, IE + // Ensure the created nodes are orphaned (#12392) tmp.textContent = ""; } } @@ -5844,18 +5169,17 @@ }, cleanData: function( elems ) { - var data, elem, events, type, key, j, + var data, elem, type, key, special = jQuery.event.special, i = 0; for ( ; (elem = elems[ i ]) !== undefined; i++ ) { - if ( Data.accepts( elem ) ) { + if ( jQuery.acceptData( elem ) ) { key = elem[ data_priv.expando ]; if ( key && (data = data_priv.cache[ key ]) ) { - events = Object.keys( data.events || {} ); - if ( events.length ) { - for ( j = 0; (type = events[j]) !== undefined; j++ ) { + if ( data.events ) { + for ( type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); @@ -5874,216 +5198,560 @@ // Discard any remaining `user` data delete data_user.cache[ elem[ data_user.expando ] ]; } - }, - - _evalUrl: function( url ) { - return jQuery.ajax({ - url: url, - type: "GET", - dataType: "script", - async: false, - global: false, - "throws": true - }); } }); -// Support: 1.x compatibility -// Manipulating tables requires a tbody -function manipulationTarget( elem, content ) { - return jQuery.nodeName( elem, "table" ) && - jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ? - - elem.getElementsByTagName("tbody")[0] || - elem.appendChild( elem.ownerDocument.createElement("tbody") ) : - elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - - if ( match ) { - elem.type = match[ 1 ]; - } else { - elem.removeAttribute("type"); - } - - return elem; -} - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var l = elems.length, - i = 0; - - for ( ; i < l; i++ ) { - data_priv.set( - elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" ) - ); - } -} - -function cloneCopyEvent( src, dest ) { - var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; - - if ( dest.nodeType !== 1 ) { - return; - } - - // 1. Copy private data: events, handlers, etc. - if ( data_priv.hasData( src ) ) { - pdataOld = data_priv.access( src ); - pdataCur = data_priv.set( dest, pdataOld ); - events = pdataOld.events; - - if ( events ) { - delete pdataCur.handle; - pdataCur.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - } - - // 2. Copy user data - if ( data_user.hasData( src ) ) { - udataOld = data_user.access( src ); - udataCur = jQuery.extend( {}, udataOld ); - - data_user.set( dest, udataCur ); - } -} - - -function getAll( context, tag ) { - var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) : - context.querySelectorAll ? context.querySelectorAll( tag || "*" ) : - []; - - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], ret ) : - ret; -} - -// Support: IE >= 9 -function fixInput( src, dest ) { - var nodeName = dest.nodeName.toLowerCase(); - - // Fails to persist the checked state of a cloned checkbox or radio button. - if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { - dest.checked = src.checked; - - // Fails to return the selected option to the default selected state when cloning options - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} jQuery.fn.extend({ - wrapAll: function( html ) { - var wrap; - - if ( jQuery.isFunction( html ) ) { - return this.each(function( i ) { - jQuery( this ).wrapAll( html.call(this, i) ); + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().each(function() { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.textContent = value; + } + }); + }, null, value, arguments.length ); + }, + + append: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + }); + }, + + before: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + }); + }, + + after: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + }); + }, + + remove: function( selector, keepData /* Internal Use Only */ ) { + var elem, + elems = selector ? jQuery.filter( selector, this ) : this, + i = 0; + + for ( ; (elem = elems[i]) != null; i++ ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem ) ); + } + + if ( elem.parentNode ) { + if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { + setGlobalEval( getAll( elem, "script" ) ); + } + elem.parentNode.removeChild( elem ); + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + if ( elem.nodeType === 1 ) { + + // Prevent memory leaks + jQuery.cleanData( getAll( elem, false ) ); + + // Remove any remaining nodes + elem.textContent = ""; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map(function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; + + if ( value === undefined && elem.nodeType === 1 ) { + return elem.innerHTML; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1>" ); + + try { + for ( ; i < l; i++ ) { + elem = this[ i ] || {}; + + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch( e ) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var arg = arguments[ 0 ]; + + // Make the changes, replacing each context element with the new content + this.domManip( arguments, function( elem ) { + arg = this.parentNode; + + jQuery.cleanData( getAll( this ) ); + + if ( arg ) { + arg.replaceChild( elem, this ); + } + }); + + // Force removal if there was no new content (e.g., from empty arguments) + return arg && (arg.length || arg.nodeType) ? this : this.remove(); + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, callback ) { + + // Flatten any nested arrays + args = concat.apply( [], args ); + + var fragment, first, scripts, hasScripts, node, doc, + i = 0, + l = this.length, + set = this, + iNoClone = l - 1, + value = args[ 0 ], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return this.each(function( index ) { + var self = set.eq( index ); + if ( isFunction ) { + args[ 0 ] = value.call( this, index, self.html() ); + } + self.domManip( args, callback ); }); } - if ( this[ 0 ] ) { - - // The elements to wrap the target around - wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); - - if ( this[ 0 ].parentNode ) { - wrap.insertBefore( this[ 0 ] ); - } - - wrap.map(function() { - var elem = this; - - while ( elem.firstElementChild ) { - elem = elem.firstElementChild; - } - - return elem; - }).append( this ); + if ( l ) { + fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + // Support: QtWebKit + // jQuery.merge because push.apply(_, arraylike) throws + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( this[ i ], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { + + if ( node.src ) { + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl ) { + jQuery._evalUrl( node.src ); + } + } else { + jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); + } + } + } + } + } } return this; - }, - - wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function( i ) { - jQuery( this ).wrapInner( html.call(this, i) ); - }); - } - - return this.each(function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); + } +}); + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1, + i = 0; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone( true ); + jQuery( insert[ i ] )[ original ]( elems ); + + // Support: QtWebKit + // .get() because push.apply(_, arraylike) throws + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +}); + + +var iframe, + elemdisplay = {}; + +/** + * Retrieve the actual display of a element + * @param {String} name nodeName of the element + * @param {Object} doc Document object + */ +// Called only from within defaultDisplay +function actualDisplay( name, doc ) { + var style, + elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), + + // getDefaultComputedStyle might be reliably used only on attached element + display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? + + // Use of this method is a temporary fix (more like optimization) until something better comes along, + // since it was removed from specification and supported only in FF + style.display : jQuery.css( elem[ 0 ], "display" ); + + // We don't have any data stored on the element, + // so use "detach" method as fast way to get rid of the element + elem.detach(); + + return display; +} + +/** + * Try to determine the default display value of an element + * @param {String} nodeName + */ +function defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; + + if ( !display ) { + display = actualDisplay( nodeName, doc ); + + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { + + // Use the already-created iframe if possible + iframe = (iframe || jQuery( "';o.extend(q.prototype,{_scroll:function(){var e=this.qtip.elements.overlay;e&&(e[0].style.top=o(t).scrollTop()+"px")},init:function(i){var s=i.tooltip;1>o("select, object").length&&(this.bgiframe=i.elements.bgiframe=o(qe).appendTo(s),i._bind(s,"tooltipmove",this.adjustBGIFrame,this._ns,this)),this.redrawContainer=o("
",{id:$+"-rcontainer"}).appendTo(e.body),i.elements.overlay&&i.elements.overlay.addClass("qtipmodal-ie6fix")&&(i._bind(t,["scroll","resize"],this._scroll,this._ns,this),i._bind(s,["tooltipshow"],this._scroll,this._ns,this)),this.redraw()},adjustBGIFrame:function(){var t,e,i=this.qtip.tooltip,s={height:i.outerHeight(S),width:i.outerWidth(S)},o=this.qtip.plugins.tip,n=this.qtip.elements.tip;e=parseInt(i.css("borderLeftWidth"),10)||0,e={left:-e,top:-e},o&&n&&(t="x"===o.corner.precedance?[I,L]:[k,B],e[t[1]]-=n[t[0]]()),this.bgiframe.css(e).css(s)},redraw:function(){if(1>this.qtip.rendered||this.drawing)return self;var t,e,i,s,o=this.qtip.tooltip,n=this.qtip.options.style,r=this.qtip.options.position.container;return this.qtip.drawing=1,n.height&&o.css(k,n.height),n.width?o.css(I,n.width):(o.css(I,"").appendTo(this.redrawContainer),e=o.width(),1>e%2&&(e+=1),i=o.css("maxWidth")||"",s=o.css("minWidth")||"",t=(i+s).indexOf("%")>-1?r.width()/100:0,i=(i.indexOf("%")>-1?t:1)*parseInt(i,10)||e,s=(s.indexOf("%")>-1?t:1)*parseInt(s,10)||0,e=i+s?Math.min(Math.max(e,s),i):e,o.css(I,Math.round(e)).appendTo(r)),this.drawing=0,self},destroy:function(){this.bgiframe&&this.bgiframe.remove(),this.qtip._unbind([t,this.qtip.tooltip],this._ns)}}),_e=N.ie6=function(t){return 6===BROWSER.ie?new q(t):S},_e.initialize="render",z.ie6={"^content|style$":function(){this.redraw()}}})})(window,document); \ No newline at end of file diff -r 8c8fd6a5bba9 -r 638ad584ca27 server/src/remie/static/remie/js/jquery.sparkline.js --- a/server/src/remie/static/remie/js/jquery.sparkline.js Fri Sep 18 17:21:49 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1271 +0,0 @@ -/** -* -* jquery.sparkline.js -* -* v1.6 -* (c) Splunk, Inc -* Contact: Gareth Watts (gareth@splunk.com) -* http://omnipotent.net/jquery.sparkline/ -* -* Generates inline sparkline charts from data supplied either to the method -* or inline in HTML -* -* Compatible with Internet Explorer 6.0+ and modern browsers equipped with the canvas tag -* (Firefox 2.0+, Safari, Opera, etc) -* -* License: New BSD License -* -* Copyright (c) 2010, Splunk Inc. -* 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 Splunk Inc 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. -* -* -* Usage: -* $(selector).sparkline(values, options) -* -* If values is undefined or set to 'html' then the data values are read from the specified tag: -*

Sparkline: 1,4,6,6,8,5,3,5

-* $('.sparkline').sparkline(); -* There must be no spaces in the enclosed data set -* -* Otherwise values must be an array of numbers or null values -*

Sparkline: This text replaced if the browser is compatible

-* $('#sparkline1').sparkline([1,4,6,6,8,5,3,5]) -* $('#sparkline2').sparkline([1,4,6,null,null,5,3,5]) -* -* Values can also be specified in an HTML comment, or as a values attribute: -*

Sparkline:

-*

Sparkline:

-* $('.sparkline').sparkline(); -* -* For line charts, x values can also be specified: -*

Sparkline: 1:1,2.7:4,3.4:6,5:6,6:8,8.7:5,9:3,10:5

-* $('#sparkline1').sparkline([ [1,1], [2.7,4], [3.4,6], [5,6], [6,8], [8.7,5], [9,3], [10,5] ]) -* -* By default, options should be passed in as teh second argument to the sparkline function: -* $('.sparkline').sparkline([1,2,3,4], {type: 'bar'}) -* -* Options can also be set by passing them on the tag itself. This feature is disabled by default though -* as there's a slight performance overhead: -* $('.sparkline').sparkline([1,2,3,4], {enableTagOptions: true}) -*

Sparkline: loading

-* Prefix all options supplied as tag attribute with "spark" (configurable by setting tagOptionPrefix) -* -* Supported options: -* lineColor - Color of the line used for the chart -* fillColor - Color used to fill in the chart - Set to '' or false for a transparent chart -* width - Width of the chart - Defaults to 3 times the number of values in pixels -* height - Height of the chart - Defaults to the height of the containing element -* chartRangeMin - Specify the minimum value to use for the Y range of the chart - Defaults to the minimum value supplied -* chartRangeMax - Specify the maximum value to use for the Y range of the chart - Defaults to the maximum value supplied -* chartRangeClip - Clip out of range values to the max/min specified by chartRangeMin and chartRangeMax -* chartRangeMinX - Specify the minimum value to use for the X range of the chart - Defaults to the minimum value supplied -* chartRangeMaxX - Specify the maximum value to use for the X range of the chart - Defaults to the maximum value supplied -* composite - If true then don't erase any existing chart attached to the tag, but draw -* another chart over the top - Note that width and height are ignored if an -* existing chart is detected. -* tagValuesAttribute - Name of tag attribute to check for data values - Defaults to 'values' -* enableTagOptions - Whether to check tags for sparkline options -* tagOptionPrefix - Prefix used for options supplied as tag attributes - Defaults to 'spark' -* -* There are 7 types of sparkline, selected by supplying a "type" option of 'line' (default), -* 'bar', 'tristate', 'bullet', 'discrete', 'pie' or 'box' -* line - Line chart. Options: -* spotColor - Set to '' to not end each line in a circular spot -* minSpotColor - If set, color of spot at minimum value -* maxSpotColor - If set, color of spot at maximum value -* spotRadius - Radius in pixels -* lineWidth - Width of line in pixels -* normalRangeMin -* normalRangeMax - If set draws a filled horizontal bar between these two values marking the "normal" -* or expected range of values -* normalRangeColor - Color to use for the above bar -* drawNormalOnTop - Draw the normal range above the chart fill color if true -* defaultPixelsPerValue - Defaults to 3 pixels of width for each value in the chart -* -* bar - Bar chart. Options: -* barColor - Color of bars for postive values -* negBarColor - Color of bars for negative values -* zeroColor - Color of bars with zero values -* nullColor - Color of bars with null values - Defaults to omitting the bar entirely -* barWidth - Width of bars in pixels -* colorMap - Optional mappnig of values to colors to override the *BarColor values above -* can be an Array of values to control the color of individual bars -* barSpacing - Gap between bars in pixels -* zeroAxis - Centers the y-axis around zero if true -* -* tristate - Charts values of win (>0), lose (<0) or draw (=0) -* posBarColor - Color of win values -* negBarColor - Color of lose values -* zeroBarColor - Color of draw values -* barWidth - Width of bars in pixels -* barSpacing - Gap between bars in pixels -* colorMap - Optional mappnig of values to colors to override the *BarColor values above -* can be an Array of values to control the color of individual bars -* -* discrete - Options: -* lineHeight - Height of each line in pixels - Defaults to 30% of the graph height -* thesholdValue - Values less than this value will be drawn using thresholdColor instead of lineColor -* thresholdColor -* -* bullet - Values for bullet graphs msut be in the order: target, performance, range1, range2, range3, ... -* options: -* targetColor - The color of the vertical target marker -* targetWidth - The width of the target marker in pixels -* performanceColor - The color of the performance measure horizontal bar -* rangeColors - Colors to use for each qualitative range background color -* -* pie - Pie chart. Options: -* sliceColors - An array of colors to use for pie slices -* offset - Angle in degrees to offset the first slice - Try -90 or +90 -* -* box - Box plot. Options: -* raw - Set to true to supply pre-computed plot points as values -* values should be: low_outlier, low_whisker, q1, median, q3, high_whisker, high_outlier -* When set to false you can supply any number of values and the box plot will -* be computed for you. Default is false. -* showOutliers - Set to true (default) to display outliers as circles -* outlierIRQ - Interquartile range used to determine outliers. Default 1.5 -* boxLineColor - Outline color of the box -* boxFillColor - Fill color for the box -* whiskerColor - Line color used for whiskers -* outlierLineColor - Outline color of outlier circles -* outlierFillColor - Fill color of the outlier circles -* spotRadius - Radius of outlier circles -* medianColor - Line color of the median line -* target - Draw a target cross hair at the supplied value (default undefined) -* -* -* -* Examples: -* $('#sparkline1').sparkline(myvalues, { lineColor: '#f00', fillColor: false }); -* $('.barsparks').sparkline('html', { type:'bar', height:'40px', barWidth:5 }); -* $('#tristate').sparkline([1,1,-1,1,0,0,-1], { type:'tristate' }): -* $('#discrete').sparkline([1,3,4,5,5,3,4,5], { type:'discrete' }); -* $('#bullet').sparkline([10,12,12,9,7], { type:'bullet' }); -* $('#pie').sparkline([1,1,2], { type:'pie' }); -*/ - - -(function($) { - - /* - * Default configuration settings - */ - var defaults = { - // Settings common to most/all chart types - common: { - type : 'line', - lineColor : '#00f', - fillColor : '#cdf', - defaultPixelsPerValue : 3, - width : 'auto', - height : 'auto', - composite : false, - tagValuesAttribute: 'values', - tagOptionsPrefix: 'spark', - enableTagOptions: false - }, - // Defaults for line charts - line: { - spotColor : '#f80', - spotRadius : 1.5, - minSpotColor : '#f80', - maxSpotColor : '#f80', - lineWidth: 1, - normalRangeMin : undefined, - normalRangeMax : undefined, - normalRangeColor : '#ccc', - drawNormalOnTop: false, - chartRangeMin : undefined, - chartRangeMax : undefined, - chartRangeMinX : undefined, - chartRangeMaxX : undefined - }, - // Defaults for bar charts - bar: { - barColor : '#00f', - negBarColor : '#f44', - zeroColor: undefined, - nullColor: undefined, - zeroAxis : undefined, - barWidth : 4, - barSpacing : 1, - chartRangeMax: undefined, - chartRangeMin: undefined, - chartRangeClip: false, - colorMap : undefined - }, - // Defaults for tristate charts - tristate: { - barWidth : 4, - barSpacing : 1, - posBarColor: '#6f6', - negBarColor : '#f44', - zeroBarColor : '#999', - colorMap : {} - }, - // Defaults for discrete charts - discrete: { - lineHeight: 'auto', - thresholdColor: undefined, - thresholdValue : 0, - chartRangeMax: undefined, - chartRangeMin: undefined, - chartRangeClip: false - }, - // Defaults for bullet charts - bullet: { - targetColor : 'red', - targetWidth : 3, // width of the target bar in pixels - performanceColor : 'blue', - rangeColors : ['#D3DAFE', '#A8B6FF', '#7F94FF' ], - base : undefined // set this to a number to change the base start number - }, - // Defaults for pie charts - pie: { - sliceColors : ['#f00', '#0f0', '#00f'] - }, - // Defaults for box plots - box: { - raw: false, - boxLineColor: 'black', - boxFillColor: '#cdf', - whiskerColor: 'black', - outlierLineColor: '#333', - outlierFillColor: 'white', - medianColor: 'red', - showOutliers: true, - outlierIQR: 1.5, - spotRadius: 1.5, - target: undefined, - targetColor: '#4a2', - chartRangeMax: undefined, - chartRangeMin: undefined - } - }; - - // Provide a cross-browser interface to a few simple drawing primitives - var VCanvas_base, VCanvas_canvas, VCanvas_vml; - $.fn.simpledraw = function(width, height, use_existing) { - if (use_existing && this[0].VCanvas) { - return this[0].VCanvas; - } - if (width === undefined) { - width=$(this).innerWidth(); - } - if (height === undefined) { - height=$(this).innerHeight(); - } - if ($.browser.hasCanvas) { - return new VCanvas_canvas(width, height, this); - } else if ($.browser.msie) { - return new VCanvas_vml(width, height, this); - } else { - return false; - } - }; - - var pending = []; - - - $.fn.sparkline = function(uservalues, userOptions) { - return this.each(function() { - var options = new $.fn.sparkline.options(this, userOptions); - var render = function() { - var values, width, height; - if (uservalues==='html' || uservalues===undefined) { - var vals = this.getAttribute(options.get('tagValuesAttribute')); - if (vals===undefined || vals===null) { - vals = $(this).html(); - } - values = vals.replace(/(^\s*\s*$)|\s+/g, '').split(','); - } else { - values = uservalues; - } - - width = options.get('width')=='auto' ? values.length*options.get('defaultPixelsPerValue') : options.get('width'); - if (options.get('height') == 'auto') { - if (!options.get('composite') || !this.VCanvas) { - // must be a better way to get the line height - var tmp = document.createElement('span'); - tmp.innerHTML = 'a'; - $(this).html(tmp); - height = $(tmp).innerHeight(); - $(tmp).remove(); - } - } else { - height = options.get('height'); - } - - $.fn.sparkline[options.get('type')].call(this, values, options, width, height); - }; - // jQuery 1.3.0 completely changed the meaning of :hidden :-/ - if (($(this).html() && $(this).is(':hidden')) || ($.fn.jquery < "1.3.0" && $(this).parents().is(':hidden')) || !$(this).parents('body').length) { - pending.push([this, render]); - } else { - render.call(this); - } - }); - }; - - $.fn.sparkline.defaults = defaults; - - - $.sparkline_display_visible = function() { - for (var i=pending.length-1; i>=0; i--) { - var el = pending[i][0]; - if ($(el).is(':visible') && !$(el).parents().is(':hidden')) { - pending[i][1].call(el); - pending.splice(i, 1); - } - } - }; - - - /** - * User option handler - */ - var UNSET_OPTION = {}; - var normalizeValue = function(val) { - switch(val) { - case 'undefined': - val = undefined; - break; - case 'null': - val = null; - break; - case 'true': - val = true; - break; - case 'false': - val = false; - break; - default: - var nf = parseFloat(val); - if (val == nf) { - val = nf; - } - } - return val; - }; - $.fn.sparkline.options = function(tag, userOptions) { - var extendedOptions; - this.userOptions = userOptions = userOptions || {}; - this.tag = tag; - this.tagValCache = {}; - var defaults = $.fn.sparkline.defaults; - var base = defaults.common; - this.tagOptionsPrefix = userOptions.enableTagOptions && (userOptions.tagOptionsPrefix || base.tagOptionsPrefix); - - var tagOptionType = this.getTagSetting('type'); - if (tagOptionType === UNSET_OPTION) { - extendedOptions = defaults[userOptions.type || base.type]; - } else { - extendedOptions = defaults[tagOptionType]; - } - this.mergedOptions = $.extend({}, base, extendedOptions, userOptions); - }; - - - $.fn.sparkline.options.prototype.getTagSetting = function(key) { - var val, i, prefix = this.tagOptionsPrefix; - if (prefix === false || prefix === undefined) { - return UNSET_OPTION; - } - if (this.tagValCache.hasOwnProperty(key)) { - val = this.tagValCache.key; - } else { - val = this.tag.getAttribute(prefix + key); - if (val === undefined || val === null) { - val = UNSET_OPTION; - } else if (val.substr(0, 1) == '[') { - val = val.substr(1, val.length-2).split(','); - for(i=val.length; i--;) { - val[i] = normalizeValue(val[i].replace(/(^\s*)|(\s*$)/g, '')); - } - } else if (val.substr(0, 1) == '{') { - var pairs= val.substr(1, val.length-2).split(','); - val = {}; - for(i=pairs.length; i--;) { - var keyval = pairs[i].split(':', 2); - val[keyval[0].replace(/(^\s*)|(\s*$)/g, '')] = normalizeValue(keyval[1].replace(/(^\s*)|(\s*$)/g, '')); - } - } else { - val = normalizeValue(val); - } - this.tagValCache.key = val; - } - return val; - }; - - $.fn.sparkline.options.prototype.get = function(key) { - var tagOption = this.getTagSetting(key); - if (tagOption !== UNSET_OPTION) { - return tagOption; - } - return this.mergedOptions[key]; - }; - - - /** - * Line charts - */ - $.fn.sparkline.line = function(values, options, width, height) { - var xvalues = [], yvalues = [], yminmax = []; - for (var i=0; imaxy) { - maxy = normalRangeMax; - } - } - if (options.get('chartRangeMin')!==undefined && (options.get('chartRangeClip') || options.get('chartRangeMin')maxy)) { - maxy = options.get('chartRangeMax'); - } - if (options.get('chartRangeMinX')!==undefined && (options.get('chartRangeClipX') || options.get('chartRangeMinX')maxx)) { - maxx = options.get('chartRangeMaxX'); - } - var rangex = maxx-minx === 0 ? 1 : maxx-minx; - var rangey = maxy-miny === 0 ? 1 : maxy-miny; - var vl = yvalues.length-1; - - if (vl<1) { - this.innerHTML = ''; - return; - } - - var target = $(this).simpledraw(width, height, options.get('composite')); - if (target) { - var canvas_width = target.pixel_width; - var canvas_height = target.pixel_height; - var canvas_top = 0; - var canvas_left = 0; - - var spotRadius = options.get('spotRadius'); - if (spotRadius && (canvas_width < (spotRadius*4) || canvas_height < (spotRadius*4))) { - spotRadius = 0; - } - if (spotRadius) { - // adjust the canvas size as required so that spots will fit - if (options.get('minSpotColor') || (options.get('spotColor') && yvalues[vl]==miny)) { - canvas_height -= Math.ceil(spotRadius); - } - if (options.get('maxSpotColor') || (options.get('spotColor') && yvalues[vl]==maxy)) { - canvas_height -= Math.ceil(spotRadius); - canvas_top += Math.ceil(spotRadius); - } - if (options.get('minSpotColor') || options.get('maxSpotColor') && (yvalues[0]==miny || yvalues[0]==maxy)) { - canvas_left += Math.ceil(spotRadius); - canvas_width -= Math.ceil(spotRadius); - } - if (options.get('spotColor') || (options.get('minSpotColor') || options.get('maxSpotColor') && (yvalues[vl]==miny||yvalues[vl]==maxy))) { - canvas_width -= Math.ceil(spotRadius); - } - } - - - canvas_height--; - - var drawNormalRange = function() { - if (normalRangeMin!==undefined) { - var ytop = canvas_top+Math.round(canvas_height-(canvas_height*((normalRangeMax-miny)/rangey))); - var height = Math.round((canvas_height*(normalRangeMax-normalRangeMin))/rangey); - target.drawRect(canvas_left, ytop, canvas_width, height, undefined, options.get('normalRangeColor')); - } - }; - - if (!options.get('drawNormalOnTop')) { - drawNormalRange(); - } - - var path = []; - var paths = [path]; - var x, y, vlen=yvalues.length; - for(i=0; i maxy) { - y=maxy; - } - if (!path.length) { - // previous value was null - path.push([canvas_left+Math.round((x-minx)*(canvas_width/rangex)), canvas_top+canvas_height]); - } - path.push([canvas_left+Math.round((x-minx)*(canvas_width/rangex)), canvas_top+Math.round(canvas_height-(canvas_height*((y-miny)/rangey)))]); - } - } - var lineshapes = []; - var fillshapes = []; - var plen=paths.length; - for(i=0; i2) { - // else we want the first value - path[0] = [ path[0][0], path[1][1] ]; - } - lineshapes.push(path); - } - - // draw the fill first, then optionally the normal range, then the line on top of that - plen = fillshapes.length; - for(i=0; imax)) { - max = options.get('chartRangeMax'); - } - var zeroAxis = options.get('zeroAxis'); - if (zeroAxis === undefined) { - zeroAxis = min<0; - } - var range = max-min === 0 ? 1 : max-min; - - var colorMapByIndex, colorMapByValue; - if ($.isArray(options.get('colorMap'))) { - colorMapByIndex = options.get('colorMap'); - colorMapByValue = null; - } else { - colorMapByIndex = null; - colorMapByValue = options.get('colorMap'); - } - - var target = $(this).simpledraw(width, height, options.get('composite')); - if (target) { - var color, - canvas_height = target.pixel_height, - yzero = min<0 && zeroAxis ? canvas_height-Math.round(canvas_height * (Math.abs(min)/range))-1 : canvas_height-1; - - for(i=values.length; i--;) { - var x = i*(options.get('barWidth')+options.get('barSpacing')), - y, - val = values[i]; - if (val===null) { - if (options.get('nullColor')) { - color = options.get('nullColor'); - val = (zeroAxis && min<0) ? 0 : min; - height = 1; - y = (zeroAxis && min<0) ? yzero : canvas_height - height; - } else { - continue; - } - } else { - if (val < min) { - val=min; - } - if (val > max) { - val=max; - } - color = (val < 0) ? options.get('negBarColor') : options.get('barColor'); - if (zeroAxis && min<0) { - height = Math.round(canvas_height*((Math.abs(val)/range)))+1; - y = (val < 0) ? yzero : yzero-height; - } else { - height = Math.round(canvas_height*((val-min)/range))+1; - y = canvas_height-height; - } - if (val===0 && options.get('zeroColor')!==undefined) { - color = options.get('zeroColor'); - } - if (colorMapByValue && colorMapByValue[val]) { - color = colorMapByValue[val]; - } else if (colorMapByIndex && colorMapByIndex.length>i) { - color = colorMapByIndex[i]; - } - if (color===null) { - continue; - } - } - target.drawRect(x, y, options.get('barWidth')-1, height-1, color, color); - } - } else { - // Remove the tag contents if sparklines aren't supported - this.innerHTML = ''; - } - }; - - - /** - * Tristate charts - */ - $.fn.sparkline.tristate = function(values, options, width, height) { - values = $.map(values, Number); - width = (values.length * options.get('barWidth')) + ((values.length-1) * options.get('barSpacing')); - - var colorMapByIndex, colorMapByValue; - if ($.isArray(options.get('colorMap'))) { - colorMapByIndex = options.get('colorMap'); - colorMapByValue = null; - } else { - colorMapByIndex = null; - colorMapByValue = options.get('colorMap'); - } - - var target = $(this).simpledraw(width, height, options.get('composite')); - if (target) { - var canvas_height = target.pixel_height, - half_height = Math.round(canvas_height/2); - - for(var i=values.length; i--;) { - var x = i*(options.get('barWidth')+options.get('barSpacing')), - y, color; - if (values[i] < 0) { - y = half_height; - height = half_height-1; - color = options.get('negBarColor'); - } else if (values[i] > 0) { - y = 0; - height = half_height-1; - color = options.get('posBarColor'); - } else { - y = half_height-1; - height = 2; - color = options.get('zeroBarColor'); - } - if (colorMapByValue && colorMapByValue[values[i]]) { - color = colorMapByValue[values[i]]; - } else if (colorMapByIndex && colorMapByIndex.length>i) { - color = colorMapByIndex[i]; - } - if (color===null) { - continue; - } - target.drawRect(x, y, options.get('barWidth')-1, height-1, color, color); - } - } else { - // Remove the tag contents if sparklines aren't supported - this.innerHTML = ''; - } - }; - - - /** - * Discrete charts - */ - $.fn.sparkline.discrete = function(values, options, width, height) { - values = $.map(values, Number); - width = options.get('width')=='auto' ? values.length*2 : width; - var interval = Math.floor(width / values.length); - - var target = $(this).simpledraw(width, height, options.get('composite')); - if (target) { - var canvas_height = target.pixel_height, - line_height = options.get('lineHeight') == 'auto' ? Math.round(canvas_height * 0.3) : options.get('lineHeight'), - pheight = canvas_height - line_height, - min = Math.min.apply(Math, values), - max = Math.max.apply(Math, values); - if (options.get('chartRangeMin')!==undefined && (options.get('chartRangeClip') || options.get('chartRangeMin')max)) { - max = options.get('chartRangeMax'); - } - var range = max-min; - - for(var i=values.length; i--;) { - var val = values[i]; - if (val < min) { - val=min; - } - if (val > max) { - val=max; - } - var x = (i*interval), - ytop = Math.round(pheight-pheight*((val-min)/range)); - target.drawLine(x, ytop, x, ytop+line_height, (options.get('thresholdColor') && val < options.get('thresholdValue')) ? options.get('thresholdColor') : options.get('lineColor')); - } - } else { - // Remove the tag contents if sparklines aren't supported - this.innerHTML = ''; - } - - }; - - - /** - * Bullet charts - */ - $.fn.sparkline.bullet = function(values, options, width, height) { - values = $.map(values, Number); - // target, performance, range1, range2, range3 - - width = options.get('width')=='auto' ? '4.0em' : width; - - var target = $(this).simpledraw(width, height, options.get('composite')); - if (target && values.length>1) { - var canvas_width = target.pixel_width-Math.ceil(options.get('targetWidth')/2), - canvas_height = target.pixel_height, - min = Math.min.apply(Math, values), - max = Math.max.apply(Math, values); - - if (options.get('base') === undefined) { - min = min < 0 ? min : 0; - } else { - min = options.get('base'); - } - var range = max-min; - - // draw range values - for(var i=2, vlen=values.length; i1) { - var canvas_width = target.pixel_width, - canvas_height = target.pixel_height, - radius = Math.floor(Math.min(canvas_width, canvas_height)/2), - total = 0, - next = 0, - circle = 2*Math.PI; - - for(var i=values.length; i--;) { - total += values[i]; - } - - if (options.get('offset')) { - next += (2*Math.PI)*(options.get('offset')/360); - } - var vlen = values.length; - for(i=0; i 0) { // avoid divide by zero - end = next + (circle*(values[i]/total)); - } - target.drawPieSlice(radius, radius, radius, start, end, undefined, options.get('sliceColors')[i % options.get('sliceColors').length]); - next = end; - } - } - }; - - - /** - * Box plots - */ - var quartile = function(values, q) { - if (q==2) { - var vl2 = Math.floor(values.length/2); - return values.length % 2 ? values[vl2] : (values[vl2]+values[vl2+1])/2; - } else { - var vl4 = Math.floor(values.length/4); - return values.length % 2 ? (values[vl4*q]+values[vl4*q+1])/2 : values[vl4*q]; - } - }; - - $.fn.sparkline.box = function(values, options, width, height) { - values = $.map(values, Number); - width = options.get('width')=='auto' ? '4.0em' : width; - - var minvalue = options.get('chartRangeMin')===undefined ? Math.min.apply(Math, values) : options.get('chartRangeMin'), - maxvalue = options.get('chartRangeMax')===undefined ? Math.max.apply(Math, values) : options.get('chartRangeMax'), - target = $(this).simpledraw(width, height, options.get('composite')), - vlen = values.length, - lwhisker, loutlier, q1, q2, q3, rwhisker, routlier; - - if (target && values.length>1) { - var canvas_width = target.pixel_width, - canvas_height = target.pixel_height; - if (options.get('raw')) { - if (options.get('showOutliers') && values.length>5) { - loutlier=values[0]; lwhisker=values[1]; q1=values[2]; q2=values[3]; q3=values[4]; rwhisker=values[5]; routlier=values[6]; - } else { - lwhisker=values[0]; q1=values[1]; q2=values[2]; q3=values[3]; rwhisker=values[4]; - } - } else { - values.sort(function(a, b) { return a-b; }); - q1 = quartile(values, 1); - q2 = quartile(values, 2); - q3 = quartile(values, 3); - var iqr = q3-q1; - if (options.get('showOutliers')) { - lwhisker=undefined; rwhisker=undefined; - for(var i=0; i q1-(iqr*options.get('outlierIQR'))) { - lwhisker = values[i]; - } - if (values[i] < q3+(iqr*options.get('outlierIQR'))) { - rwhisker = values[i]; - } - } - loutlier = values[0]; - routlier = values[vlen-1]; - } else { - lwhisker = values[0]; - rwhisker = values[vlen-1]; - } - } - - var unitsize = canvas_width / (maxvalue-minvalue+1), - canvas_left = 0; - if (options.get('showOutliers')) { - canvas_left = Math.ceil(options.get('spotRadius')); - canvas_width -= 2*Math.ceil(options.get('spotRadius')); - unitsize = canvas_width / (maxvalue-minvalue+1); - if (loutlier < lwhisker) { - target.drawCircle((loutlier-minvalue)*unitsize+canvas_left, canvas_height/2, options.get('spotRadius'), options.get('outlierLineColor'), options.get('outlierFillColor')); - } - if (routlier > rwhisker) { - target.drawCircle((routlier-minvalue)*unitsize+canvas_left, canvas_height/2, options.get('spotRadius'), options.get('outlierLineColor'), options.get('outlierFillColor')); - } - } - - // box - target.drawRect( - Math.round((q1-minvalue)*unitsize+canvas_left), - Math.round(canvas_height*0.1), - Math.round((q3-q1)*unitsize), - Math.round(canvas_height*0.8), - options.get('boxLineColor'), - options.get('boxFillColor')); - // left whisker - target.drawLine( - Math.round((lwhisker-minvalue)*unitsize+canvas_left), - Math.round(canvas_height/2), - Math.round((q1-minvalue)*unitsize+canvas_left), - Math.round(canvas_height/2), - options.get('lineColor')); - target.drawLine( - Math.round((lwhisker-minvalue)*unitsize+canvas_left), - Math.round(canvas_height/4), - Math.round((lwhisker-minvalue)*unitsize+canvas_left), - Math.round(canvas_height-canvas_height/4), - options.get('whiskerColor')); - // right whisker - target.drawLine(Math.round((rwhisker-minvalue)*unitsize+canvas_left), - Math.round(canvas_height/2), - Math.round((q3-minvalue)*unitsize+canvas_left), - Math.round(canvas_height/2), - options.get('lineColor')); - target.drawLine( - Math.round((rwhisker-minvalue)*unitsize+canvas_left), - Math.round(canvas_height/4), - Math.round((rwhisker-minvalue)*unitsize+canvas_left), - Math.round(canvas_height-canvas_height/4), - options.get('whiskerColor')); - // median line - target.drawLine( - Math.round((q2-minvalue)*unitsize+canvas_left), - Math.round(canvas_height*0.1), - Math.round((q2-minvalue)*unitsize+canvas_left), - Math.round(canvas_height*0.9), - options.get('medianColor')); - if (options.get('target')) { - var size = Math.ceil(options.get('spotRadius')); - target.drawLine( - Math.round((options.get('target')-minvalue)*unitsize+canvas_left), - Math.round((canvas_height/2)-size), - Math.round((options.get('target')-minvalue)*unitsize+canvas_left), - Math.round((canvas_height/2)+size), - options.get('targetColor')); - target.drawLine( - Math.round((options.get('target')-minvalue)*unitsize+canvas_left-size), - Math.round(canvas_height/2), - Math.round((options.get('target')-minvalue)*unitsize+canvas_left+size), - Math.round(canvas_height/2), - options.get('targetColor')); - } - } else { - // Remove the tag contents if sparklines aren't supported - this.innerHTML = ''; - } - }; - - - // Setup a very simple "virtual canvas" to make drawing the few shapes we need easier - // This is accessible as $(foo).simpledraw() - - if ($.browser.msie && !document.namespaces.v) { - document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', '#default#VML'); - } - - if ($.browser.hasCanvas === undefined) { - var t = document.createElement('canvas'); - $.browser.hasCanvas = t.getContext!==undefined; - } - - VCanvas_base = function(width, height, target) { - }; - - VCanvas_base.prototype = { - init : function(width, height, target) { - this.width = width; - this.height = height; - this.target = target; - if (target[0]) { - target=target[0]; - } - target.VCanvas = this; - }, - - drawShape : function(path, lineColor, fillColor, lineWidth) { - alert('drawShape not implemented'); - }, - - drawLine : function(x1, y1, x2, y2, lineColor, lineWidth) { - return this.drawShape([ [x1,y1], [x2,y2] ], lineColor, lineWidth); - }, - - drawCircle : function(x, y, radius, lineColor, fillColor) { - alert('drawCircle not implemented'); - }, - - drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) { - alert('drawPieSlice not implemented'); - }, - - drawRect : function(x, y, width, height, lineColor, fillColor) { - alert('drawRect not implemented'); - }, - - getElement : function() { - return this.canvas; - }, - - _insert : function(el, target) { - $(target).html(el); - } - }; - - VCanvas_canvas = function(width, height, target) { - return this.init(width, height, target); - }; - - VCanvas_canvas.prototype = $.extend(new VCanvas_base(), { - _super : VCanvas_base.prototype, - - init : function(width, height, target) { - this._super.init(width, height, target); - this.canvas = document.createElement('canvas'); - if (target[0]) { - target=target[0]; - } - target.VCanvas = this; - $(this.canvas).css({ display:'inline-block', width:width, height:height, verticalAlign:'top' }); - this._insert(this.canvas, target); - this.pixel_height = $(this.canvas).height(); - this.pixel_width = $(this.canvas).width(); - this.canvas.width = this.pixel_width; - this.canvas.height = this.pixel_height; - $(this.canvas).css({width: this.pixel_width, height: this.pixel_height}); - }, - - _getContext : function(lineColor, fillColor, lineWidth) { - var context = this.canvas.getContext('2d'); - if (lineColor !== undefined) { - context.strokeStyle = lineColor; - } - context.lineWidth = lineWidth===undefined ? 1 : lineWidth; - if (fillColor !== undefined) { - context.fillStyle = fillColor; - } - return context; - }, - - drawShape : function(path, lineColor, fillColor, lineWidth) { - var context = this._getContext(lineColor, fillColor, lineWidth); - context.beginPath(); - context.moveTo(path[0][0]+0.5, path[0][1]+0.5); - for(var i=1, plen=path.length; i'; - this.canvas.insertAdjacentHTML('beforeEnd', groupel); - this.group = $(this.canvas).children()[0]; - }, - - drawShape : function(path, lineColor, fillColor, lineWidth) { - var vpath = []; - for(var i=0, plen=path.length; i' + - ' '; - this.group.insertAdjacentHTML('beforeEnd', vel); - }, - - drawCircle : function(x, y, radius, lineColor, fillColor) { - x -= radius+1; - y -= radius+1; - var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="1" strokeColor="'+lineColor+'" '; - var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="'+fillColor+'" filled="true" '; - var vel = ''; - this.group.insertAdjacentHTML('beforeEnd', vel); - - }, - - drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) { - if (startAngle == endAngle) { - return; // VML seems to have problem when start angle equals end angle. - } - if ((endAngle - startAngle) == (2*Math.PI)) { - startAngle = 0.0; // VML seems to have a problem when drawing a full circle that doesn't start 0 - endAngle = (2*Math.PI); - } - - var startx = x + Math.round(Math.cos(startAngle) * radius); - var starty = y + Math.round(Math.sin(startAngle) * radius); - var endx = x + Math.round(Math.cos(endAngle) * radius); - var endy = y + Math.round(Math.sin(endAngle) * radius); - - // Prevent very small slices from being mistaken as a whole pie - if (startx==endx && starty==endy && (endAngle-startAngle) < Math.PI) { - return; - } - - var vpath = [ x-radius, y-radius, x+radius, y+radius, startx, starty, endx, endy ]; - var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="1" strokeColor="'+lineColor+'" '; - var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="'+fillColor+'" filled="true" '; - var vel = '' + - ' '; - this.group.insertAdjacentHTML('beforeEnd', vel); - }, - - drawRect : function(x, y, width, height, lineColor, fillColor) { - return this.drawShape( [ [x, y], [x, y+height], [x+width, y+height], [x+width, y], [x, y] ], lineColor, fillColor); - } - }); - -})(jQuery); diff -r 8c8fd6a5bba9 -r 638ad584ca27 server/src/remie/static/remie/js/jquery.sparkline.min.js --- a/server/src/remie/static/remie/js/jquery.sparkline.min.js Fri Sep 18 17:21:49 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* jquery.sparkline 1.6 - http://omnipotent.net/jquery.sparkline/ -** Licensed under the New BSD License - see above site for details */ - -(function($){var defaults={common:{type:'line',lineColor:'#00f',fillColor:'#cdf',defaultPixelsPerValue:3,width:'auto',height:'auto',composite:false,tagValuesAttribute:'values',tagOptionsPrefix:'spark',enableTagOptions:false},line:{spotColor:'#f80',spotRadius:1.5,minSpotColor:'#f80',maxSpotColor:'#f80',lineWidth:1,normalRangeMin:undefined,normalRangeMax:undefined,normalRangeColor:'#ccc',drawNormalOnTop:false,chartRangeMin:undefined,chartRangeMax:undefined,chartRangeMinX:undefined,chartRangeMaxX:undefined},bar:{barColor:'#00f',negBarColor:'#f44',zeroColor:undefined,nullColor:undefined,zeroAxis:undefined,barWidth:4,barSpacing:1,chartRangeMax:undefined,chartRangeMin:undefined,chartRangeClip:false,colorMap:undefined},tristate:{barWidth:4,barSpacing:1,posBarColor:'#6f6',negBarColor:'#f44',zeroBarColor:'#999',colorMap:{}},discrete:{lineHeight:'auto',thresholdColor:undefined,thresholdValue:0,chartRangeMax:undefined,chartRangeMin:undefined,chartRangeClip:false},bullet:{targetColor:'red',targetWidth:3,performanceColor:'blue',rangeColors:['#D3DAFE','#A8B6FF','#7F94FF'],base:undefined},pie:{sliceColors:['#f00','#0f0','#00f']},box:{raw:false,boxLineColor:'black',boxFillColor:'#cdf',whiskerColor:'black',outlierLineColor:'#333',outlierFillColor:'white',medianColor:'red',showOutliers:true,outlierIQR:1.5,spotRadius:1.5,target:undefined,targetColor:'#4a2',chartRangeMax:undefined,chartRangeMin:undefined}};var VCanvas_base,VCanvas_canvas,VCanvas_vml;$.fn.simpledraw=function(width,height,use_existing){if(use_existing&&this[0].VCanvas){return this[0].VCanvas;} -if(width===undefined){width=$(this).innerWidth();} -if(height===undefined){height=$(this).innerHeight();} -if($.browser.hasCanvas){return new VCanvas_canvas(width,height,this);}else if($.browser.msie){return new VCanvas_vml(width,height,this);}else{return false;}};var pending=[];$.fn.sparkline=function(uservalues,userOptions){return this.each(function(){var options=new $.fn.sparkline.options(this,userOptions);var render=function(){var values,width,height;if(uservalues==='html'||uservalues===undefined){var vals=this.getAttribute(options.get('tagValuesAttribute'));if(vals===undefined||vals===null){vals=$(this).html();} -values=vals.replace(/(^\s*\s*$)|\s+/g,'').split(',');}else{values=uservalues;} -width=options.get('width')=='auto'?values.length*options.get('defaultPixelsPerValue'):options.get('width');if(options.get('height')=='auto'){if(!options.get('composite')||!this.VCanvas){var tmp=document.createElement('span');tmp.innerHTML='a';$(this).html(tmp);height=$(tmp).innerHeight();$(tmp).remove();}}else{height=options.get('height');} -$.fn.sparkline[options.get('type')].call(this,values,options,width,height);};if(($(this).html()&&$(this).is(':hidden'))||($.fn.jquery<"1.3.0"&&$(this).parents().is(':hidden'))||!$(this).parents('body').length){pending.push([this,render]);}else{render.call(this);}});};$.fn.sparkline.defaults=defaults;$.sparkline_display_visible=function(){for(var i=pending.length-1;i>=0;i--){var el=pending[i][0];if($(el).is(':visible')&&!$(el).parents().is(':hidden')){pending[i][1].call(el);pending.splice(i,1);}}};var UNSET_OPTION={};var normalizeValue=function(val){switch(val){case'undefined':val=undefined;break;case'null':val=null;break;case'true':val=true;break;case'false':val=false;break;default:var nf=parseFloat(val);if(val==nf){val=nf;}} -return val;};$.fn.sparkline.options=function(tag,userOptions){var extendedOptions;this.userOptions=userOptions=userOptions||{};this.tag=tag;this.tagValCache={};var defaults=$.fn.sparkline.defaults;var base=defaults.common;this.tagOptionsPrefix=userOptions.enableTagOptions&&(userOptions.tagOptionsPrefix||base.tagOptionsPrefix);var tagOptionType=this.getTagSetting('type');if(tagOptionType===UNSET_OPTION){extendedOptions=defaults[userOptions.type||base.type];}else{extendedOptions=defaults[tagOptionType];} -this.mergedOptions=$.extend({},base,extendedOptions,userOptions);};$.fn.sparkline.options.prototype.getTagSetting=function(key){var val,i,prefix=this.tagOptionsPrefix;if(prefix===false||prefix===undefined){return UNSET_OPTION;} -if(this.tagValCache.hasOwnProperty(key)){val=this.tagValCache.key;}else{val=this.tag.getAttribute(prefix+key);if(val===undefined||val===null){val=UNSET_OPTION;}else if(val.substr(0,1)=='['){val=val.substr(1,val.length-2).split(',');for(i=val.length;i--;){val[i]=normalizeValue(val[i].replace(/(^\s*)|(\s*$)/g,''));}}else if(val.substr(0,1)=='{'){var pairs=val.substr(1,val.length-2).split(',');val={};for(i=pairs.length;i--;){var keyval=pairs[i].split(':',2);val[keyval[0].replace(/(^\s*)|(\s*$)/g,'')]=normalizeValue(keyval[1].replace(/(^\s*)|(\s*$)/g,''));}}else{val=normalizeValue(val);} -this.tagValCache.key=val;} -return val;};$.fn.sparkline.options.prototype.get=function(key){var tagOption=this.getTagSetting(key);if(tagOption!==UNSET_OPTION){return tagOption;} -return this.mergedOptions[key];};$.fn.sparkline.line=function(values,options,width,height){var xvalues=[],yvalues=[],yminmax=[];for(var i=0;imaxy){maxy=normalRangeMax;}} -if(options.get('chartRangeMin')!==undefined&&(options.get('chartRangeClip')||options.get('chartRangeMin')maxy)){maxy=options.get('chartRangeMax');} -if(options.get('chartRangeMinX')!==undefined&&(options.get('chartRangeClipX')||options.get('chartRangeMinX')maxx)){maxx=options.get('chartRangeMaxX');} -var rangex=maxx-minx===0?1:maxx-minx;var rangey=maxy-miny===0?1:maxy-miny;var vl=yvalues.length-1;if(vl<1){this.innerHTML='';return;} -var target=$(this).simpledraw(width,height,options.get('composite'));if(target){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;var canvas_top=0;var canvas_left=0;var spotRadius=options.get('spotRadius');if(spotRadius&&(canvas_width<(spotRadius*4)||canvas_height<(spotRadius*4))){spotRadius=0;} -if(spotRadius){if(options.get('minSpotColor')||(options.get('spotColor')&&yvalues[vl]==miny)){canvas_height-=Math.ceil(spotRadius);} -if(options.get('maxSpotColor')||(options.get('spotColor')&&yvalues[vl]==maxy)){canvas_height-=Math.ceil(spotRadius);canvas_top+=Math.ceil(spotRadius);} -if(options.get('minSpotColor')||options.get('maxSpotColor')&&(yvalues[0]==miny||yvalues[0]==maxy)){canvas_left+=Math.ceil(spotRadius);canvas_width-=Math.ceil(spotRadius);} -if(options.get('spotColor')||(options.get('minSpotColor')||options.get('maxSpotColor')&&(yvalues[vl]==miny||yvalues[vl]==maxy))){canvas_width-=Math.ceil(spotRadius);}} -canvas_height--;var drawNormalRange=function(){if(normalRangeMin!==undefined){var ytop=canvas_top+Math.round(canvas_height-(canvas_height*((normalRangeMax-miny)/rangey)));var height=Math.round((canvas_height*(normalRangeMax-normalRangeMin))/rangey);target.drawRect(canvas_left,ytop,canvas_width,height,undefined,options.get('normalRangeColor'));}};if(!options.get('drawNormalOnTop')){drawNormalRange();} -var path=[];var paths=[path];var x,y,vlen=yvalues.length;for(i=0;imaxy){y=maxy;} -if(!path.length){path.push([canvas_left+Math.round((x-minx)*(canvas_width/rangex)),canvas_top+canvas_height]);} -path.push([canvas_left+Math.round((x-minx)*(canvas_width/rangex)),canvas_top+Math.round(canvas_height-(canvas_height*((y-miny)/rangey)))]);}} -var lineshapes=[];var fillshapes=[];var plen=paths.length;for(i=0;i2){path[0]=[path[0][0],path[1][1]];} -lineshapes.push(path);} -plen=fillshapes.length;for(i=0;imax)){max=options.get('chartRangeMax');} -var zeroAxis=options.get('zeroAxis');if(zeroAxis===undefined){zeroAxis=min<0;} -var range=max-min===0?1:max-min;var colorMapByIndex,colorMapByValue;if($.isArray(options.get('colorMap'))){colorMapByIndex=options.get('colorMap');colorMapByValue=null;}else{colorMapByIndex=null;colorMapByValue=options.get('colorMap');} -var target=$(this).simpledraw(width,height,options.get('composite'));if(target){var color,canvas_height=target.pixel_height,yzero=min<0&&zeroAxis?canvas_height-Math.round(canvas_height*(Math.abs(min)/range))-1:canvas_height-1;for(i=values.length;i--;){var x=i*(options.get('barWidth')+options.get('barSpacing')),y,val=values[i];if(val===null){if(options.get('nullColor')){color=options.get('nullColor');val=(zeroAxis&&min<0)?0:min;height=1;y=(zeroAxis&&min<0)?yzero:canvas_height-height;}else{continue;}}else{if(valmax){val=max;} -color=(val<0)?options.get('negBarColor'):options.get('barColor');if(zeroAxis&&min<0){height=Math.round(canvas_height*((Math.abs(val)/range)))+1;y=(val<0)?yzero:yzero-height;}else{height=Math.round(canvas_height*((val-min)/range))+1;y=canvas_height-height;} -if(val===0&&options.get('zeroColor')!==undefined){color=options.get('zeroColor');} -if(colorMapByValue&&colorMapByValue[val]){color=colorMapByValue[val];}else if(colorMapByIndex&&colorMapByIndex.length>i){color=colorMapByIndex[i];} -if(color===null){continue;}} -target.drawRect(x,y,options.get('barWidth')-1,height-1,color,color);}}else{this.innerHTML='';}};$.fn.sparkline.tristate=function(values,options,width,height){values=$.map(values,Number);width=(values.length*options.get('barWidth'))+((values.length-1)*options.get('barSpacing'));var colorMapByIndex,colorMapByValue;if($.isArray(options.get('colorMap'))){colorMapByIndex=options.get('colorMap');colorMapByValue=null;}else{colorMapByIndex=null;colorMapByValue=options.get('colorMap');} -var target=$(this).simpledraw(width,height,options.get('composite'));if(target){var canvas_height=target.pixel_height,half_height=Math.round(canvas_height/2);for(var i=values.length;i--;){var x=i*(options.get('barWidth')+options.get('barSpacing')),y,color;if(values[i]<0){y=half_height;height=half_height-1;color=options.get('negBarColor');}else if(values[i]>0){y=0;height=half_height-1;color=options.get('posBarColor');}else{y=half_height-1;height=2;color=options.get('zeroBarColor');} -if(colorMapByValue&&colorMapByValue[values[i]]){color=colorMapByValue[values[i]];}else if(colorMapByIndex&&colorMapByIndex.length>i){color=colorMapByIndex[i];} -if(color===null){continue;} -target.drawRect(x,y,options.get('barWidth')-1,height-1,color,color);}}else{this.innerHTML='';}};$.fn.sparkline.discrete=function(values,options,width,height){values=$.map(values,Number);width=options.get('width')=='auto'?values.length*2:width;var interval=Math.floor(width/values.length);var target=$(this).simpledraw(width,height,options.get('composite'));if(target){var canvas_height=target.pixel_height,line_height=options.get('lineHeight')=='auto'?Math.round(canvas_height*0.3):options.get('lineHeight'),pheight=canvas_height-line_height,min=Math.min.apply(Math,values),max=Math.max.apply(Math,values);if(options.get('chartRangeMin')!==undefined&&(options.get('chartRangeClip')||options.get('chartRangeMin')max)){max=options.get('chartRangeMax');} -var range=max-min;for(var i=values.length;i--;){var val=values[i];if(valmax){val=max;} -var x=(i*interval),ytop=Math.round(pheight-pheight*((val-min)/range));target.drawLine(x,ytop,x,ytop+line_height,(options.get('thresholdColor')&&val1){var canvas_width=target.pixel_width-Math.ceil(options.get('targetWidth')/2),canvas_height=target.pixel_height,min=Math.min.apply(Math,values),max=Math.max.apply(Math,values);if(options.get('base')===undefined){min=min<0?min:0;}else{min=options.get('base');} -var range=max-min;for(var i=2,vlen=values.length;i1){var canvas_width=target.pixel_width,canvas_height=target.pixel_height,radius=Math.floor(Math.min(canvas_width,canvas_height)/2),total=0,next=0,circle=2*Math.PI;for(var i=values.length;i--;){total+=values[i];} -if(options.get('offset')){next+=(2*Math.PI)*(options.get('offset')/360);} -var vlen=values.length;for(i=0;i0){end=next+(circle*(values[i]/total));} -target.drawPieSlice(radius,radius,radius,start,end,undefined,options.get('sliceColors')[i%options.get('sliceColors').length]);next=end;}}};var quartile=function(values,q){if(q==2){var vl2=Math.floor(values.length/2);return values.length%2?values[vl2]:(values[vl2]+values[vl2+1])/2;}else{var vl4=Math.floor(values.length/4);return values.length%2?(values[vl4*q]+values[vl4*q+1])/2:values[vl4*q];}};$.fn.sparkline.box=function(values,options,width,height){values=$.map(values,Number);width=options.get('width')=='auto'?'4.0em':width;var minvalue=options.get('chartRangeMin')===undefined?Math.min.apply(Math,values):options.get('chartRangeMin'),maxvalue=options.get('chartRangeMax')===undefined?Math.max.apply(Math,values):options.get('chartRangeMax'),target=$(this).simpledraw(width,height,options.get('composite')),vlen=values.length,lwhisker,loutlier,q1,q2,q3,rwhisker,routlier;if(target&&values.length>1){var canvas_width=target.pixel_width,canvas_height=target.pixel_height;if(options.get('raw')){if(options.get('showOutliers')&&values.length>5){loutlier=values[0];lwhisker=values[1];q1=values[2];q2=values[3];q3=values[4];rwhisker=values[5];routlier=values[6];}else{lwhisker=values[0];q1=values[1];q2=values[2];q3=values[3];rwhisker=values[4];}}else{values.sort(function(a,b){return a-b;});q1=quartile(values,1);q2=quartile(values,2);q3=quartile(values,3);var iqr=q3-q1;if(options.get('showOutliers')){lwhisker=undefined;rwhisker=undefined;for(var i=0;iq1-(iqr*options.get('outlierIQR'))){lwhisker=values[i];} -if(values[i]rwhisker){target.drawCircle((routlier-minvalue)*unitsize+canvas_left,canvas_height/2,options.get('spotRadius'),options.get('outlierLineColor'),options.get('outlierFillColor'));}} -target.drawRect(Math.round((q1-minvalue)*unitsize+canvas_left),Math.round(canvas_height*0.1),Math.round((q3-q1)*unitsize),Math.round(canvas_height*0.8),options.get('boxLineColor'),options.get('boxFillColor'));target.drawLine(Math.round((lwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height/2),Math.round((q1-minvalue)*unitsize+canvas_left),Math.round(canvas_height/2),options.get('lineColor'));target.drawLine(Math.round((lwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height/4),Math.round((lwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height-canvas_height/4),options.get('whiskerColor'));target.drawLine(Math.round((rwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height/2),Math.round((q3-minvalue)*unitsize+canvas_left),Math.round(canvas_height/2),options.get('lineColor'));target.drawLine(Math.round((rwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height/4),Math.round((rwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height-canvas_height/4),options.get('whiskerColor'));target.drawLine(Math.round((q2-minvalue)*unitsize+canvas_left),Math.round(canvas_height*0.1),Math.round((q2-minvalue)*unitsize+canvas_left),Math.round(canvas_height*0.9),options.get('medianColor'));if(options.get('target')){var size=Math.ceil(options.get('spotRadius'));target.drawLine(Math.round((options.get('target')-minvalue)*unitsize+canvas_left),Math.round((canvas_height/2)-size),Math.round((options.get('target')-minvalue)*unitsize+canvas_left),Math.round((canvas_height/2)+size),options.get('targetColor'));target.drawLine(Math.round((options.get('target')-minvalue)*unitsize+canvas_left-size),Math.round(canvas_height/2),Math.round((options.get('target')-minvalue)*unitsize+canvas_left+size),Math.round(canvas_height/2),options.get('targetColor'));}}else{this.innerHTML='';}};if($.browser.msie&&!document.namespaces.v){document.namespaces.add('v','urn:schemas-microsoft-com:vml','#default#VML');} -if($.browser.hasCanvas===undefined){var t=document.createElement('canvas');$.browser.hasCanvas=t.getContext!==undefined;} -VCanvas_base=function(width,height,target){};VCanvas_base.prototype={init:function(width,height,target){this.width=width;this.height=height;this.target=target;if(target[0]){target=target[0];} -target.VCanvas=this;},drawShape:function(path,lineColor,fillColor,lineWidth){alert('drawShape not implemented');},drawLine:function(x1,y1,x2,y2,lineColor,lineWidth){return this.drawShape([[x1,y1],[x2,y2]],lineColor,lineWidth);},drawCircle:function(x,y,radius,lineColor,fillColor){alert('drawCircle not implemented');},drawPieSlice:function(x,y,radius,startAngle,endAngle,lineColor,fillColor){alert('drawPieSlice not implemented');},drawRect:function(x,y,width,height,lineColor,fillColor){alert('drawRect not implemented');},getElement:function(){return this.canvas;},_insert:function(el,target){$(target).html(el);}};VCanvas_canvas=function(width,height,target){return this.init(width,height,target);};VCanvas_canvas.prototype=$.extend(new VCanvas_base(),{_super:VCanvas_base.prototype,init:function(width,height,target){this._super.init(width,height,target);this.canvas=document.createElement('canvas');if(target[0]){target=target[0];} -target.VCanvas=this;$(this.canvas).css({display:'inline-block',width:width,height:height,verticalAlign:'top'});this._insert(this.canvas,target);this.pixel_height=$(this.canvas).height();this.pixel_width=$(this.canvas).width();this.canvas.width=this.pixel_width;this.canvas.height=this.pixel_height;$(this.canvas).css({width:this.pixel_width,height:this.pixel_height});},_getContext:function(lineColor,fillColor,lineWidth){var context=this.canvas.getContext('2d');if(lineColor!==undefined){context.strokeStyle=lineColor;} -context.lineWidth=lineWidth===undefined?1:lineWidth;if(fillColor!==undefined){context.fillStyle=fillColor;} -return context;},drawShape:function(path,lineColor,fillColor,lineWidth){var context=this._getContext(lineColor,fillColor,lineWidth);context.beginPath();context.moveTo(path[0][0]+0.5,path[0][1]+0.5);for(var i=1,plen=path.length;i';this.canvas.insertAdjacentHTML('beforeEnd',groupel);this.group=$(this.canvas).children()[0];},drawShape:function(path,lineColor,fillColor,lineWidth){var vpath=[];for(var i=0,plen=path.length;i'+' ';this.group.insertAdjacentHTML('beforeEnd',vel);},drawCircle:function(x,y,radius,lineColor,fillColor){x-=radius+1;y-=radius+1;var stroke=lineColor===undefined?' stroked="false" ':' strokeWeight="1" strokeColor="'+lineColor+'" ';var fill=fillColor===undefined?' filled="false"':' fillColor="'+fillColor+'" filled="true" ';var vel='';this.group.insertAdjacentHTML('beforeEnd',vel);},drawPieSlice:function(x,y,radius,startAngle,endAngle,lineColor,fillColor){if(startAngle==endAngle){return;} -if((endAngle-startAngle)==(2*Math.PI)){startAngle=0.0;endAngle=(2*Math.PI);} -var startx=x+Math.round(Math.cos(startAngle)*radius);var starty=y+Math.round(Math.sin(startAngle)*radius);var endx=x+Math.round(Math.cos(endAngle)*radius);var endy=y+Math.round(Math.sin(endAngle)*radius);if(startx==endx&&starty==endy&&(endAngle-startAngle)'+' ';this.group.insertAdjacentHTML('beforeEnd',vel);},drawRect:function(x,y,width,height,lineColor,fillColor){return this.drawShape([[x,y],[x,y+height],[x+width,y+height],[x+width,y],[x,y]],lineColor,fillColor);}});})(jQuery); \ No newline at end of file diff -r 8c8fd6a5bba9 -r 638ad584ca27 server/src/remie/static/remie/js/jquery.splitter.css --- a/server/src/remie/static/remie/js/jquery.splitter.css Fri Sep 18 17:21:49 2015 +0200 +++ b/server/src/remie/static/remie/js/jquery.splitter.css Fri Sep 18 18:01:36 2015 +0200 @@ -11,14 +11,14 @@ background-color: grey; cursor: col-resize; z-index:900; - width: 4px; + width: 7px; } .splitter_panel .hsplitter { background-color: #5F5F5F; cursor: row-resize; z-index: 800; - height: 4px; + height: 7px; } .splitter_panel .vsplitter.splitter-invisible, .splitter_panel .hsplitter.splitter-invisible { @@ -54,4 +54,4 @@ right: 0; bottom: 0; z-index: 1000; -} \ No newline at end of file +} diff -r 8c8fd6a5bba9 -r 638ad584ca27 server/src/remie/static/remie/js/jquery.splitter.js --- a/server/src/remie/static/remie/js/jquery.splitter.js Fri Sep 18 17:21:49 2015 +0200 +++ b/server/src/remie/static/remie/js/jquery.splitter.js Fri Sep 18 18:01:36 2015 +0200 @@ -1,278 +1,167 @@ /*! - * JQuery Spliter Plugin - * Copyright (C) 2010-2013 Jakub Jankiewicz + * jQuery JavaScript Library v1.4.4 + * http://jquery.com/ * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Thu Nov 11 19:04:53 2010 -0500 */ -(function($, undefined) { - var count = 0; - var splitter_id = null; - var splitters = []; - var current_splitter = null; - $.fn.split = function(options) { - var data = this.data('splitter'); - if (data) { - return data; - } - var panel_1; - var panel_2; - var settings = $.extend({ - limit: 100, - orientation: 'horizontal', - position: '50%', - invisible: false, - onDragStart: $.noop, - onDragEnd: $.noop, - onDrag: $.noop - }, options || {}); - this.settings = settings; - var cls; - var children = this.children(); - if (settings.orientation == 'vertical') { - panel_1 = children.first().addClass('left_panel'); - panel_2 = panel_1.next().addClass('right_panel'); - cls = 'vsplitter'; - } else if (settings.orientation == 'horizontal') { - panel_1 = children.first().addClass('top_panel') - panel_2 = panel_1.next().addClass('bottom_panel'); - cls = 'hsplitter'; - } - if (settings.invisible) { - cls += ' splitter-invisible'; - } - var width = this.width(); - var height = this.height(); - var id = count++; - this.addClass('splitter_panel'); - var splitter = $('
').addClass(cls).mouseenter(function() { - splitter_id = id; - }).mouseleave(function() { - splitter_id = null; - }).insertAfter(panel_1); - var position; - - function get_position(position) { - if (typeof position === 'number') { - return position; - } else if (typeof position === 'string') { - var match = position.match(/^([0-9]+)(px|%)$/); - if (match) { - if (match[2] == 'px') { - return +match[1]; - } else { - if (settings.orientation == 'vertical') { - return (width * +match[1]) / 100; - } else if (settings.orientation == 'horizontal') { - return (height * +match[1]) / 100; - } - } - } else { - //throw position + ' is invalid value'; - } - } else { - //throw 'position have invalid type'; - } - } - - var self = $.extend(this, { - refresh: function() { - var new_width = this.width(); - var new_height = this.height(); - if (width != new_width || height != new_height) { - width = this.width(); - height = this.height(); - self.position(position); - } - }, - position: (function() { - if (settings.orientation == 'vertical') { - return function(n, silent) { - if (n === undefined) { - return position; - } else { - position = get_position(n); - var sw = splitter.width(); - var sw2 = sw/2; - if (settings.invisible) { - var pw = panel_1.width(position).outerWidth(); - panel_2.width(self.width()-pw); - splitter.css('left', pw-sw2); - } else { - var pw = panel_1.width(position-sw2).outerWidth(); - panel_2.width(self.width()-pw-sw); - splitter.css('left', pw); - } - } - if (!silent) { - self.find('.splitter_panel').trigger('splitter.resize'); - } - return self; - }; - } else if (settings.orientation == 'horizontal') { - return function(n, silent) { - if (n === undefined) { - return position; - } else { - position = get_position(n); - var sw = splitter.height(); - var sw2 = sw/2; - if (settings.invisible) { - var pw = panel_1.height(position).outerHeight(); - panel_2.height(self.height()-pw); - splitter.css('top', pw-sw2); - } else { - var pw = panel_1.height(position-sw2).outerHeight(); - panel_2.height(self.height()-pw-sw); - splitter.css('top', pw); - } - } - if (!silent) { - self.find('.splitter_panel').trigger('splitter.resize'); - } - return self; - }; - } else { - return $.noop; - } - })(), - orientation: settings.orientation, - limit: settings.limit, - isActive: function() { - return splitter_id === id; - }, - destroy: function() { - self.removeClass('splitter_panel'); - splitter.unbind('mouseenter'); - splitter.unbind('mouseleave'); - if (settings.orientation == 'vertical') { - panel_1.removeClass('left_panel'); - panel_2.removeClass('right_panel'); - } else if (settings.orientation == 'horizontal') { - panel_1.removeClass('top_panel'); - panel_2.removeClass('bottom_panel'); - } - self.unbind('splitter.resize'); - self.find('.splitter_panel').trigger('splitter.resize'); - splitters[id] = null; - splitter.remove(); - var not_null = false; - for (var i=splitters.length; i--;) { - if (splitters[i] !== null) { - not_null = true; - break; - } - } - //remove document events when no splitters - if (!not_null) { - $(document.documentElement).unbind('.splitter'); - $(window).unbind('resize.splitter'); - self.data('splitter', null); - splitters = []; - count = 0; - } - } - }); - self.bind('splitter.resize', function(e) { - var pos = self.position(); - if (self.orientation == 'vertical' && - pos > self.width()) { - pos = self.width() - self.limit-1; - } else if (self.orientation == 'horizontal' && - pos > self.height()) { - pos = self.height() - self.limit-1; - } - if (pos < self.limit) { - pos = self.limit + 1; - } - self.position(pos, true); - }); - //inital position of splitter - var pos; - if (settings.orientation == 'vertical') { - if (pos > width-settings.limit) { - pos = width-settings.limit; - } else { - pos = get_position(settings.position); - } - } else if (settings.orientation == 'horizontal') { - //position = height/2; - if (pos > height-settings.limit) { - pos = height-settings.limit; - } else { - pos = get_position(settings.position); - } - } - if (pos < settings.limit) { - pos = settings.limit; - } - self.position(pos, true); - if (splitters.length == 0) { // first time bind events to document - $(window).bind('resize.splitter', function() { - $.each(splitters, function(i, splitter) { - splitter.refresh(); - }); - }); - $(document.documentElement).bind('mousedown.splitter', function(e) { - if (splitter_id !== null && e.which == 1) { - current_splitter = splitters[splitter_id]; - $('
').css('cursor', splitter.css('cursor')).insertAfter(current_splitter); - current_splitter.settings.onDragStart(e); - return false; - } - }).bind('mouseup.splitter', function(e) { - if (current_splitter) { - $('.splitterMask').remove(); - current_splitter.settings.onDragEnd(e); - current_splitter = null; - } - }).bind('mousemove.splitter', function(e) { - if (current_splitter !== null) { - var limit = current_splitter.limit; - var offset = current_splitter.offset(); - if (current_splitter.orientation == 'vertical') { - var x = e.pageX - offset.left; - if (x <= current_splitter.limit) { - x = current_splitter.limit + 1; - } else if (x >= current_splitter.width() - limit) { - x = current_splitter.width() - limit - 1; - } - if (x > current_splitter.limit && - x < current_splitter.width()-limit) { - current_splitter.position(x, true); - current_splitter.trigger('splitter.resize'); - e.preventDefault(); - } - } else if (current_splitter.orientation == 'horizontal') { - var y = e.pageY-offset.top; - if (y <= current_splitter.limit) { - y = current_splitter.limit + 1; - } else if (y >= current_splitter.height() - limit) { - y = current_splitter.height() - limit - 1; - } - if (y > current_splitter.limit && - y < current_splitter.height()-limit) { - current_splitter.position(y, true); - current_splitter.trigger('splitter.resize'); - e.preventDefault(); - } - } - current_splitter.settings.onDrag(e); - } - }); - } - splitters.push(self); - self.data('splitter', self); - return self; - }; -})(jQuery); +(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h= +h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;kd)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La, +"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this, +e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a, +"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+ +a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/, +C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j, +s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this, +j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length}, +toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j=== +-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false; +if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload", +b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&& +!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&& +l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H
a";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"), +k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false, +scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent= +false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom= +1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="
";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="
t
";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display= +"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h= +c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando); +else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one"; +if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true}, +attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&& +b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0}; +c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem, +arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid= +d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+ +c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType=== +8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k=== +"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+ +d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired= +B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type=== +"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]=== +0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}}); +(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3]; +break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr, +q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h= +l;g.sort(w);if(h)for(var i=1;i0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n, +m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled=== +true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"=== +g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return in[3]-0},nth:function(g,i,n){return n[3]- +0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()=== +i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]]; +if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m, +g);else if(typeof g.length==="number")for(var p=g.length;n";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g); +n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&& +function(){var g=k,i=t.createElement("div");i.innerHTML="

";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F|| +p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g= +t.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition? +function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n0)for(var h=d;h0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h= +h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context): +c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a, +2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a, +b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&& +e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/\s]+\/)>/g,P={option:[1, +""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null; +else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1>");try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append", +prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument|| +b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]===""&&!x?r.childNodes:[];for(o=k.length- +1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script")))); +d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i, +jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true, +zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b), +h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b); +if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f= +d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left; +e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/)<[^<]*)*<\/script>/gi, +ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b=== +"object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("
").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&& +!this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})}, +getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html", +script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data|| +!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache= +false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset; +A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type", +b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&& +c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d|| +c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]= +encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess", +[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"), +e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}}); +if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show", +3),a,b,d);else{d=0;for(var e=this.length;d=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b, +d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a* +Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)} +var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true; +this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide|| +this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a= +c.timers,b=0;b-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a, +e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&& +c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase(); +c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+ +b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window); diff -r 8c8fd6a5bba9 -r 638ad584ca27 server/src/remie/static/remie/js/jquery.textchange.min.js --- a/server/src/remie/static/remie/js/jquery.textchange.min.js Fri Sep 18 17:21:49 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -/*! - * jQuery TextChange Plugin - * http://www.zurb.com/playground/jquery-text-change-custom-event - * - * Copyright 2010, ZURB - * Released under the MIT License - */ - (function(a){a.event.special.textchange={setup:function(){a(this).data("lastValue",this.contentEditable==="true"?a(this).html():a(this).val());a(this).bind("keyup.textchange",a.event.special.textchange.handler);a(this).bind("cut.textchange paste.textchange input.textchange",a.event.special.textchange.delayedHandler)},teardown:function(){a(this).unbind(".textchange")},handler:function(){a.event.special.textchange.triggerIfChanged(a(this))},delayedHandler:function(){var b=a(this);setTimeout(function(){a.event.special.textchange.triggerIfChanged(b)}, - 25)},triggerIfChanged:function(b){var c=b[0].contentEditable==="true"?b.html():b.val();if(c!==b.data("lastValue")){b.trigger("textchange",b.data("lastValue"));b.data("lastValue",c)}}};a.event.special.hastext={setup:function(){a(this).bind("textchange",a.event.special.hastext.handler)},teardown:function(){a(this).unbind("textchange",a.event.special.hastext.handler)},handler:function(b,c){c===""&&c!==a(this).val()&&a(this).trigger("hastext")}};a.event.special.notext={setup:function(){a(this).bind("textchange", - a.event.special.notext.handler)},teardown:function(){a(this).unbind("textchange",a.event.special.notext.handler)},handler:function(b,c){a(this).val()===""&&a(this).val()!==c&&a(this).trigger("notext")}}})(jQuery); \ No newline at end of file diff -r 8c8fd6a5bba9 -r 638ad584ca27 server/src/remie/static/remie/js/jquery.tools.min.js --- a/server/src/remie/static/remie/js/jquery.tools.min.js Fri Sep 18 17:21:49 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* - * jQuery Tools 1.2.4 - The missing UI library for the Web - * - * [toolbox.flashembed, toolbox.history, toolbox.expose, toolbox.mousewheel, tabs, tabs.slideshow, tooltip, tooltip.slide, tooltip.dynamic, scrollable, scrollable.autoscroll, scrollable.navigator, overlay, overlay.apple, dateinput, rangeinput, validator] - * - * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE. - * - * http://flowplayer.org/tools/ - * - * jquery.event.wheel.js - rev 1 - * Copyright (c) 2008, Three Dub Media (http://threedubmedia.com) - * Liscensed under the MIT License (MIT-LICENSE.txt) - * http://www.opensource.org/licenses/mit-license.php - * Created: 2008-07-01 | Updated: 2008-07-14 - * - * ----- - * - * File generated: Wed Aug 18 09:10:10 GMT 2010 - */ -(function(){function f(a,b){if(b)for(var c in b)if(b.hasOwnProperty(c))a[c]=b[c];return a}function l(a,b){var c=[];for(var d in a)if(a.hasOwnProperty(d))c[d]=b(a[d]);return c}function m(a,b,c){if(e.isSupported(b.version))a.innerHTML=e.getHTML(b,c);else if(b.expressInstall&&e.isSupported([6,65]))a.innerHTML=e.getHTML(f(b,{src:b.expressInstall}),{MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title});else{if(!a.innerHTML.replace(/\s/g,"")){a.innerHTML="

Flash version "+b.version+ -" or greater is required

"+(g[0]>0?"Your version is "+g:"You have no flash plugin installed")+"

"+(a.tagName=="A"?"

Click here to download latest version

":"

Download latest version from here

");if(a.tagName=="A")a.onclick=function(){location.href=k}}if(b.onFail){var d=b.onFail.call(this);if(typeof d=="string")a.innerHTML=d}}if(i)window[b.id]=document.getElementById(b.id);f(this,{getRoot:function(){return a},getOptions:function(){return b},getConf:function(){return c}, -getApi:function(){return a.firstChild}})}var i=document.all,k="http://www.adobe.com/go/getflashplayer",n=typeof jQuery=="function",o=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,j={width:"100%",height:"100%",id:"_"+(""+Math.random()).slice(9),allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:[3,0],onFail:null,expressInstall:null,w3c:false,cachebusting:false};window.attachEvent&&window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}}); -window.flashembed=function(a,b,c){if(typeof a=="string")a=document.getElementById(a.replace("#",""));if(a){if(typeof b=="string")b={src:b};return new m(a,f(f({},j),b),c)}};var e=f(window.flashembed,{conf:j,getVersion:function(){var a,b;try{b=navigator.plugins["Shockwave Flash"].description.slice(16)}catch(c){try{b=(a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"))&&a.GetVariable("$version")}catch(d){try{b=(a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"))&&a.GetVariable("$version")}catch(h){}}}return(b= -o.exec(b))?[b[1],b[3]]:[0,0]},asString:function(a){if(a===null||a===undefined)return null;var b=typeof a;if(b=="object"&&a.push)b="array";switch(b){case "string":a=a.replace(new RegExp('(["\\\\])',"g"),"\\$1");a=a.replace(/^\s?(\d+\.?\d+)%/,"$1pct");return'"'+a+'"';case "array":return"["+l(a,function(d){return e.asString(d)}).join(",")+"]";case "function":return'"function()"';case "object":b=[];for(var c in a)a.hasOwnProperty(c)&&b.push('"'+c+'":'+e.asString(a[c]));return"{"+b.join(",")+"}"}return String(a).replace(/\s/g, -" ").replace(/\'/g,'"')},getHTML:function(a,b){a=f({},a);var c='';a.width=a.height=a.id=a.w3c=a.src=null;a.onFail=a.version=a.expressInstall=null;for(var d in a)if(a[d])c+= -'';a="";if(b){for(var h in b)if(b[h]){d=b[h];a+=h+"="+(/function|object/.test(typeof d)?e.asString(d):d)+"&"}a=a.slice(0,-1);c+='"}c+="";return c},isSupported:function(a){return g[0]>a[0]||g[0]==a[0]&&g[1]>=a[1]}}),g=e.getVersion();if(n){jQuery.tools=jQuery.tools||{version:"1.2.4"};jQuery.tools.flashembed={conf:j};jQuery.fn.flashembed=function(a,b){return this.each(function(){$(this).data("flashembed",flashembed(this, -a,b))})}}})(); -(function(b){function h(c){if(c){var a=d.contentWindow.document;a.open().close();a.location.hash=c}}var g,d,f,i;b.tools=b.tools||{version:"1.2.4"};b.tools.history={init:function(c){if(!i){if(b.browser.msie&&b.browser.version<"8"){if(!d){d=b("