changeset 30 | a84ca4335d44 |
parent 0 | fd39db613f8b |
29:db7db4791ad0 | 30:a84ca4335d44 |
---|---|
1 /*! |
1 /*! |
2 |
2 |
3 Flowplayer v6.0.3 (Thursday, 23. July 2015 09:32PM) | flowplayer.org/license |
3 Flowplayer v6.0.5 (Wednesday, 13. January 2016 09:17AM) | flowplayer.org/license |
4 |
4 |
5 */ |
5 */ |
6 /*! (C) WebReflection Mit Style License */ |
6 /*! (C) WebReflection Mit Style License */ |
7 (function(e){function m(e,t,n,r){for(var i,s=n.slice(),o=b(t,e),u=0,a=s.length;u<a;u++){handler=s[u],typeof handler=="object"&&typeof handler.handleEvent=="function"?handler.handleEvent(o):handler.call(e,o);if(o.stoppedImmediatePropagation)break}return i=!o.stoppedPropagation,r&&i&&e.parentNode?e.parentNode.dispatchEvent(o):!o.defaultPrevented}function g(e,t){return{configurable:!0,get:e,set:t}}function y(e,t,n){var r=a(t||e,n);o(e,"textContent",g(function(){return r.get.call(this)},function(e){r.set.call(this,e)}))}function b(e,t){return e.currentTarget=t,e.eventPhase=e.target===e.currentTarget?2:3,e}function w(e,t){var n=e.length;while(n--&&e[n]!==t);return n}function E(){if(this.tagName==="BR")return"\n";var e=this.firstChild,t=[];while(e)e.nodeType!==8&&e.nodeType!==7&&t.push(e.textContent),e=e.nextSibling;return t.join("")}function S(e){return e.nodeType!==9&&document.documentElement.contains(e)}function x(e){var t=document.createEvent("Event");t.initEvent("input",!0,!0),(e.srcElement||e.fromElement||document).dispatchEvent(t)}function T(e){!n&&p.test(document.readyState)&&(n=!n,document.detachEvent(r,T),e=document.createEvent("Event"),e.initEvent(i,!0,!0),document.dispatchEvent(e))}function N(e){var t;while(t=this.lastChild)this.removeChild(t);e!=null&&this.appendChild(document.createTextNode(e))}function C(t,n){return n||(n=e.event),n.target||(n.target=n.srcElement||n.fromElement||document),n.timeStamp||(n.timeStamp=(new Date).getTime()),n}if(document.createEvent)return;var t=!0,n=!1,r="onreadystatechange",i="DOMContentLoaded",s="__IE8__"+Math.random(),o=Object.defineProperty||function(e,t,n){e[t]=n.value},u=Object.defineProperties||function(t,n){for(var r in n)if(f.call(n,r))try{o(t,r,n[r])}catch(i){e.console&&console.log(r+" failed on object:",t,i.message)}},a=Object.getOwnPropertyDescriptor,f=Object.prototype.hasOwnProperty,l=e.Element.prototype,c=e.Text.prototype,h=/^[a-z]+$/,p=/loaded|complete/,d={},v=document.createElement("div");y(e.HTMLCommentElement.prototype,l,"nodeValue"),y(e.HTMLScriptElement.prototype,null,"text"),y(c,null,"nodeValue"),y(e.HTMLTitleElement.prototype,null,"text"),o(e.HTMLStyleElement.prototype,"textContent",function(e){return g(function(){return e.get.call(this.styleSheet)},function(t){e.set.call(this.styleSheet,t)})}(a(e.CSSStyleSheet.prototype,"cssText"))),u(l,{textContent:{get:E,set:N},firstElementChild:{get:function(){for(var e=this.childNodes||[],t=0,n=e.length;t<n;t++)if(e[t].nodeType==1)return e[t]}},lastElementChild:{get:function(){for(var e=this.childNodes||[],t=e.length;t--;)if(e[t].nodeType==1)return e[t]}},oninput:{get:function(){return this._oninput||null},set:function(e){this._oninput&&(this.removeEventListener("input",this._oninput),this._oninput=e,e&&this.addEventListener("input",e))}},previousElementSibling:{get:function(){var e=this.previousSibling;while(e&&e.nodeType!=1)e=e.previousSibling;return e}},nextElementSibling:{get:function(){var e=this.nextSibling;while(e&&e.nodeType!=1)e=e.nextSibling;return e}},childElementCount:{get:function(){for(var e=0,t=this.childNodes||[],n=t.length;n--;e+=t[n].nodeType==1);return e}},addEventListener:{value:function(e,t,n){var r=this,i="on"+e,u=r[s]||o(r,s,{value:{}})[s],a=u[i]||(u[i]={}),l=a.h||(a.h=[]),c;if(!f.call(a,"w")){a.w=function(e){return e[s]||m(r,C(r,e),l,!1)};if(!f.call(d,i))if(h.test(e))try{c=document.createEventObject(),c[s]=!0,r.nodeType!=9&&r.parentNode==null&&v.appendChild(r),r.fireEvent(i,c),d[i]=!0}catch(c){d[i]=!1;while(v.hasChildNodes())v.removeChild(v.firstChild)}else d[i]=!1;(a.n=d[i])&&r.attachEvent(i,a.w)}w(l,t)<0&&l[n?"unshift":"push"](t),e==="input"&&r.attachEvent("onkeyup",x)}},dispatchEvent:{value:function(e){var t=this,n="on"+e.type,r=t[s],i=r&&r[n],o=!!i,u;return e.target||(e.target=t),o?i.n?t.fireEvent(n,e):m(t,e,i.h,!0):(u=t.parentNode)?u.dispatchEvent(e):!0,!e.defaultPrevented}},removeEventListener:{value:function(e,t,n){var r=this,i="on"+e,o=r[s],u=o&&o[i],a=u&&u.h,f=a?w(a,t):-1;-1<f&&a.splice(f,1)}}}),u(c,{addEventListener:{value:l.addEventListener},dispatchEvent:{value:l.dispatchEvent},removeEventListener:{value:l.removeEventListener}}),u(e.XMLHttpRequest.prototype,{addEventListener:{value:function(e,t,n){var r=this,i="on"+e,u=r[s]||o(r,s,{value:{}})[s],a=u[i]||(u[i]={}),f=a.h||(a.h=[]);w(f,t)<0&&(r[i]||(r[i]=function(){var t=document.createEvent("Event");t.initEvent(e,!0,!0),r.dispatchEvent(t)}),f[n?"unshift":"push"](t))}},dispatchEvent:{value:function(e){var t=this,n="on"+e.type,r=t[s],i=r&&r[n],o=!!i;return o&&(i.n?t.fireEvent(n,e):m(t,e,i.h,!0))}},removeEventListener:{value:l.removeEventListener}}),u(e.Event.prototype,{bubbles:{value:!0,writable:!0},cancelable:{value:!0,writable:!0},preventDefault:{value:function(){this.cancelable&&(this.defaultPrevented=!0,this.returnValue=!1)}},stopPropagation:{value:function(){this.stoppedPropagation=!0,this.cancelBubble=!0}},stopImmediatePropagation:{value:function(){this.stoppedImmediatePropagation=!0,this.stopPropagation()}},initEvent:{value:function(e,t,n){this.type=e,this.bubbles=!!t,this.cancelable=!!n,this.bubbles||this.stopPropagation()}}}),u(e.HTMLDocument.prototype,{defaultView:{get:function(){return this.parentWindow}},textContent:{get:function(){return this.nodeType===11?E.call(this):null},set:function(e){this.nodeType===11&&N.call(this,e)}},addEventListener:{value:function(n,s,o){var u=this;l.addEventListener.call(u,n,s,o),t&&n===i&&!p.test(u.readyState)&&(t=!1,u.attachEvent(r,T),e==top&&function a(e){try{u.documentElement.doScroll("left"),T()}catch(t){setTimeout(a,50)}}())}},dispatchEvent:{value:l.dispatchEvent},removeEventListener:{value:l.removeEventListener},createEvent:{value:function(e){var t;if(e!=="Event")throw new Error("unsupported "+e);return t=document.createEventObject(),t.timeStamp=(new Date).getTime(),t}}}),u(e.Window.prototype,{getComputedStyle:{value:function(){function i(e){this._=e}function s(){}var e=/^(?:[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|))(?!px)[a-z%]+$/,t=/^(top|right|bottom|left)$/,n=/\-([a-z])/g,r=function(e,t){return t.toUpperCase()};return i.prototype.getPropertyValue=function(i){var s=this._,o=s.style,u=s.currentStyle,a=s.runtimeStyle,f,l,c;return i=(i==="float"?"style-float":i).replace(n,r),f=u?u[i]:o[i],e.test(f)&&!t.test(i)&&(l=o.left,c=a&&a.left,c&&(a.left=u.left),o.left=i==="fontSize"?"1em":f,f=o.pixelLeft+"px",o.left=l,c&&(a.left=c)),f==null?f:f+""||"auto"},s.prototype.getPropertyValue=function(){return null},function(e,t){return t?new s(e):new i(e)}}()},addEventListener:{value:function(t,n,r){var i=e,o="on"+t,u;i[o]||(i[o]=function(e){return m(i,C(i,e),u,!1)}),u=i[o][s]||(i[o][s]=[]),w(u,n)<0&&u[r?"unshift":"push"](n)}},dispatchEvent:{value:function(t){var n=e["on"+t.type];return n?n.call(e,t)!==!1&&!t.defaultPrevented:!0}},removeEventListener:{value:function(t,n,r){var i="on"+t,o=(e[i]||Object)[s],u=o?w(o,n):-1;-1<u&&o.splice(u,1)}}})})(this); |
7 (function(e){function g(e,t,n,r){for(var i,s=n.slice(),o=w(t,e),u=0,a=s.length;u<a;u++){handler=s[u],typeof handler=="object"&&typeof handler.handleEvent=="function"?handler.handleEvent(o):handler.call(e,o);if(o.stoppedImmediatePropagation)break}return i=!o.stoppedPropagation,r&&i&&e.parentNode?e.parentNode.dispatchEvent(o):!o.defaultPrevented}function y(e,t){return{configurable:!0,get:e,set:t}}function b(e,t,n){var r=f(t||e,n);u(e,"textContent",y(function(){return r.get.call(this)},function(e){r.set.call(this,e)}))}function w(e,t){return e.currentTarget=t,e.eventPhase=e.target===e.currentTarget?2:3,e}function E(e,t){var n=e.length;while(n--&&e[n]!==t);return n}function S(){if(this.tagName==="BR")return"\n";var e=this.firstChild,t=[];while(e)e.nodeType!==8&&e.nodeType!==7&&t.push(e.textContent),e=e.nextSibling;return t.join("")}function x(e){return e.nodeType!==9&&document.documentElement.contains(e)}function T(e){!n&&d.test(document.readyState)&&(n=!n,document.detachEvent(r,T),e=document.createEvent("Event"),e.initEvent(i,!0,!0),document.dispatchEvent(e))}function N(e){var t;while(t=this.lastChild)this.removeChild(t);e!=null&&this.appendChild(document.createTextNode(e))}function C(t,n){return n||(n=e.event),n.target||(n.target=n.srcElement||n.fromElement||document),n.timeStamp||(n.timeStamp=(new Date).getTime()),n}if(document.createEvent)return;var t=!0,n=!1,r="onreadystatechange",i="DOMContentLoaded",s="__IE8__"+Math.random(),o=e.Object,u=o.defineProperty||function(e,t,n){e[t]=n.value},a=o.defineProperties||function(t,n){for(var r in n)if(l.call(n,r))try{u(t,r,n[r])}catch(i){e.console&&console.log(r+" failed on object:",t,i.message)}},f=o.getOwnPropertyDescriptor,l=o.prototype.hasOwnProperty,c=e.Element.prototype,h=e.Text.prototype,p=/^[a-z]+$/,d=/loaded|complete/,v={},m=document.createElement("div");b(e.HTMLCommentElement.prototype,c,"nodeValue"),b(e.HTMLScriptElement.prototype,null,"text"),b(h,null,"nodeValue"),b(e.HTMLTitleElement.prototype,null,"text"),u(e.HTMLStyleElement.prototype,"textContent",function(e){return y(function(){return e.get.call(this.styleSheet)},function(t){e.set.call(this.styleSheet,t)})}(f(e.CSSStyleSheet.prototype,"cssText"))),a(c,{textContent:{get:S,set:N},firstElementChild:{get:function(){for(var e=this.childNodes||[],t=0,n=e.length;t<n;t++)if(e[t].nodeType==1)return e[t]}},lastElementChild:{get:function(){for(var e=this.childNodes||[],t=e.length;t--;)if(e[t].nodeType==1)return e[t]}},previousElementSibling:{get:function(){var e=this.previousSibling;while(e&&e.nodeType!=1)e=e.previousSibling;return e}},nextElementSibling:{get:function(){var e=this.nextSibling;while(e&&e.nodeType!=1)e=e.nextSibling;return e}},childElementCount:{get:function(){for(var e=0,t=this.childNodes||[],n=t.length;n--;e+=t[n].nodeType==1);return e}},addEventListener:{value:function(e,t,n){var r=this,i="on"+e,o=r[s]||u(r,s,{value:{}})[s],a=o[i]||(o[i]={}),f=a.h||(a.h=[]),c;if(!l.call(a,"w")){a.w=function(e){return e[s]||g(r,C(r,e),f,!1)};if(!l.call(v,i))if(p.test(e))try{c=document.createEventObject(),c[s]=!0,r.nodeType!=9&&r.parentNode==null&&m.appendChild(r),r.fireEvent(i,c),v[i]=!0}catch(c){v[i]=!1;while(m.hasChildNodes())m.removeChild(m.firstChild)}else v[i]=!1;(a.n=v[i])&&r.attachEvent(i,a.w)}E(f,t)<0&&f[n?"unshift":"push"](t)}},dispatchEvent:{value:function(e){var t=this,n="on"+e.type,r=t[s],i=r&&r[n],o=!!i,u;return e.target||(e.target=t),o?i.n?t.fireEvent(n,e):g(t,e,i.h,!0):(u=t.parentNode)?u.dispatchEvent(e):!0,!e.defaultPrevented}},removeEventListener:{value:function(e,t,n){var r=this,i="on"+e,o=r[s],u=o&&o[i],a=u&&u.h,f=a?E(a,t):-1;-1<f&&a.splice(f,1)}}}),a(h,{addEventListener:{value:c.addEventListener},dispatchEvent:{value:c.dispatchEvent},removeEventListener:{value:c.removeEventListener}}),a(e.XMLHttpRequest.prototype,{addEventListener:{value:function(e,t,n){var r=this,i="on"+e,o=r[s]||u(r,s,{value:{}})[s],a=o[i]||(o[i]={}),f=a.h||(a.h=[]);E(f,t)<0&&(r[i]||(r[i]=function(){var t=document.createEvent("Event");t.initEvent(e,!0,!0),r.dispatchEvent(t)}),f[n?"unshift":"push"](t))}},dispatchEvent:{value:function(e){var t=this,n="on"+e.type,r=t[s],i=r&&r[n],o=!!i;return o&&(i.n?t.fireEvent(n,e):g(t,e,i.h,!0))}},removeEventListener:{value:c.removeEventListener}}),a(e.Event.prototype,{bubbles:{value:!0,writable:!0},cancelable:{value:!0,writable:!0},preventDefault:{value:function(){this.cancelable&&(this.defaultPrevented=!0,this.returnValue=!1)}},stopPropagation:{value:function(){this.stoppedPropagation=!0,this.cancelBubble=!0}},stopImmediatePropagation:{value:function(){this.stoppedImmediatePropagation=!0,this.stopPropagation()}},initEvent:{value:function(e,t,n){this.type=e,this.bubbles=!!t,this.cancelable=!!n,this.bubbles||this.stopPropagation()}}}),a(e.HTMLDocument.prototype,{textContent:{get:function(){return this.nodeType===11?S.call(this):null},set:function(e){this.nodeType===11&&N.call(this,e)}},addEventListener:{value:function(n,s,o){var u=this;c.addEventListener.call(u,n,s,o),t&&n===i&&!d.test(u.readyState)&&(t=!1,u.attachEvent(r,T),e==top&&function a(e){try{u.documentElement.doScroll("left"),T()}catch(t){setTimeout(a,50)}}())}},dispatchEvent:{value:c.dispatchEvent},removeEventListener:{value:c.removeEventListener},createEvent:{value:function(e){var t;if(e!=="Event")throw new Error("unsupported "+e);return t=document.createEventObject(),t.timeStamp=(new Date).getTime(),t}}}),a(e.Window.prototype,{getComputedStyle:{value:function(){function i(e){this._=e}function s(){}var e=/^(?:[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|))(?!px)[a-z%]+$/,t=/^(top|right|bottom|left)$/,n=/\-([a-z])/g,r=function(e,t){return t.toUpperCase()};return i.prototype.getPropertyValue=function(i){var s=this._,o=s.style,u=s.currentStyle,a=s.runtimeStyle,f,l,c;return i=(i==="float"?"style-float":i).replace(n,r),f=u?u[i]:o[i],e.test(f)&&!t.test(i)&&(l=o.left,c=a&&a.left,c&&(a.left=u.left),o.left=i==="fontSize"?"1em":f,f=o.pixelLeft+"px",o.left=l,c&&(a.left=c)),f==null?f:f+""||"auto"},s.prototype.getPropertyValue=function(){return null},function(e,t){return t?new s(e):new i(e)}}()},addEventListener:{value:function(t,n,r){var i=e,o="on"+t,u;i[o]||(i[o]=function(e){return g(i,C(i,e),u,!1)}),u=i[o][s]||(i[o][s]=[]),E(u,n)<0&&u[r?"unshift":"push"](n)}},dispatchEvent:{value:function(t){var n=e["on"+t.type];return n?n.call(e,t)!==!1&&!t.defaultPrevented:!0}},removeEventListener:{value:function(t,n,r){var i="on"+t,u=(e[i]||o)[s],a=u?E(u,n):-1;-1<a&&u.splice(a,1)}}})})(this); |
8 !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.flowplayer=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ |
8 !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.flowplayer=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ |
9 'use strict'; |
9 'use strict'; |
10 var common = module.exports = {}, |
10 var common = module.exports = {}, |
11 ClassList = _dereq_('class-list'), |
11 ClassList = _dereq_('class-list'), |
12 $ = window.jQuery, |
12 $ = window.jQuery, |
39 |
39 |
40 common.hasClass = function(el, kls) { |
40 common.hasClass = function(el, kls) { |
41 return ClassList(el).contains(kls); |
41 return ClassList(el).contains(kls); |
42 }; |
42 }; |
43 |
43 |
44 common.isSameDomain = function(url) { |
|
45 var w = window.location, |
|
46 a = common.createElement('a', { href: url }); |
|
47 return w.hostname === a.hostname && |
|
48 w.protocol === a.protocol && |
|
49 w.port === a.port; |
|
50 }; |
|
44 |
51 |
45 common.css = function(el, property, value) { |
52 common.css = function(el, property, value) { |
46 if (typeof property === 'object') { |
53 if (typeof property === 'object') { |
47 return Object.keys(property).forEach(function(key) { |
54 return Object.keys(property).forEach(function(key) { |
48 common.css(el, key, property[key]); |
55 common.css(el, key, property[key]); |
289 } |
296 } |
290 |
297 |
291 })(window.CSSStyleDeclaration.prototype); |
298 })(window.CSSStyleDeclaration.prototype); |
292 |
299 |
293 },{"class-list":22,"computed-style":24,"punycode":21}],2:[function(_dereq_,module,exports){ |
300 },{"class-list":22,"computed-style":24,"punycode":21}],2:[function(_dereq_,module,exports){ |
294 /* global __flash_unloadHandler:true,__flash_savedUnloadHandler:true */ |
|
295 'use strict'; |
301 'use strict'; |
296 var common = _dereq_('../common'); |
302 var common = _dereq_('../common'); |
297 |
303 |
298 // movie required in opts |
304 // movie required in opts |
299 module.exports = function embed(swf, flashvars, wmode, bgColor) { |
305 module.exports = function embed(swf, flashvars, wmode, bgColor) { |
339 |
345 |
340 |
346 |
341 // Flash is buggy allover |
347 // Flash is buggy allover |
342 if (window.attachEvent) { |
348 if (window.attachEvent) { |
343 window.attachEvent("onbeforeunload", function() { |
349 window.attachEvent("onbeforeunload", function() { |
344 __flash_savedUnloadHandler = __flash_unloadHandler = function() {}; |
350 window.__flash_savedUnloadHandler = window.__flash_unloadHandler = function() {}; |
345 }); |
351 }); |
346 } |
352 } |
347 |
353 |
348 |
354 |
349 },{"../common":1}],3:[function(_dereq_,module,exports){ |
355 },{"../common":1}],3:[function(_dereq_,module,exports){ |
369 var engine = { |
375 var engine = { |
370 engineName: engineImpl.engineName, |
376 engineName: engineImpl.engineName, |
371 |
377 |
372 pick: function(sources) { |
378 pick: function(sources) { |
373 |
379 |
374 if (flowplayer.support.flashVideo) { |
380 var source = extend({}, (function() { |
381 if (flowplayer.support.flashVideo) { |
|
375 var selectedSource; |
382 var selectedSource; |
376 for (var i = 0, source; i < sources.length; i++) { |
383 for (var i = 0, source; i < sources.length; i++) { |
377 source = sources[i]; |
384 source = sources[i]; |
378 if (/mp4|flv|flash/i.test(source.type)) selectedSource = source; |
385 if (/mp4|flv|flash/i.test(source.type)) selectedSource = source; |
379 if (player.conf.swfHls && /mpegurl/i.test(source.type)) selectedSource = source; |
386 if (player.conf.swfHls && /mpegurl/i.test(source.type)) selectedSource = source; |
380 if (selectedSource && !/mp4/i.test(selectedSource.type)) return selectedSource; |
387 if (selectedSource && !/mp4/i.test(selectedSource.type)) return selectedSource; |
381 // Did not find any source or source was video/mp4, let's try find more |
388 // Did not find any source or source was video/mp4, let's try find more |
382 } |
389 } |
383 return selectedSource; // Accept the fact we don't have anything or just an MP4 |
390 return selectedSource; // Accept the fact we don't have anything or just an MP4 |
384 } |
391 } |
392 })()); |
|
393 if (!source) return; |
|
394 if (source.src && !isAbsolute(source.src) && !player.conf.rtmp && !source.rtmp) source.src = common.createAbsoluteUrl(source.src); |
|
395 return source; |
|
385 }, |
396 }, |
386 |
397 |
387 load: function(video) { |
398 load: function(video) { |
388 loadVideo = video; |
399 loadVideo = video; |
389 |
400 |
390 function escapeURL(url) { |
401 function escapeURL(url) { |
391 return url.replace(/&/g, '%26').replace(/&/g, '%26').replace(/=/g, '%3D'); |
402 return url.replace(/&/g, '%26').replace(/&/g, '%26').replace(/=/g, '%3D'); |
392 } |
403 } |
393 |
404 |
394 var html5Tag = common.findDirect('video', root)[0] || common.find('.fp-player > video', root)[0], |
405 var html5Tag = common.findDirect('video', root)[0] || common.find('.fp-player > video', root)[0], |
395 url = escapeURL(video.src), |
406 url = video.src, |
396 is_absolute = /^https?:/.test(url); |
407 is_absolute = isAbsolute(url); |
397 |
408 |
398 var removeTag = function() { |
409 var removeTag = function() { |
399 common.removeNode(html5Tag); |
410 common.removeNode(html5Tag); |
400 }; |
411 }; |
401 var hasSupportedSource = function(sources) { |
412 var hasSupportedSource = function(sources) { |
432 api.__play(url, providerChangeNeeded || video.rtmp && video.rtmp !== conf.rtmp); |
443 api.__play(url, providerChangeNeeded || video.rtmp && video.rtmp !== conf.rtmp); |
433 |
444 |
434 } else { |
445 } else { |
435 |
446 |
436 callbackId = "fpCallback" + ("" + Math.random()).slice(3, 15); |
447 callbackId = "fpCallback" + ("" + Math.random()).slice(3, 15); |
448 url = escapeURL(url); |
|
437 |
449 |
438 var opts = { |
450 var opts = { |
439 hostname: conf.embedded ? common.hostname(conf.hostname) : common.hostname(location.hostname), |
451 hostname: conf.embedded ? common.hostname(conf.hostname) : common.hostname(location.hostname), |
440 url: url, |
452 url: url, |
441 callback: callbackId |
453 callback: callbackId |
465 // issues #376 |
477 // issues #376 |
466 if (opts.rtmp) { |
478 if (opts.rtmp) { |
467 opts.rtmp = escapeURL(opts.rtmp); |
479 opts.rtmp = escapeURL(opts.rtmp); |
468 } |
480 } |
469 |
481 |
470 // issue #733 |
482 // issues #733, 906 |
471 var bgColor = common.css(root, 'background-color') ||'', bg; |
483 var bgColor = conf.bgcolor || common.css(root, 'background-color') ||'', bg; |
472 if (bgColor.indexOf('rgb') === 0) { |
484 if (bgColor.indexOf('rgb') === 0) { |
473 bg = toHex(bgColor); |
485 bg = toHex(bgColor); |
474 } else if (bgColor.indexOf('#') === 0) { |
486 } else if (bgColor.indexOf('#') === 0) { |
475 bg = toLongHex(bgColor); |
487 bg = toLongHex(bgColor); |
476 } |
488 } |
499 setTimeout(function() { |
511 setTimeout(function() { |
500 if (typeof api.PercentLoaded === 'undefined') { |
512 if (typeof api.PercentLoaded === 'undefined') { |
501 player.trigger('flashdisabled', [player]); |
513 player.trigger('flashdisabled', [player]); |
502 } |
514 } |
503 }, 1000); |
515 }, 1000); |
516 |
|
517 player.off('resume.flashhack').on('resume.flashhack', function() { |
|
518 var timer = setTimeout(function() { |
|
519 if (player.playing) { |
|
520 player.trigger('flashdisabled', [player]); |
|
521 } |
|
522 }, 1000); |
|
523 player.one('progress', function() { |
|
524 clearTimeout(timer); |
|
525 }); |
|
526 }); |
|
527 |
|
504 |
528 |
505 api.pollInterval = setInterval(function () { |
529 api.pollInterval = setInterval(function () { |
506 if (!api) return; |
530 if (!api) return; |
507 var status = api.__status ? api.__status() : null; |
531 var status = api.__status ? api.__status() : null; |
508 |
532 |
593 |
617 |
594 engine[name] = function(arg) { |
618 engine[name] = function(arg) { |
595 try { |
619 try { |
596 if (player.ready) { |
620 if (player.ready) { |
597 |
621 |
598 if (name == 'seek' && player.video.time && !player.paused) { |
|
599 player.trigger("beforeseek"); |
|
600 } |
|
601 |
|
602 if (arg === undefined) { |
622 if (arg === undefined) { |
603 api["__" + name](); |
623 api["__" + name](); |
604 |
624 |
605 } else { |
625 } else { |
606 api["__" + name](arg); |
626 api["__" + name](arg); |
648 engineImpl.engineName = 'flash'; |
668 engineImpl.engineName = 'flash'; |
649 engineImpl.canPlay = function(type, conf) { |
669 engineImpl.canPlay = function(type, conf) { |
650 return flowplayer.support.flashVideo && /video\/(mp4|flash|flv)/i.test(type) || flowplayer.support.flashVideo && conf.swfHls && /mpegurl/i.test(type); |
670 return flowplayer.support.flashVideo && /video\/(mp4|flash|flv)/i.test(type) || flowplayer.support.flashVideo && conf.swfHls && /mpegurl/i.test(type); |
651 }; |
671 }; |
652 flowplayer.engines.push(engineImpl); |
672 flowplayer.engines.push(engineImpl); |
673 |
|
674 |
|
675 |
|
676 function isAbsolute(url) { |
|
677 return /^https?:/.test(url); |
|
678 } |
|
653 |
679 |
654 },{"../common":1,"../flowplayer":18,"./embed":2,"bean":20,"extend-object":26}],4:[function(_dereq_,module,exports){ |
680 },{"../common":1,"../flowplayer":18,"./embed":2,"bean":20,"extend-object":26}],4:[function(_dereq_,module,exports){ |
655 'use strict'; |
681 'use strict'; |
656 var flowplayer = _dereq_('../flowplayer'), |
682 var flowplayer = _dereq_('../flowplayer'), |
657 bean = _dereq_('bean'), |
683 bean = _dereq_('bean'), |
718 if (typeof preload === 'undefined') preload = 'none'; |
744 if (typeof preload === 'undefined') preload = 'none'; |
719 if (typeof useCache === 'undefined') useCache = true; |
745 if (typeof useCache === 'undefined') useCache = true; |
720 if (useCache && videoTagCache) { |
746 if (useCache && videoTagCache) { |
721 videoTagCache.type = getType(video.type); |
747 videoTagCache.type = getType(video.type); |
722 videoTagCache.src = video.src; |
748 videoTagCache.src = video.src; |
749 common.find('track', videoTagCache).forEach(common.removeNode); |
|
750 videoTagCache.removeAttribute('crossorigin'); |
|
723 return videoTagCache; |
751 return videoTagCache; |
724 } |
752 } |
725 var el = document.createElement('video'); |
753 var el = document.createElement('video'); |
726 el.src = video.src; |
754 el.src = video.src; |
727 el.type = getType(video.type); |
755 el.type = getType(video.type); |
747 /*jshint -W093 */ |
775 /*jshint -W093 */ |
748 return self = { |
776 return self = { |
749 engineName: engine.engineName, |
777 engineName: engine.engineName, |
750 |
778 |
751 pick: function(sources) { |
779 pick: function(sources) { |
752 if (support.video) { |
780 var source = (function() { |
781 if (support.video) { |
|
753 if (conf.videoTypePreference) { |
782 if (conf.videoTypePreference) { |
754 var mp4source = findFromSourcesByType(sources, conf.videoTypePreference); |
783 var mp4source = findFromSourcesByType(sources, conf.videoTypePreference); |
755 if (mp4source) return mp4source; |
784 if (mp4source) return mp4source; |
756 } |
785 } |
757 |
786 |
758 for (var i = 0, source; i < sources.length; i++) { |
787 for (var i = 0, source; i < sources.length; i++) { |
759 if (canPlay(sources[i].type)) return sources[i]; |
788 if (canPlay(sources[i].type)) return sources[i]; |
760 } |
789 } |
761 } |
790 } |
791 })(); |
|
792 if (!source) return; |
|
793 if (typeof source.src === 'string') source.src = common.createAbsoluteUrl(source.src); |
|
794 return source; |
|
762 }, |
795 }, |
763 |
796 |
764 load: function(video) { |
797 load: function(video) { |
765 var created = false, container = common.find('.fp-player', root)[0], reload = false; |
798 var created = false, container = common.find('.fp-player', root)[0], reload = false; |
766 if (conf.splash && !api) { |
799 if (conf.splash && !api) { |
797 |
830 |
798 if (player.video.src && video.src != player.video.src || video.index) common.attr(api, 'autoplay', 'autoplay'); |
831 if (player.video.src && video.src != player.video.src || video.index) common.attr(api, 'autoplay', 'autoplay'); |
799 api.src = video.src; |
832 api.src = video.src; |
800 api.type = video.type; |
833 api.type = video.type; |
801 |
834 |
802 listen(api, common.find("source", api).concat(api), video); |
835 self._listeners = listen(api, common.find("source", api).concat(api), video); |
803 |
836 |
804 // iPad (+others?) demands load() |
837 // iPad (+others?) demands load() |
805 if (conf.clip.preload != 'none' && video.type != "mpegurl" || !support.zeropreload || !support.dataload) api.load(); |
838 if (conf.clip.preload != 'none' && video.type != "mpegurl" || !support.zeropreload || !support.dataload) api.load(); |
806 if (created || reload) api.load(); |
839 if (created || reload) api.load(); |
807 if (api.paused && (video.autoplay || conf.autoplay)) api.play(); |
840 if (api.paused && (video.autoplay || conf.autoplay)) api.play(); |
836 |
869 |
837 unload: function() { |
870 unload: function() { |
838 common.find('video.fp-engine', root).forEach(common.removeNode); |
871 common.find('video.fp-engine', root).forEach(common.removeNode); |
839 if (!support.cachedVideoTag) videoTagCache = null; |
872 if (!support.cachedVideoTag) videoTagCache = null; |
840 timer = clearInterval(timer); |
873 timer = clearInterval(timer); |
874 var instanceId = root.getAttribute('data-flowplayer-instance-id'); |
|
875 delete api.listeners[instanceId]; |
|
841 api = 0; |
876 api = 0; |
877 if (self._listeners) Object.keys(self._listeners).forEach(function(typ) { |
|
878 self._listeners[typ].forEach(function(l) { |
|
879 root.removeEventListener(typ, l, true); |
|
880 }); |
|
881 }); |
|
842 } |
882 } |
843 |
883 |
844 }; |
884 }; |
845 |
885 |
846 function listen(api, sources, video) { |
886 function listen(api, sources, video) { |
865 |
905 |
866 player.on('shutdown', function() { |
906 player.on('shutdown', function() { |
867 bean.off(sources); |
907 bean.off(sources); |
868 }); |
908 }); |
869 |
909 |
910 var eventListeners = {}; |
|
911 |
|
870 Object.keys(EVENTS).forEach(function(type) { |
912 Object.keys(EVENTS).forEach(function(type) { |
871 var flow = EVENTS[type]; |
913 var flow = EVENTS[type]; |
872 if (!flow) return; |
914 if (!flow) return; |
873 root.addEventListener(type, function(e) { |
915 var l = function(e) { |
874 video = api.listeners[instanceId]; |
916 video = api.listeners[instanceId]; |
875 if (!e.target || !ClassList(e.target).contains('fp-engine')) return; |
917 if (!e.target || !ClassList(e.target).contains('fp-engine')) return; |
876 |
918 |
877 if (conf.debug && !/progress/.test(flow)) console.log(type, "->", flow, e); |
919 if (conf.debug && !/progress/.test(flow)) console.log(type, "->", flow, e); |
878 |
920 |
901 url: api.currentSrc, |
943 url: api.currentSrc, |
902 src: api.currentSrc |
944 src: api.currentSrc |
903 }); |
945 }); |
904 |
946 |
905 try { |
947 try { |
906 arg.seekable = !conf.live && /mpegurl/i.test(video ? (video.type || '') : '') && api.duration || api.seekable && api.seekable.end(null); |
948 arg.seekable = !player.live && /mpegurl/i.test(video ? (video.type || '') : '') && api.duration || api.seekable && api.seekable.end(null); |
907 |
949 |
908 } catch (ignored) {} |
950 } catch (ignored) {} |
909 |
951 |
910 // buffer |
952 // buffer |
911 timer = timer || setInterval(function() { |
953 timer = timer || setInterval(function() { |
927 } |
969 } |
928 } |
970 } |
929 |
971 |
930 }, 250); |
972 }, 250); |
931 |
973 |
932 if (!conf.live && !arg.duration && !support.hlsDuration && type === "loadeddata") { |
974 if (!player.live && !arg.duration && !support.hlsDuration && type === "loadeddata") { |
933 var durationChanged = function() { |
975 var durationChanged = function() { |
934 arg.duration = api.duration; |
976 arg.duration = api.duration; |
935 try { |
977 try { |
936 arg.seekable = api.seekable && api.seekable.end(null); |
978 arg.seekable = api.seekable && api.seekable.end(null); |
937 |
979 |
989 } |
1031 } |
990 |
1032 |
991 triggerEvent(); |
1033 triggerEvent(); |
992 |
1034 |
993 |
1035 |
994 }, true); |
1036 }; |
1037 root.addEventListener(type, l, true); |
|
1038 if (!eventListeners[type]) eventListeners[type] = []; |
|
1039 eventListeners[type].push(l); |
|
995 |
1040 |
996 }); |
1041 }); |
1042 return eventListeners; |
|
997 |
1043 |
998 } |
1044 } |
999 |
1045 |
1000 }; |
1046 }; |
1001 |
1047 |
1119 if (!segments[lastFiredSegment]) continue; |
1165 if (!segments[lastFiredSegment]) continue; |
1120 segments[lastFiredSegment].forEach(fire); |
1166 segments[lastFiredSegment].forEach(fire); |
1121 } |
1167 } |
1122 |
1168 |
1123 }).on("unload", setClass) |
1169 }).on("unload", setClass) |
1124 .on('beforeseek', function() { |
1170 .on('beforeseek', function(ev) { |
1125 cuepointsDisabled = true; |
1171 setTimeout(function() { |
1172 if (!ev.defaultPrevented) cuepointsDisabled = true; |
|
1173 }); |
|
1126 }).on("seek", function(ev, api, time) { |
1174 }).on("seek", function(ev, api, time) { |
1127 setClass(); |
1175 setClass(); |
1128 lastFiredSegment = segmentForCue(time || 0) - 0.125; |
1176 lastFiredSegment = segmentForCue(time || 0) - 0.125; |
1129 cuepointsDisabled = false; |
1177 cuepointsDisabled = false; |
1130 if (!time && segments[0]) segments[0].forEach(fire); |
1178 if (!time && segments[0]) segments[0].forEach(fire); |
1165 var duration = player.video.duration, |
1213 var duration = player.video.duration, |
1166 timeline = common.find('.fp-timeline', root)[0]; |
1214 timeline = common.find('.fp-timeline', root)[0]; |
1167 common.css(timeline, "overflow", "visible"); |
1215 common.css(timeline, "overflow", "visible"); |
1168 |
1216 |
1169 var time = cue.time || cue; |
1217 var time = cue.time || cue; |
1170 if (time < 0) time = duration + cue; |
1218 if (time < 0) time = duration + time; |
1171 |
1219 |
1172 var el = common.createElement('a', {className: 'fp-cuepoint fp-cuepoint' + (player.cuepoints.length - 1)}); |
1220 var el = common.createElement('a', {className: 'fp-cuepoint fp-cuepoint' + (player.cuepoints.length - 1)}); |
1173 common.css(el, "left", (time / duration * 100) + "%"); |
1221 common.css(el, "left", (time / duration * 100) + "%"); |
1174 |
1222 |
1175 timeline.appendChild(el); |
1223 timeline.appendChild(el); |
1176 bean.on(el, 'mousedown', function(e) { |
1224 bean.on(el, 'mousedown', function(e) { |
1177 e.preventDefault(); |
1225 e.preventDefault(); |
1226 e.stopPropagation(); |
|
1178 player.seek(time); |
1227 player.seek(time); |
1179 |
|
1180 // preventDefault() doesn't work |
|
1181 return false; |
|
1182 }); |
1228 }); |
1183 } |
1229 } |
1184 return player; |
1230 return player; |
1185 }; |
1231 }; |
1186 |
1232 |
1235 |
1281 |
1236 if (embedConf.iframe) { |
1282 if (embedConf.iframe) { |
1237 var src = player.conf.embed.iframe, |
1283 var src = player.conf.embed.iframe, |
1238 width = embedConf.width || video.width || common.width(root), |
1284 width = embedConf.width || video.width || common.width(root), |
1239 height = embedConf.height || video.height || common.height(root); |
1285 height = embedConf.height || video.height || common.height(root); |
1240 return '<iframe src="' + player.conf.embed.iframe + '" frameBorder="0" allowfullscreen width="' + width + '" height="' + height + '"></iframe>'; |
1286 return '<iframe src="' + player.conf.embed.iframe + '" allowfullscreen style="width:' + width + ';height:' + height + ';border:none;"></iframe>'; |
1241 } |
1287 } |
1242 var props = ['ratio', 'rtmp', 'live', 'bufferTime', 'origin', 'analytics', 'key', 'subscribe', 'swf', 'swfHls', 'embed', 'adaptiveRatio', 'logo']; |
1288 var props = ['ratio', 'rtmp', 'live', 'bufferTime', 'origin', 'analytics', 'key', 'subscribe', 'swf', 'swfHls', 'embed', 'adaptiveRatio', 'logo']; |
1243 if (embedConf.playlist) props.push('playlist'); |
1289 if (embedConf.playlist) props.push('playlist'); |
1244 var c = common.pick(player.conf, props); |
1290 var c = common.pick(player.conf, props); |
1245 if (c.logo) c.logo = common.createElement('img', {src: c.logo}).src; |
1291 if (c.logo) c.logo = common.createElement('img', {src: c.logo}).src; |
1246 if (!embedConf.playlist || !player.conf.playlist.length) c.clip = extend({}, player.conf.clip, common.pick(player.video, ['sources'])); |
1292 if (!embedConf.playlist || !player.conf.playlist.length) c.clip = extend({}, player.conf.clip, common.pick(player.video, ['sources'])); |
1247 var script = "var w=window,d=document,e;w._fpes||(w._fpes=[],w.addEventListener(\"load\",function(){var s=d.createElement(\"script\");s.src=\"//embed.flowplayer.org/6.0.3/embed.min.js\",d.body.appendChild(s)})),e=[].slice.call(d.getElementsByTagName(\"script\"),-1)[0].parentNode,w._fpes.push({e:e,l:\"$library\",c:$conf});\n".replace('$conf', JSON.stringify(c)).replace('$library', embedConf.library || ''); |
1293 var script = "var w=window,d=document,e;w._fpes||(w._fpes=[],w.addEventListener(\"load\",function(){var s=d.createElement(\"script\");s.src=\"//embed.flowplayer.org/6.0.5/embed.min.js\",d.body.appendChild(s)})),e=[].slice.call(d.getElementsByTagName(\"script\"),-1)[0].parentNode,w._fpes.push({e:e,l:\"$library\",c:$conf});\n".replace('$conf', JSON.stringify(c)).replace('$library', embedConf.library || ''); |
1248 |
1294 |
1249 return '<a href="$href">Watch video!\n<script>$script</script></a>'.replace('$href', player.conf.origin || window.location.href).replace('$script', script); |
1295 return '<a href="$href">Watch video!\n<script>$script</script></a>'.replace('$href', player.conf.origin || window.location.href).replace('$script', script); |
1250 |
1296 |
1251 }; |
1297 }; |
1252 fptip(root, ".fp-embed", "is-embedding"); |
1298 fptip(root, ".fp-embed", "is-embedding"); |
1365 if (!typ) return; |
1411 if (!typ) return; |
1366 args = (args || []).length ? args || [] : [args]; |
1412 args = (args || []).length ? args || [] : [args]; |
1367 var event = document.createEvent('Event'), typStr; |
1413 var event = document.createEvent('Event'), typStr; |
1368 typStr = typ.type || typ; |
1414 typStr = typ.type || typ; |
1369 event.initEvent(typStr, false, true); |
1415 event.initEvent(typStr, false, true); |
1416 if (Object.defineProperty) event.preventDefault = function() { |
|
1417 Object.defineProperty(this, 'defaultPrevented', { get: function() { return true; } }); |
|
1418 }; |
|
1370 eventArguments[event.timeStamp + event.type] = args; |
1419 eventArguments[event.timeStamp + event.type] = args; |
1371 elem.dispatchEvent(event); |
1420 elem.dispatchEvent(event); |
1372 return returnEvent ? event : obj; |
1421 return returnEvent ? event : obj; |
1373 }; |
1422 }; |
1374 }; |
1423 }; |
1510 }).on('unload', function() { |
1559 }).on('unload', function() { |
1511 if (player.isFullscreen) player.fullscreen(); |
1560 if (player.isFullscreen) player.fullscreen(); |
1512 }); |
1561 }); |
1513 |
1562 |
1514 player.on('shutdown', function() { |
1563 player.on('shutdown', function() { |
1515 bean.off(document, '.ffscr'); |
|
1516 FULL_PLAYER = null; |
1564 FULL_PLAYER = null; |
1517 }); |
1565 }); |
1518 |
1566 |
1519 }); |
1567 }); |
1520 |
1568 |
1919 |
1967 |
1920 var playlistInitialized = false; |
1968 var playlistInitialized = false; |
1921 if (player.conf.playlist.length) { // playlist configured by javascript, generate playlist |
1969 if (player.conf.playlist.length) { // playlist configured by javascript, generate playlist |
1922 playlistInitialized = true; |
1970 playlistInitialized = true; |
1923 generatePlaylist(); |
1971 generatePlaylist(); |
1924 if (!player.conf.clip || !player.conf.clip.sources.length) player.conf.clip = player.conf.playlist[0]; |
1972 if (!player.conf.clip || !player.conf.clip.sources.length) { |
1973 player.conf.clip = player.conf.playlist[player.conf.startIndex || 0]; |
|
1974 } |
|
1925 } |
1975 } |
1926 |
1976 |
1927 if (els().length && !playlistInitialized) { //generate playlist from existing elements |
1977 if (els().length && !playlistInitialized) { //generate playlist from existing elements |
1928 player.conf.playlist = []; |
1978 player.conf.playlist = []; |
1979 delete player.conf.startIndex; |
|
1929 els().forEach(function(el) { |
1980 els().forEach(function(el) { |
1930 var src = el.href; |
1981 var src = el.href; |
1931 el.setAttribute('data-index', player.conf.playlist.length); |
1982 el.setAttribute('data-index', player.conf.playlist.length); |
1932 var itm = resolver.resolve(src, player.conf.clip.sources); |
1983 var itm = resolver.resolve(src, player.conf.clip.sources); |
1933 if ($) { |
1984 if ($) { |
1946 player.play(toPlay); |
1997 player.play(toPlay); |
1947 } |
1998 } |
1948 }); |
1999 }); |
1949 |
2000 |
1950 // highlight |
2001 // highlight |
2002 function videoIndex(video) { |
|
2003 if (typeof video.index !== 'undefined') return video.index; |
|
2004 if (typeof player.video.index !== 'undefined') return player.video.index; |
|
2005 return player.conf.startIndex || 0; |
|
2006 } |
|
1951 player.on("load", function(e, api, video) { |
2007 player.on("load", function(e, api, video) { |
1952 if (!player.conf.playlist.length) return; |
2008 if (!player.conf.playlist.length) return; |
1953 var prev = active()[0], |
2009 var prev = active()[0], |
1954 prevIndex = prev && prev.getAttribute('data-index'), |
2010 prevIndex = prev && prev.getAttribute('data-index'), |
1955 index = video.index = video.index || player.video.index || 0, |
2011 index = video.index = videoIndex(video), |
1956 el = common.find(conf.query +'[data-index="' + index + '"]', queryRoot())[0], |
2012 el = common.find(conf.query +'[data-index="' + index + '"]', queryRoot())[0], |
1957 is_last = index == player.conf.playlist.length - 1; |
2013 is_last = index == player.conf.playlist.length - 1; |
1958 if (prev) ClassList(prev).remove(klass); |
2014 if (prev) ClassList(prev).remove(klass); |
1959 if (el) ClassList(el).add(klass); |
2015 if (el) ClassList(el).add(klass); |
1960 // index |
2016 // index |
2300 if (!tracks.length) return; |
2356 if (!tracks.length) return; |
2301 tracks[0].mode = mode; |
2357 tracks[0].mode = mode; |
2302 }; |
2358 }; |
2303 if (!video.subtitles || !video.subtitles.length) return; |
2359 if (!video.subtitles || !video.subtitles.length) return; |
2304 var videoTag = common.find('video.fp-engine', root)[0]; |
2360 var videoTag = common.find('video.fp-engine', root)[0]; |
2361 if (video.subtitles.some(function(st) { return !common.isSameDomain(st.src); })) common.attr(videoTag, 'crossorigin', 'anonymous'); |
|
2362 videoTag.textTracks.addEventListener('addtrack', function() { |
|
2363 setMode('disabled'); |
|
2364 setMode('showing'); |
|
2365 }); |
|
2305 video.subtitles.forEach(function(st) { |
2366 video.subtitles.forEach(function(st) { |
2306 videoTag.appendChild(common.createElement('track', { |
2367 videoTag.appendChild(common.createElement('track', { |
2307 kind: 'subtitles', |
2368 kind: 'subtitles', |
2308 srclang: st.srclang || 'en', |
2369 srclang: st.srclang || 'en', |
2309 label: st.label || 'en', |
2370 label: st.label || 'en', |
2310 src: st.src, |
2371 src: st.src, |
2311 'default': st['default'] |
2372 'default': st['default'] |
2312 })); |
2373 })); |
2313 }); |
2374 }); |
2314 setMode('disabled'); |
|
2315 setMode('showing'); |
|
2316 return; |
2375 return; |
2317 } |
2376 } |
2318 |
2377 |
2319 player.subtitles = []; |
2378 player.subtitles = []; |
2320 |
2379 |
2665 }, video.title)); |
2724 }, video.title)); |
2666 } |
2725 } |
2667 |
2726 |
2668 |
2727 |
2669 }).on("unload", function() { |
2728 }).on("unload", function() { |
2670 if (!origRatio) common.css(ratio, "paddingTop", ""); |
2729 if (!origRatio && !conf.splash) common.css(ratio, "paddingTop", ""); |
2671 timelineApi.slide(0); |
2730 timelineApi.slide(0); |
2672 |
2731 |
2673 // buffer |
2732 // buffer |
2674 }).on("buffer", function() { |
2733 }).on("buffer", function() { |
2675 var video = api.video, |
2734 var video = api.video, |
2731 }).on("mute", function(e, api, flag) { |
2790 }).on("mute", function(e, api, flag) { |
2732 common.toggleClass(root, 'is-muted', flag); |
2791 common.toggleClass(root, 'is-muted', flag); |
2733 |
2792 |
2734 }).on("error", function(e, api, error) { |
2793 }).on("error", function(e, api, error) { |
2735 common.removeClass(root, 'is-loading'); |
2794 common.removeClass(root, 'is-loading'); |
2795 common.removeClass(root, 'is-seeking'); |
|
2736 common.addClass(root, 'is-error'); |
2796 common.addClass(root, 'is-error'); |
2737 if (error) { |
2797 if (error) { |
2738 error.message = conf.errors[error.code]; |
2798 error.message = conf.errors[error.code]; |
2739 api.error = true; |
2799 api.error = true; |
2740 |
2800 |
2813 }); |
2873 }); |
2814 |
2874 |
2815 bean.on(root, 'contextmenu', function(ev) { |
2875 bean.on(root, 'contextmenu', function(ev) { |
2816 var o = common.offset(common.find('.fp-player', root)[0]), |
2876 var o = common.offset(common.find('.fp-player', root)[0]), |
2817 w = window, |
2877 w = window, |
2818 left = ev.clientX - o.left, |
2878 left = ev.clientX - (o.left + w.scrollX), |
2819 t = ev.clientY - (o.top + w.scrollY); |
2879 t = ev.clientY - (o.top + w.scrollY); |
2880 if (rootClasses.contains('is-flash-disabled')) return; |
|
2820 var menu = common.find('.fp-context-menu', root)[0]; |
2881 var menu = common.find('.fp-context-menu', root)[0]; |
2821 if (!menu) return; |
2882 if (!menu) return; |
2822 ev.preventDefault(); |
2883 ev.preventDefault(); |
2823 common.css(menu, |
2884 common.css(menu, |
2824 {left: left + 'px', |
2885 {left: left + 'px', |
2833 bean.off(document, 'click.outsidemenu'); |
2894 bean.off(document, 'click.outsidemenu'); |
2834 }); |
2895 }); |
2835 }); |
2896 }); |
2836 api.on('flashdisabled', function() { |
2897 api.on('flashdisabled', function() { |
2837 rootClasses.add('is-flash-disabled'); |
2898 rootClasses.add('is-flash-disabled'); |
2838 api.one('ready', function() { |
2899 api.one('ready progress', function() { |
2839 rootClasses.remove('is-flash-disabled'); |
2900 rootClasses.remove('is-flash-disabled'); |
2840 common.find('.fp-flash-disabled', root).forEach(common.removeNode); |
2901 common.find('.fp-flash-disabled', root).forEach(common.removeNode); |
2841 }); |
2902 }); |
2842 root.appendChild(common.createElement('div', {className: "fp-flash-disabled"}, 'Adobe Flash is disabled for this page, click player area to enable')); |
2903 root.appendChild(common.createElement('div', {className: "fp-flash-disabled"}, 'Adobe Flash is disabled for this page, click player area to enable')); |
2843 }); |
2904 }); |
2847 |
2908 |
2848 var bc = common.css(root, 'background-color'), |
2909 var bc = common.css(root, 'background-color'), |
2849 has_bg = common.css(root, 'background-image') != "none" || bc && bc != "rgba(0, 0, 0, 0)" && bc != "transparent"; |
2910 has_bg = common.css(root, 'background-image') != "none" || bc && bc != "rgba(0, 0, 0, 0)" && bc != "transparent"; |
2850 |
2911 |
2851 // is-poster class |
2912 // is-poster class |
2852 if (has_bg && !conf.splash && !conf.autoplay) { |
2913 if (has_bg && !conf.splash) { |
2914 if (!conf.poster) conf.poster = true; |
|
2853 |
2915 |
2854 api.on("ready stop", function() { |
2916 api.on("ready stop", function() { |
2855 rootClasses.add("is-poster"); |
2917 rootClasses.add("is-poster"); |
2856 api.one("progress", function() { |
2918 api.poster = true; |
2857 rootClasses.remove("is-poster"); |
2919 api.one("progress", function() { |
2858 }); |
2920 rootClasses.remove("is-poster"); |
2921 api.poster = false; |
|
2922 }); |
|
2859 }); |
2923 }); |
2860 |
2924 |
2861 } |
2925 } |
2862 |
2926 |
2863 if (typeof conf.splash === 'string') { |
2927 if (typeof conf.splash === 'string') { |
2965 } |
3029 } |
2966 }; |
3030 }; |
2967 |
3031 |
2968 extend(flowplayer, { |
3032 extend(flowplayer, { |
2969 |
3033 |
2970 version: '6.0.3', |
3034 version: '6.0.5', |
2971 |
3035 |
2972 engines: [], |
3036 engines: [], |
2973 |
3037 |
2974 conf: {}, |
3038 conf: {}, |
2975 |
3039 |
3003 |
3067 |
3004 splash: false, |
3068 splash: false, |
3005 |
3069 |
3006 live: false, |
3070 live: false, |
3007 |
3071 |
3008 swf: "//releases.flowplayer.org/6.0.3/flowplayer.swf", |
3072 swf: "//releases.flowplayer.org/6.0.5/flowplayer.swf", |
3009 swfHls: "//releases.flowplayer.org/6.0.3/flowplayerhls.swf", |
3073 swfHls: "//releases.flowplayer.org/6.0.5/flowplayerhls.swf", |
3010 |
3074 |
3011 speeds: [0.25, 0.5, 1, 1.5, 2], |
3075 speeds: [0.25, 0.5, 1, 1.5, 2], |
3012 |
3076 |
3013 tooltip: true, |
3077 tooltip: true, |
3014 |
3078 |
3185 if (!source.engine) return true; |
3249 if (!source.engine) return true; |
3186 return source.engine === engine.engineName; |
3250 return source.engine === engine.engineName; |
3187 }))); |
3251 }))); |
3188 |
3252 |
3189 if (video.src) { |
3253 if (video.src) { |
3190 video.src = common.createElement('a', {href: video.src}).href; |
|
3191 var e = api.trigger('load', [api, video, engine], true); |
3254 var e = api.trigger('load', [api, video, engine], true); |
3192 if (!e.defaultPrevented) { |
3255 if (!e.defaultPrevented) { |
3193 engine.load(video); |
3256 engine.load(video); |
3194 |
3257 |
3195 // callback |
3258 // callback |
3240 |
3303 |
3241 if (typeof time == "boolean") { |
3304 if (typeof time == "boolean") { |
3242 var delta = api.video.duration * 0.1; |
3305 var delta = api.video.duration * 0.1; |
3243 time = api.video.time + (time ? delta : -delta); |
3306 time = api.video.time + (time ? delta : -delta); |
3244 } |
3307 } |
3245 time = lastSeekPosition = Math.min(Math.max(time, 0), api.video.duration).toFixed(1); |
3308 time = lastSeekPosition = Math.min(Math.max(time, 0), api.video.duration - 0.1).toFixed(1); |
3246 var ev = api.trigger('beforeseek', [api, time], true); |
3309 var ev = api.trigger('beforeseek', [api, time], true); |
3247 if (!ev.defaultPrevented) { |
3310 if (!ev.defaultPrevented) { |
3248 engine.seek(time); |
3311 engine.seek(time); |
3249 if (isFunction(callback)) api.one("seek", callback); |
3312 if (isFunction(callback)) api.one("seek", callback); |
3250 } else { |
3313 } else { |
3307 |
3370 |
3308 stop: function() { |
3371 stop: function() { |
3309 if (api.ready) { |
3372 if (api.ready) { |
3310 api.pause(); |
3373 api.pause(); |
3311 api.seek(0, function() { |
3374 api.seek(0, function() { |
3312 api.trigger("stop"); |
3375 api.trigger("stop", [api]); |
3313 }); |
3376 }); |
3314 } |
3377 } |
3315 return api; |
3378 return api; |
3316 }, |
3379 }, |
3317 |
3380 |
3318 unload: function() { |
3381 unload: function() { |
3319 if (!rootClasses.contains("is-embedding")) { |
3382 if (!rootClasses.contains("is-embedding")) { |
3320 |
3383 |
3321 if (conf.splash) { |
3384 if (conf.splash) { |
3322 api.trigger("unload", [api]); |
3385 api.trigger("unload", [api]); |
3323 if (engine) engine.unload(); |
3386 if (engine) { |
3387 engine.unload(); |
|
3388 api.engine = engine = 0; |
|
3389 } |
|
3324 } else { |
3390 } else { |
3325 api.stop(); |
3391 api.stop(); |
3326 } |
3392 } |
3327 } |
3393 } |
3328 return api; |
3394 return api; |
3331 shutdown: function() { |
3397 shutdown: function() { |
3332 api.unload(); |
3398 api.unload(); |
3333 api.trigger('shutdown', [api]); |
3399 api.trigger('shutdown', [api]); |
3334 bean.off(root); |
3400 bean.off(root); |
3335 delete instances[root.getAttribute('data-flowplayer-instance-id')]; |
3401 delete instances[root.getAttribute('data-flowplayer-instance-id')]; |
3402 root.removeAttribute('data-flowplayer-instance-id'); |
|
3336 }, |
3403 }, |
3337 |
3404 |
3338 disable: function(flag) { |
3405 disable: function(flag) { |
3339 if (flag === undefined) flag = !api.disabled; |
3406 if (flag === undefined) flag = !api.disabled; |
3340 |
3407 |
3540 _dereq_('./ext/embed'); |
3607 _dereq_('./ext/embed'); |
3541 //Have to add fullscreen last |
3608 //Have to add fullscreen last |
3542 _dereq_('./ext/fullscreen'); |
3609 _dereq_('./ext/fullscreen'); |
3543 |
3610 |
3544 _dereq_('./ext/mobile'); |
3611 _dereq_('./ext/mobile'); |
3545 flowplayer(function(e,o){function a(e){var o=document.createElement("a");return o.href=e,t.hostname(o.hostname)}var n=function(e,o){var a=e.className.split(" ");-1===a.indexOf(o)&&(e.className+=" "+o)},r=function(e){return"none"!==window.getComputedStyle(e).display},l=e.conf,t=flowplayer.common,i=t.createElement,d=l.swf.indexOf("flowplayer.org")&&l.e&&o.getAttribute("data-origin"),s=d?a(d):t.hostname(),p=(document,l.key);"file:"==location.protocol&&(s="localhost"),e.load.ed=1,l.hostname=s,l.origin=d||location.href,d&&n(o,"is-embedded"),"string"==typeof p&&(p=p.split(/,\s*/));var f=function(e,a){var n=i("a",{href:a,className:"fp-brand"});n.innerHTML=e,t.find(".fp-controls",o)[0].appendChild(n)};if(p&&"function"==typeof key_check&&key_check(p,s)){if(l.logo){var c=i("a",{href:d,className:"fp-logo"});l.embed&&l.embed.popup&&(c.target="_blank");var h=i("img",{src:l.logo});c.appendChild(h),o.appendChild(c)}l.brand&&d||l.brand&&l.brand.showOnOrigin?f(l.brand.text||l.brand,d||location.href):t.addClass(o,"no-brand")}else{f("flowplayer","http://flowplayer.org");var c=i("a",{href:"http://flowplayer.org"});o.appendChild(c);var y=i("div",{className:"fp-context-menu"},'<ul><li class="copyright">© 2015</li><li><a href="http://flowplayer.org">About Flowplayer</a></li><li><a href="http://flowplayer.org/license">GPL based license</a></li></ul>'),u=window.location.href.indexOf("localhost"),m=t.find(".fp-player",o)[0];7!==u&&(m||o).appendChild(y),e.on("pause resume finish unload ready",function(e,a){t.removeClass(o,"no-brand");var n=-1;if(a.video.src)for(var l=[["org","flowplayer","drive"],["org","flowplayer","my"]],i=0;i<l.length&&(n=a.video.src.indexOf("://"+l[i].reverse().join(".")),-1===n);i++);if((4===n||5===n)&&t.addClass(o,"no-brand"),/pause|resume/.test(e.type)&&"flash"!=a.engine.engineName&&4!=n&&5!=n){var d={display:"block",position:"absolute",left:"16px",bottom:"46px",zIndex:99999,width:"100px",height:"20px",backgroundImage:"url("+[".png","logo","/",".net",".cloudfront","d32wqyuo10o653","//"].reverse().join("")+")"};for(var s in d)d.hasOwnProperty(s)&&(c.style[s]=d[s]);a.load.ed=r(c)&&(7===u||y.parentNode==o||y.parentNode==m)&&!t.hasClass(o,"no-brand"),a.load.ed||a.pause()}else c.style.display="none"})}}); |
3612 flowplayer(function(e,o){function a(e){var o=document.createElement("a");return o.href=e,t.hostname(o.hostname)}var n=function(e,o){var a=e.className.split(" ");-1===a.indexOf(o)&&(e.className+=" "+o)},r=function(e){return"none"!==window.getComputedStyle(e).display},l=e.conf,t=flowplayer.common,i=t.createElement,d=l.swf.indexOf("flowplayer.org")&&l.e&&o.getAttribute("data-origin"),p=d?a(d):t.hostname(),s=(document,l.key);"file:"==location.protocol&&(p="localhost"),e.load.ed=1,l.hostname=p,l.origin=d||location.href,d&&n(o,"is-embedded"),"string"==typeof s&&(s=s.split(/,\s*/));var f=function(e,a){var n=i("a",{href:a,className:"fp-brand"});n.innerHTML=e,t.find(".fp-controls",o)[0].appendChild(n)};if(s&&"function"==typeof key_check&&key_check(s,p)){if(l.logo){var c=t.find(".fp-player",o)[0],h=i("a",{className:"fp-logo"});d&&(h.href=d),l.embed&&l.embed.popup&&(h.target="_blank");var y=i("img",{src:l.logo});h.appendChild(y),(c||o).appendChild(h)}l.brand&&d||l.brand&&l.brand.showOnOrigin?f(l.brand.text||l.brand,d||location.href):t.addClass(o,"no-brand")}else{f("flowplayer","http://flowplayer.org");var h=i("a",{href:"http://flowplayer.org"});o.appendChild(h);var u=i("div",{className:"fp-context-menu"},'<ul><li class="copyright">© 2015</li><li><a href="http://flowplayer.org">About Flowplayer</a></li><li><a href="http://flowplayer.org/license">GPL based license</a></li></ul>'),g=window.location.href.indexOf("localhost"),c=t.find(".fp-player",o)[0];7!==g&&(c||o).appendChild(u),e.on("pause resume finish unload ready",function(e,a){t.removeClass(o,"no-brand");var n=-1;if(a.video.src)for(var l=[["org","flowplayer","drive"],["org","flowplayer","my"],["org","flowplayer","cdn"]],i=0;i<l.length&&(n=a.video.src.indexOf("://"+l[i].reverse().join(".")),-1===n);i++);if((4===n||5===n)&&t.addClass(o,"no-brand"),/pause|resume/.test(e.type)&&"flash"!=a.engine.engineName&&4!=n&&5!=n){var d={display:"block",position:"absolute",left:"16px",bottom:"46px",zIndex:99999,width:"100px",height:"20px",backgroundImage:"url("+[".png","logo","/",".net",".cloudfront","d32wqyuo10o653","//"].reverse().join("")+")"};for(var p in d)d.hasOwnProperty(p)&&(h.style[p]=d[p]);a.load.ed=r(h)&&(7===g||u.parentNode==o||u.parentNode==c)&&!t.hasClass(o,"no-brand"),a.load.ed||a.pause()}else h.style.display="none"})}}); |
3546 |
3613 |
3547 |
3614 |
3548 },{"./engine/embed":2,"./engine/flash":3,"./engine/html5":4,"./ext/analytics":5,"./ext/cuepoint":6,"./ext/embed":7,"./ext/fullscreen":9,"./ext/keyboard":10,"./ext/mobile":11,"./ext/playlist":12,"./ext/subtitle":15,"./ext/support":16,"./ext/ui":17,"./flowplayer":18,"es5-shim":25}],20:[function(_dereq_,module,exports){ |
3615 },{"./engine/embed":2,"./engine/flash":3,"./engine/html5":4,"./ext/analytics":5,"./ext/cuepoint":6,"./ext/embed":7,"./ext/fullscreen":9,"./ext/keyboard":10,"./ext/mobile":11,"./ext/playlist":12,"./ext/subtitle":15,"./ext/support":16,"./ext/ui":17,"./flowplayer":18,"es5-shim":25}],20:[function(_dereq_,module,exports){ |
3549 /*! |
3616 /*! |
3550 * Bean - copyright (c) Jacob Thornton 2011-2012 |
3617 * Bean - copyright (c) Jacob Thornton 2011-2012 |
4951 |
5018 |
4952 // Add semicolon to prevent IIFE from being passed as argument to concatenated code. |
5019 // Add semicolon to prevent IIFE from being passed as argument to concatenated code. |
4953 ; |
5020 ; |
4954 |
5021 |
4955 // UMD (Universal Module Definition) |
5022 // UMD (Universal Module Definition) |
4956 // see https://github.com/umdjs/umd/blob/master/returnExports.js |
5023 // see https://github.com/umdjs/umd/blob/master/templates/returnExports.js |
4957 (function (root, factory) { |
5024 (function (root, factory) { |
4958 'use strict'; |
5025 'use strict'; |
4959 |
5026 |
4960 /* global define, exports, module */ |
5027 /* global define, exports, module */ |
4961 if (typeof define === 'function' && define.amd) { |
5028 if (typeof define === 'function' && define.amd) { |
4997 var array_splice = ArrayPrototype.splice; |
5064 var array_splice = ArrayPrototype.splice; |
4998 var array_push = ArrayPrototype.push; |
5065 var array_push = ArrayPrototype.push; |
4999 var array_unshift = ArrayPrototype.unshift; |
5066 var array_unshift = ArrayPrototype.unshift; |
5000 var array_concat = ArrayPrototype.concat; |
5067 var array_concat = ArrayPrototype.concat; |
5001 var call = FunctionPrototype.call; |
5068 var call = FunctionPrototype.call; |
5069 var apply = FunctionPrototype.apply; |
|
5002 var max = Math.max; |
5070 var max = Math.max; |
5003 var min = Math.min; |
5071 var min = Math.min; |
5004 |
5072 |
5005 // Having a toString local variable name breaks in Opera so use to_string. |
5073 // Having a toString local variable name breaks in Opera so use to_string. |
5006 var to_string = ObjectPrototype.toString; |
5074 var to_string = ObjectPrototype.toString; |
5009 var isCallable; /* inlined from https://npmjs.com/is-callable */ var fnToStr = Function.prototype.toString, tryFunctionObject = function tryFunctionObject(value) { try { fnToStr.call(value); return true; } catch (e) { return false; } }, fnClass = '[object Function]', genClass = '[object GeneratorFunction]'; isCallable = function isCallable(value) { if (typeof value !== 'function') { return false; } if (hasToStringTag) { return tryFunctionObject(value); } var strClass = to_string.call(value); return strClass === fnClass || strClass === genClass; }; |
5077 var isCallable; /* inlined from https://npmjs.com/is-callable */ var fnToStr = Function.prototype.toString, tryFunctionObject = function tryFunctionObject(value) { try { fnToStr.call(value); return true; } catch (e) { return false; } }, fnClass = '[object Function]', genClass = '[object GeneratorFunction]'; isCallable = function isCallable(value) { if (typeof value !== 'function') { return false; } if (hasToStringTag) { return tryFunctionObject(value); } var strClass = to_string.call(value); return strClass === fnClass || strClass === genClass; }; |
5010 var isRegex; /* inlined from https://npmjs.com/is-regex */ var regexExec = RegExp.prototype.exec, tryRegexExec = function tryRegexExec(value) { try { regexExec.call(value); return true; } catch (e) { return false; } }, regexClass = '[object RegExp]'; isRegex = function isRegex(value) { if (typeof value !== 'object') { return false; } return hasToStringTag ? tryRegexExec(value) : to_string.call(value) === regexClass; }; |
5078 var isRegex; /* inlined from https://npmjs.com/is-regex */ var regexExec = RegExp.prototype.exec, tryRegexExec = function tryRegexExec(value) { try { regexExec.call(value); return true; } catch (e) { return false; } }, regexClass = '[object RegExp]'; isRegex = function isRegex(value) { if (typeof value !== 'object') { return false; } return hasToStringTag ? tryRegexExec(value) : to_string.call(value) === regexClass; }; |
5011 var isString; /* inlined from https://npmjs.com/is-string */ var strValue = String.prototype.valueOf, tryStringObject = function tryStringObject(value) { try { strValue.call(value); return true; } catch (e) { return false; } }, stringClass = '[object String]'; isString = function isString(value) { if (typeof value === 'string') { return true; } if (typeof value !== 'object') { return false; } return hasToStringTag ? tryStringObject(value) : to_string.call(value) === stringClass; }; |
5079 var isString; /* inlined from https://npmjs.com/is-string */ var strValue = String.prototype.valueOf, tryStringObject = function tryStringObject(value) { try { strValue.call(value); return true; } catch (e) { return false; } }, stringClass = '[object String]'; isString = function isString(value) { if (typeof value === 'string') { return true; } if (typeof value !== 'object') { return false; } return hasToStringTag ? tryStringObject(value) : to_string.call(value) === stringClass; }; |
5012 |
5080 |
5013 /* inlined from http://npmjs.com/define-properties */ |
5081 /* inlined from http://npmjs.com/define-properties */ |
5082 var supportsDescriptors = $Object.defineProperty && (function () { |
|
5083 try { |
|
5084 var obj = {}; |
|
5085 $Object.defineProperty(obj, 'x', { enumerable: false, value: obj }); |
|
5086 for (var _ in obj) { return false; } |
|
5087 return obj.x === obj; |
|
5088 } catch (e) { /* this is ES3 */ |
|
5089 return false; |
|
5090 } |
|
5091 }()); |
|
5014 var defineProperties = (function (has) { |
5092 var defineProperties = (function (has) { |
5015 var supportsDescriptors = $Object.defineProperty && (function () { |
5093 // Define configurable, writable, and non-enumerable props |
5016 try { |
|
5017 var obj = {}; |
|
5018 $Object.defineProperty(obj, 'x', { enumerable: false, value: obj }); |
|
5019 for (var _ in obj) { return false; } |
|
5020 return obj.x === obj; |
|
5021 } catch (e) { /* this is ES3 */ |
|
5022 return false; |
|
5023 } |
|
5024 }()); |
|
5025 |
|
5026 // Define configurable, writable and non-enumerable props |
|
5027 // if they don't exist. |
5094 // if they don't exist. |
5028 var defineProperty; |
5095 var defineProperty; |
5029 if (supportsDescriptors) { |
5096 if (supportsDescriptors) { |
5030 defineProperty = function (object, name, method, forceAssign) { |
5097 defineProperty = function (object, name, method, forceAssign) { |
5031 if (!forceAssign && (name in object)) { return; } |
5098 if (!forceAssign && (name in object)) { return; } |
5060 var isPrimitive = function isPrimitive(input) { |
5127 var isPrimitive = function isPrimitive(input) { |
5061 var type = typeof input; |
5128 var type = typeof input; |
5062 return input === null || (type !== 'object' && type !== 'function'); |
5129 return input === null || (type !== 'object' && type !== 'function'); |
5063 }; |
5130 }; |
5064 |
5131 |
5132 var isActualNaN = $Number.isNaN || function (x) { return x !== x; }; |
|
5133 |
|
5065 var ES = { |
5134 var ES = { |
5066 // ES5 9.4 |
5135 // ES5 9.4 |
5067 // http://es5.github.com/#x9.4 |
5136 // http://es5.github.com/#x9.4 |
5068 // http://jsperf.com/to-integer |
5137 // http://jsperf.com/to-integer |
5069 /* replaceable with https://npmjs.com/package/es-abstract ES5.ToInteger */ |
5138 /* replaceable with https://npmjs.com/package/es-abstract ES5.ToInteger */ |
5070 ToInteger: function ToInteger(num) { |
5139 ToInteger: function ToInteger(num) { |
5071 var n = +num; |
5140 var n = +num; |
5072 if (n !== n) { // isNaN |
5141 if (isActualNaN(n)) { |
5073 n = 0; |
5142 n = 0; |
5074 } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) { |
5143 } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) { |
5075 n = (n > 0 || -1) * Math.floor(Math.abs(n)); |
5144 n = (n > 0 || -1) * Math.floor(Math.abs(n)); |
5076 } |
5145 } |
5077 return n; |
5146 return n; |
5102 |
5171 |
5103 // ES5 9.9 |
5172 // ES5 9.9 |
5104 // http://es5.github.com/#x9.9 |
5173 // http://es5.github.com/#x9.9 |
5105 /* replaceable with https://npmjs.com/package/es-abstract ES5.ToObject */ |
5174 /* replaceable with https://npmjs.com/package/es-abstract ES5.ToObject */ |
5106 ToObject: function (o) { |
5175 ToObject: function (o) { |
5107 /* jshint eqnull: true */ |
|
5108 if (o == null) { // this matches both null and undefined |
5176 if (o == null) { // this matches both null and undefined |
5109 throw new TypeError("can't convert " + o + ' to object'); |
5177 throw new TypeError("can't convert " + o + ' to object'); |
5110 } |
5178 } |
5111 return $Object(o); |
5179 return $Object(o); |
5112 }, |
5180 }, |
5260 return bound; |
5328 return bound; |
5261 } |
5329 } |
5262 }); |
5330 }); |
5263 |
5331 |
5264 // _Please note: Shortcuts are defined after `Function.prototype.bind` as we |
5332 // _Please note: Shortcuts are defined after `Function.prototype.bind` as we |
5265 // us it in defining shortcuts. |
5333 // use it in defining shortcuts. |
5266 var owns = call.bind(ObjectPrototype.hasOwnProperty); |
5334 var owns = call.bind(ObjectPrototype.hasOwnProperty); |
5267 var toStr = call.bind(ObjectPrototype.toString); |
5335 var toStr = call.bind(ObjectPrototype.toString); |
5336 var arraySlice = call.bind(array_slice); |
|
5337 var arraySliceApply = apply.bind(array_slice); |
|
5268 var strSlice = call.bind(StringPrototype.slice); |
5338 var strSlice = call.bind(StringPrototype.slice); |
5269 var strSplit = call.bind(StringPrototype.split); |
5339 var strSplit = call.bind(StringPrototype.split); |
5340 var strIndexOf = call.bind(StringPrototype.indexOf); |
|
5341 var push = call.bind(array_push); |
|
5342 var isEnum = call.bind(ObjectPrototype.propertyIsEnumerable); |
|
5343 var arraySort = call.bind(ArrayPrototype.sort); |
|
5270 |
5344 |
5271 // |
5345 // |
5272 // Array |
5346 // Array |
5273 // ===== |
5347 // ===== |
5274 // |
5348 // |
5333 } |
5407 } |
5334 return !!method && properlyBoxesNonStrict && properlyBoxesStrict; |
5408 return !!method && properlyBoxesNonStrict && properlyBoxesStrict; |
5335 }; |
5409 }; |
5336 |
5410 |
5337 defineProperties(ArrayPrototype, { |
5411 defineProperties(ArrayPrototype, { |
5338 forEach: function forEach(callbackfn /*, thisArg*/) { |
5412 forEach: function forEach(callbackfn/*, thisArg*/) { |
5339 var object = ES.ToObject(this); |
5413 var object = ES.ToObject(this); |
5340 var self = splitString && isString(this) ? strSplit(this, '') : object; |
5414 var self = splitString && isString(this) ? strSplit(this, '') : object; |
5341 var i = -1; |
5415 var i = -1; |
5342 var length = self.length >>> 0; |
5416 var length = ES.ToUint32(self.length); |
5343 var T; |
5417 var T; |
5344 if (arguments.length > 1) { |
5418 if (arguments.length > 1) { |
5345 T = arguments[1]; |
5419 T = arguments[1]; |
5346 } |
5420 } |
5347 |
5421 |
5352 |
5426 |
5353 while (++i < length) { |
5427 while (++i < length) { |
5354 if (i in self) { |
5428 if (i in self) { |
5355 // Invoke the callback function with call, passing arguments: |
5429 // Invoke the callback function with call, passing arguments: |
5356 // context, property value, property key, thisArg object |
5430 // context, property value, property key, thisArg object |
5357 if (typeof T !== 'undefined') { |
5431 if (typeof T === 'undefined') { |
5432 callbackfn(self[i], i, object); |
|
5433 } else { |
|
5358 callbackfn.call(T, self[i], i, object); |
5434 callbackfn.call(T, self[i], i, object); |
5359 } else { |
|
5360 callbackfn(self[i], i, object); |
|
5361 } |
5435 } |
5362 } |
5436 } |
5363 } |
5437 } |
5364 } |
5438 } |
5365 }, !properlyBoxesContext(ArrayPrototype.forEach)); |
5439 }, !properlyBoxesContext(ArrayPrototype.forEach)); |
5369 // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map |
5443 // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map |
5370 defineProperties(ArrayPrototype, { |
5444 defineProperties(ArrayPrototype, { |
5371 map: function map(callbackfn/*, thisArg*/) { |
5445 map: function map(callbackfn/*, thisArg*/) { |
5372 var object = ES.ToObject(this); |
5446 var object = ES.ToObject(this); |
5373 var self = splitString && isString(this) ? strSplit(this, '') : object; |
5447 var self = splitString && isString(this) ? strSplit(this, '') : object; |
5374 var length = self.length >>> 0; |
5448 var length = ES.ToUint32(self.length); |
5375 var result = $Array(length); |
5449 var result = $Array(length); |
5376 var T; |
5450 var T; |
5377 if (arguments.length > 1) { |
5451 if (arguments.length > 1) { |
5378 T = arguments[1]; |
5452 T = arguments[1]; |
5379 } |
5453 } |
5383 throw new TypeError('Array.prototype.map callback must be a function'); |
5457 throw new TypeError('Array.prototype.map callback must be a function'); |
5384 } |
5458 } |
5385 |
5459 |
5386 for (var i = 0; i < length; i++) { |
5460 for (var i = 0; i < length; i++) { |
5387 if (i in self) { |
5461 if (i in self) { |
5388 if (typeof T !== 'undefined') { |
5462 if (typeof T === 'undefined') { |
5463 result[i] = callbackfn(self[i], i, object); |
|
5464 } else { |
|
5389 result[i] = callbackfn.call(T, self[i], i, object); |
5465 result[i] = callbackfn.call(T, self[i], i, object); |
5390 } else { |
|
5391 result[i] = callbackfn(self[i], i, object); |
|
5392 } |
5466 } |
5393 } |
5467 } |
5394 } |
5468 } |
5395 return result; |
5469 return result; |
5396 } |
5470 } |
5398 |
5472 |
5399 // ES5 15.4.4.20 |
5473 // ES5 15.4.4.20 |
5400 // http://es5.github.com/#x15.4.4.20 |
5474 // http://es5.github.com/#x15.4.4.20 |
5401 // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter |
5475 // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter |
5402 defineProperties(ArrayPrototype, { |
5476 defineProperties(ArrayPrototype, { |
5403 filter: function filter(callbackfn /*, thisArg*/) { |
5477 filter: function filter(callbackfn/*, thisArg*/) { |
5404 var object = ES.ToObject(this); |
5478 var object = ES.ToObject(this); |
5405 var self = splitString && isString(this) ? strSplit(this, '') : object; |
5479 var self = splitString && isString(this) ? strSplit(this, '') : object; |
5406 var length = self.length >>> 0; |
5480 var length = ES.ToUint32(self.length); |
5407 var result = []; |
5481 var result = []; |
5408 var value; |
5482 var value; |
5409 var T; |
5483 var T; |
5410 if (arguments.length > 1) { |
5484 if (arguments.length > 1) { |
5411 T = arguments[1]; |
5485 T = arguments[1]; |
5418 |
5492 |
5419 for (var i = 0; i < length; i++) { |
5493 for (var i = 0; i < length; i++) { |
5420 if (i in self) { |
5494 if (i in self) { |
5421 value = self[i]; |
5495 value = self[i]; |
5422 if (typeof T === 'undefined' ? callbackfn(value, i, object) : callbackfn.call(T, value, i, object)) { |
5496 if (typeof T === 'undefined' ? callbackfn(value, i, object) : callbackfn.call(T, value, i, object)) { |
5423 array_push.call(result, value); |
5497 push(result, value); |
5424 } |
5498 } |
5425 } |
5499 } |
5426 } |
5500 } |
5427 return result; |
5501 return result; |
5428 } |
5502 } |
5430 |
5504 |
5431 // ES5 15.4.4.16 |
5505 // ES5 15.4.4.16 |
5432 // http://es5.github.com/#x15.4.4.16 |
5506 // http://es5.github.com/#x15.4.4.16 |
5433 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every |
5507 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every |
5434 defineProperties(ArrayPrototype, { |
5508 defineProperties(ArrayPrototype, { |
5435 every: function every(callbackfn /*, thisArg*/) { |
5509 every: function every(callbackfn/*, thisArg*/) { |
5436 var object = ES.ToObject(this); |
5510 var object = ES.ToObject(this); |
5437 var self = splitString && isString(this) ? strSplit(this, '') : object; |
5511 var self = splitString && isString(this) ? strSplit(this, '') : object; |
5438 var length = self.length >>> 0; |
5512 var length = ES.ToUint32(self.length); |
5439 var T; |
5513 var T; |
5440 if (arguments.length > 1) { |
5514 if (arguments.length > 1) { |
5441 T = arguments[1]; |
5515 T = arguments[1]; |
5442 } |
5516 } |
5443 |
5517 |
5460 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some |
5534 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some |
5461 defineProperties(ArrayPrototype, { |
5535 defineProperties(ArrayPrototype, { |
5462 some: function some(callbackfn/*, thisArg */) { |
5536 some: function some(callbackfn/*, thisArg */) { |
5463 var object = ES.ToObject(this); |
5537 var object = ES.ToObject(this); |
5464 var self = splitString && isString(this) ? strSplit(this, '') : object; |
5538 var self = splitString && isString(this) ? strSplit(this, '') : object; |
5465 var length = self.length >>> 0; |
5539 var length = ES.ToUint32(self.length); |
5466 var T; |
5540 var T; |
5467 if (arguments.length > 1) { |
5541 if (arguments.length > 1) { |
5468 T = arguments[1]; |
5542 T = arguments[1]; |
5469 } |
5543 } |
5470 |
5544 |
5488 var reduceCoercesToObject = false; |
5562 var reduceCoercesToObject = false; |
5489 if (ArrayPrototype.reduce) { |
5563 if (ArrayPrototype.reduce) { |
5490 reduceCoercesToObject = typeof ArrayPrototype.reduce.call('es5', function (_, __, ___, list) { return list; }) === 'object'; |
5564 reduceCoercesToObject = typeof ArrayPrototype.reduce.call('es5', function (_, __, ___, list) { return list; }) === 'object'; |
5491 } |
5565 } |
5492 defineProperties(ArrayPrototype, { |
5566 defineProperties(ArrayPrototype, { |
5493 reduce: function reduce(callbackfn /*, initialValue*/) { |
5567 reduce: function reduce(callbackfn/*, initialValue*/) { |
5494 var object = ES.ToObject(this); |
5568 var object = ES.ToObject(this); |
5495 var self = splitString && isString(this) ? strSplit(this, '') : object; |
5569 var self = splitString && isString(this) ? strSplit(this, '') : object; |
5496 var length = self.length >>> 0; |
5570 var length = ES.ToUint32(self.length); |
5497 |
5571 |
5498 // If no callback function or if callback is not a callable function |
5572 // If no callback function or if callback is not a callable function |
5499 if (!isCallable(callbackfn)) { |
5573 if (!isCallable(callbackfn)) { |
5500 throw new TypeError('Array.prototype.reduce callback must be a function'); |
5574 throw new TypeError('Array.prototype.reduce callback must be a function'); |
5501 } |
5575 } |
5542 } |
5616 } |
5543 defineProperties(ArrayPrototype, { |
5617 defineProperties(ArrayPrototype, { |
5544 reduceRight: function reduceRight(callbackfn/*, initial*/) { |
5618 reduceRight: function reduceRight(callbackfn/*, initial*/) { |
5545 var object = ES.ToObject(this); |
5619 var object = ES.ToObject(this); |
5546 var self = splitString && isString(this) ? strSplit(this, '') : object; |
5620 var self = splitString && isString(this) ? strSplit(this, '') : object; |
5547 var length = self.length >>> 0; |
5621 var length = ES.ToUint32(self.length); |
5548 |
5622 |
5549 // If no callback function or if callback is not a callable function |
5623 // If no callback function or if callback is not a callable function |
5550 if (!isCallable(callbackfn)) { |
5624 if (!isCallable(callbackfn)) { |
5551 throw new TypeError('Array.prototype.reduceRight callback must be a function'); |
5625 throw new TypeError('Array.prototype.reduceRight callback must be a function'); |
5552 } |
5626 } |
5591 // ES5 15.4.4.14 |
5665 // ES5 15.4.4.14 |
5592 // http://es5.github.com/#x15.4.4.14 |
5666 // http://es5.github.com/#x15.4.4.14 |
5593 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf |
5667 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf |
5594 var hasFirefox2IndexOfBug = ArrayPrototype.indexOf && [0, 1].indexOf(1, 2) !== -1; |
5668 var hasFirefox2IndexOfBug = ArrayPrototype.indexOf && [0, 1].indexOf(1, 2) !== -1; |
5595 defineProperties(ArrayPrototype, { |
5669 defineProperties(ArrayPrototype, { |
5596 indexOf: function indexOf(searchElement /*, fromIndex */) { |
5670 indexOf: function indexOf(searchElement/*, fromIndex */) { |
5597 var self = splitString && isString(this) ? strSplit(this, '') : ES.ToObject(this); |
5671 var self = splitString && isString(this) ? strSplit(this, '') : ES.ToObject(this); |
5598 var length = self.length >>> 0; |
5672 var length = ES.ToUint32(self.length); |
5599 |
5673 |
5600 if (length === 0) { |
5674 if (length === 0) { |
5601 return -1; |
5675 return -1; |
5602 } |
5676 } |
5603 |
5677 |
5620 // ES5 15.4.4.15 |
5694 // ES5 15.4.4.15 |
5621 // http://es5.github.com/#x15.4.4.15 |
5695 // http://es5.github.com/#x15.4.4.15 |
5622 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf |
5696 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf |
5623 var hasFirefox2LastIndexOfBug = ArrayPrototype.lastIndexOf && [0, 1].lastIndexOf(0, -3) !== -1; |
5697 var hasFirefox2LastIndexOfBug = ArrayPrototype.lastIndexOf && [0, 1].lastIndexOf(0, -3) !== -1; |
5624 defineProperties(ArrayPrototype, { |
5698 defineProperties(ArrayPrototype, { |
5625 lastIndexOf: function lastIndexOf(searchElement /*, fromIndex */) { |
5699 lastIndexOf: function lastIndexOf(searchElement/*, fromIndex */) { |
5626 var self = splitString && isString(this) ? strSplit(this, '') : ES.ToObject(this); |
5700 var self = splitString && isString(this) ? strSplit(this, '') : ES.ToObject(this); |
5627 var length = self.length >>> 0; |
5701 var length = ES.ToUint32(self.length); |
5628 |
5702 |
5629 if (length === 0) { |
5703 if (length === 0) { |
5630 return -1; |
5704 return -1; |
5631 } |
5705 } |
5632 var i = length - 1; |
5706 var i = length - 1; |
5671 splice: function splice(start, deleteCount) { |
5745 splice: function splice(start, deleteCount) { |
5672 if (arguments.length === 0) { return []; } |
5746 if (arguments.length === 0) { return []; } |
5673 var args = arguments; |
5747 var args = arguments; |
5674 this.length = max(ES.ToInteger(this.length), 0); |
5748 this.length = max(ES.ToInteger(this.length), 0); |
5675 if (arguments.length > 0 && typeof deleteCount !== 'number') { |
5749 if (arguments.length > 0 && typeof deleteCount !== 'number') { |
5676 args = array_slice.call(arguments); |
5750 args = arraySlice(arguments); |
5677 if (args.length < 2) { |
5751 if (args.length < 2) { |
5678 array_push.call(args, this.length - start); |
5752 push(args, this.length - start); |
5679 } else { |
5753 } else { |
5680 args[1] = ES.ToInteger(deleteCount); |
5754 args[1] = ES.ToInteger(deleteCount); |
5681 } |
5755 } |
5682 } |
5756 } |
5683 return array_splice.apply(this, args); |
5757 return array_splice.apply(this, args); |
5720 A[k] = O[from]; |
5794 A[k] = O[from]; |
5721 } |
5795 } |
5722 k += 1; |
5796 k += 1; |
5723 } |
5797 } |
5724 |
5798 |
5725 var items = array_slice.call(arguments, 2); |
5799 var items = arraySlice(arguments, 2); |
5726 var itemCount = items.length; |
5800 var itemCount = items.length; |
5727 var to; |
5801 var to; |
5728 if (itemCount < actualDeleteCount) { |
5802 if (itemCount < actualDeleteCount) { |
5729 k = actualStart; |
5803 k = actualStart; |
5730 while (k < (len - actualDeleteCount)) { |
5804 while (k < (len - actualDeleteCount)) { |
5764 |
5838 |
5765 return A; |
5839 return A; |
5766 } |
5840 } |
5767 }, !spliceWorksWithLargeSparseArrays || !spliceWorksWithSmallSparseArrays); |
5841 }, !spliceWorksWithLargeSparseArrays || !spliceWorksWithSmallSparseArrays); |
5768 |
5842 |
5843 var originalJoin = ArrayPrototype.join; |
|
5844 var hasStringJoinBug; |
|
5845 try { |
|
5846 hasStringJoinBug = Array.prototype.join.call('123', ',') !== '1,2,3'; |
|
5847 } catch (e) { |
|
5848 hasStringJoinBug = true; |
|
5849 } |
|
5850 if (hasStringJoinBug) { |
|
5851 defineProperties(ArrayPrototype, { |
|
5852 join: function join(separator) { |
|
5853 var sep = typeof separator === 'undefined' ? ',' : separator; |
|
5854 return originalJoin.call(isString(this) ? strSplit(this, '') : this, sep); |
|
5855 } |
|
5856 }, hasStringJoinBug); |
|
5857 } |
|
5858 |
|
5859 var hasJoinUndefinedBug = [1, 2].join(undefined) !== '1,2'; |
|
5860 if (hasJoinUndefinedBug) { |
|
5861 defineProperties(ArrayPrototype, { |
|
5862 join: function join(separator) { |
|
5863 var sep = typeof separator === 'undefined' ? ',' : separator; |
|
5864 return originalJoin.call(this, sep); |
|
5865 } |
|
5866 }, hasJoinUndefinedBug); |
|
5867 } |
|
5868 |
|
5869 var pushShim = function push(item) { |
|
5870 var O = ES.ToObject(this); |
|
5871 var n = ES.ToUint32(O.length); |
|
5872 var i = 0; |
|
5873 while (i < arguments.length) { |
|
5874 O[n + i] = arguments[i]; |
|
5875 i += 1; |
|
5876 } |
|
5877 O.length = n + i; |
|
5878 return n + i; |
|
5879 }; |
|
5880 |
|
5881 var pushIsNotGeneric = (function () { |
|
5882 var obj = {}; |
|
5883 var result = Array.prototype.push.call(obj, undefined); |
|
5884 return result !== 1 || obj.length !== 1 || typeof obj[0] !== 'undefined' || !owns(obj, 0); |
|
5885 }()); |
|
5886 defineProperties(ArrayPrototype, { |
|
5887 push: function push(item) { |
|
5888 if (isArray(this)) { |
|
5889 return array_push.apply(this, arguments); |
|
5890 } |
|
5891 return pushShim.apply(this, arguments); |
|
5892 } |
|
5893 }, pushIsNotGeneric); |
|
5894 |
|
5895 // This fixes a very weird bug in Opera 10.6 when pushing `undefined |
|
5896 var pushUndefinedIsWeird = (function () { |
|
5897 var arr = []; |
|
5898 var result = arr.push(undefined); |
|
5899 return result !== 1 || arr.length !== 1 || typeof arr[0] !== 'undefined' || !owns(arr, 0); |
|
5900 }()); |
|
5901 defineProperties(ArrayPrototype, { push: pushShim }, pushUndefinedIsWeird); |
|
5902 |
|
5903 // ES5 15.2.3.14 |
|
5904 // http://es5.github.io/#x15.4.4.10 |
|
5905 // Fix boxed string bug |
|
5906 defineProperties(ArrayPrototype, { |
|
5907 slice: function (start, end) { |
|
5908 var arr = isString(this) ? strSplit(this, '') : this; |
|
5909 return arraySliceApply(arr, arguments); |
|
5910 } |
|
5911 }, splitString); |
|
5912 |
|
5913 var sortIgnoresNonFunctions = (function () { |
|
5914 try { |
|
5915 [1, 2].sort(null); |
|
5916 [1, 2].sort({}); |
|
5917 return true; |
|
5918 } catch (e) { /**/ } |
|
5919 return false; |
|
5920 }()); |
|
5921 var sortThrowsOnRegex = (function () { |
|
5922 // this is a problem in Firefox 4, in which `typeof /a/ === 'function'` |
|
5923 try { |
|
5924 [1, 2].sort(/a/); |
|
5925 return false; |
|
5926 } catch (e) { /**/ } |
|
5927 return true; |
|
5928 }()); |
|
5929 var sortIgnoresUndefined = (function () { |
|
5930 // applies in IE 8, for one. |
|
5931 try { |
|
5932 [1, 2].sort(undefined); |
|
5933 return true; |
|
5934 } catch (e) { /**/ } |
|
5935 return false; |
|
5936 }()); |
|
5937 defineProperties(ArrayPrototype, { |
|
5938 sort: function sort(compareFn) { |
|
5939 if (typeof compareFn === 'undefined') { |
|
5940 return arraySort(this); |
|
5941 } |
|
5942 if (!isCallable(compareFn)) { |
|
5943 throw new TypeError('Array.prototype.sort callback must be a function'); |
|
5944 } |
|
5945 return arraySort(this, compareFn); |
|
5946 } |
|
5947 }, sortIgnoresNonFunctions || !sortIgnoresUndefined || !sortThrowsOnRegex); |
|
5948 |
|
5769 // |
5949 // |
5770 // Object |
5950 // Object |
5771 // ====== |
5951 // ====== |
5772 // |
5952 // |
5773 |
5953 |
5785 var blacklistedKeys = { |
5965 var blacklistedKeys = { |
5786 $window: true, |
5966 $window: true, |
5787 $console: true, |
5967 $console: true, |
5788 $parent: true, |
5968 $parent: true, |
5789 $self: true, |
5969 $self: true, |
5970 $frame: true, |
|
5790 $frames: true, |
5971 $frames: true, |
5791 $frameElement: true, |
5972 $frameElement: true, |
5792 $webkitIndexedDB: true, |
5973 $webkitIndexedDB: true, |
5793 $webkitStorageInfo: true |
5974 $webkitStorageInfo: true, |
5975 $external: true |
|
5794 }; |
5976 }; |
5795 var hasAutomationEqualityBug = (function () { |
5977 var hasAutomationEqualityBug = (function () { |
5796 /* globals window */ |
5978 /* globals window */ |
5797 if (typeof window === 'undefined') { return false; } |
5979 if (typeof window === 'undefined') { return false; } |
5798 for (var k in window) { |
5980 for (var k in window) { |
5799 if (!blacklistedKeys['$' + k] && owns(window, k) && window[k] !== null && typeof window[k] === 'object') { |
5981 try { |
5800 try { |
5982 if (!blacklistedKeys['$' + k] && owns(window, k) && window[k] !== null && typeof window[k] === 'object') { |
5801 equalsConstructorPrototype(window[k]); |
5983 equalsConstructorPrototype(window[k]); |
5802 } catch (e) { |
5984 } |
5803 return true; |
5985 } catch (e) { |
5804 } |
5986 return true; |
5805 } |
5987 } |
5806 } |
5988 } |
5807 return false; |
5989 return false; |
5808 }()); |
5990 }()); |
5809 var equalsConstructorPrototypeIfNotBuggy = function (object) { |
5991 var equalsConstructorPrototypeIfNotBuggy = function (object) { |
5823 'propertyIsEnumerable', |
6005 'propertyIsEnumerable', |
5824 'constructor' |
6006 'constructor' |
5825 ]; |
6007 ]; |
5826 var dontEnumsLength = dontEnums.length; |
6008 var dontEnumsLength = dontEnums.length; |
5827 |
6009 |
5828 var isArguments = function isArguments(value) { |
6010 // taken directly from https://github.com/ljharb/is-arguments/blob/master/index.js |
5829 var str = toStr(value); |
6011 // can be replaced with require('is-arguments') if we ever use a build process instead |
5830 var isArgs = str === '[object Arguments]'; |
6012 var isStandardArguments = function isArguments(value) { |
5831 if (!isArgs) { |
6013 return toStr(value) === '[object Arguments]'; |
5832 isArgs = !isArray(value) && |
|
5833 value !== null && |
|
5834 typeof value === 'object' && |
|
5835 typeof value.length === 'number' && |
|
5836 value.length >= 0 && |
|
5837 isCallable(value.callee); |
|
5838 } |
|
5839 return isArgs; |
|
5840 }; |
6014 }; |
6015 var isLegacyArguments = function isArguments(value) { |
|
6016 return value !== null && |
|
6017 typeof value === 'object' && |
|
6018 typeof value.length === 'number' && |
|
6019 value.length >= 0 && |
|
6020 !isArray(value) && |
|
6021 isCallable(value.callee); |
|
6022 }; |
|
6023 var isArguments = isStandardArguments(arguments) ? isStandardArguments : isLegacyArguments; |
|
5841 |
6024 |
5842 defineProperties($Object, { |
6025 defineProperties($Object, { |
5843 keys: function keys(object) { |
6026 keys: function keys(object) { |
5844 var isFn = isCallable(object); |
6027 var isFn = isCallable(object); |
5845 var isArgs = isArguments(object); |
6028 var isArgs = isArguments(object); |
5852 |
6035 |
5853 var theKeys = []; |
6036 var theKeys = []; |
5854 var skipProto = hasProtoEnumBug && isFn; |
6037 var skipProto = hasProtoEnumBug && isFn; |
5855 if ((isStr && hasStringEnumBug) || isArgs) { |
6038 if ((isStr && hasStringEnumBug) || isArgs) { |
5856 for (var i = 0; i < object.length; ++i) { |
6039 for (var i = 0; i < object.length; ++i) { |
5857 array_push.call(theKeys, $String(i)); |
6040 push(theKeys, $String(i)); |
5858 } |
6041 } |
5859 } |
6042 } |
5860 |
6043 |
5861 if (!isArgs) { |
6044 if (!isArgs) { |
5862 for (var name in object) { |
6045 for (var name in object) { |
5863 if (!(skipProto && name === 'prototype') && owns(object, name)) { |
6046 if (!(skipProto && name === 'prototype') && owns(object, name)) { |
5864 array_push.call(theKeys, $String(name)); |
6047 push(theKeys, $String(name)); |
5865 } |
6048 } |
5866 } |
6049 } |
5867 } |
6050 } |
5868 |
6051 |
5869 if (hasDontEnumBug) { |
6052 if (hasDontEnumBug) { |
5870 var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); |
6053 var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); |
5871 for (var j = 0; j < dontEnumsLength; j++) { |
6054 for (var j = 0; j < dontEnumsLength; j++) { |
5872 var dontEnum = dontEnums[j]; |
6055 var dontEnum = dontEnums[j]; |
5873 if (!(skipConstructor && dontEnum === 'constructor') && owns(object, dontEnum)) { |
6056 if (!(skipConstructor && dontEnum === 'constructor') && owns(object, dontEnum)) { |
5874 array_push.call(theKeys, dontEnum); |
6057 push(theKeys, dontEnum); |
5875 } |
6058 } |
5876 } |
6059 } |
5877 } |
6060 } |
5878 return theKeys; |
6061 return theKeys; |
5879 } |
6062 } |
5881 |
6064 |
5882 var keysWorksWithArguments = $Object.keys && (function () { |
6065 var keysWorksWithArguments = $Object.keys && (function () { |
5883 // Safari 5.0 bug |
6066 // Safari 5.0 bug |
5884 return $Object.keys(arguments).length === 2; |
6067 return $Object.keys(arguments).length === 2; |
5885 }(1, 2)); |
6068 }(1, 2)); |
6069 var keysHasArgumentsLengthBug = $Object.keys && (function () { |
|
6070 var argKeys = $Object.keys(arguments); |
|
6071 return arguments.length !== 1 || argKeys.length !== 1 || argKeys[0] !== 1; |
|
6072 }(1)); |
|
5886 var originalKeys = $Object.keys; |
6073 var originalKeys = $Object.keys; |
5887 defineProperties($Object, { |
6074 defineProperties($Object, { |
5888 keys: function keys(object) { |
6075 keys: function keys(object) { |
5889 if (isArguments(object)) { |
6076 if (isArguments(object)) { |
5890 return originalKeys(array_slice.call(object)); |
6077 return originalKeys(arraySlice(object)); |
5891 } else { |
6078 } else { |
5892 return originalKeys(object); |
6079 return originalKeys(object); |
5893 } |
6080 } |
5894 } |
6081 } |
5895 }, !keysWorksWithArguments); |
6082 }, !keysWorksWithArguments || keysHasArgumentsLengthBug); |
5896 |
6083 |
5897 // |
6084 // |
5898 // Date |
6085 // Date |
5899 // ==== |
6086 // ==== |
5900 // |
6087 // |
5941 result[length] = '0' + value; |
6128 result[length] = '0' + value; |
5942 } |
6129 } |
5943 } |
6130 } |
5944 // pad milliseconds to have three digits. |
6131 // pad milliseconds to have three digits. |
5945 return ( |
6132 return ( |
5946 year + '-' + array_slice.call(result, 0, 2).join('-') + |
6133 year + '-' + arraySlice(result, 0, 2).join('-') + |
5947 'T' + array_slice.call(result, 2).join(':') + '.' + |
6134 'T' + arraySlice(result, 2).join(':') + '.' + |
5948 strSlice('000' + this.getUTCMilliseconds(), -3) + 'Z' |
6135 strSlice('000' + this.getUTCMilliseconds(), -3) + 'Z' |
5949 ); |
6136 ); |
5950 } |
6137 } |
5951 }, hasNegativeDateBug || hasSafari51DateBug); |
6138 }, hasNegativeDateBug || hasSafari51DateBug); |
5952 |
6139 |
6007 // based on work shared by Daniel Friesen (dantman) |
6194 // based on work shared by Daniel Friesen (dantman) |
6008 // http://gist.github.com/303249 |
6195 // http://gist.github.com/303249 |
6009 var supportsExtendedYears = Date.parse('+033658-09-27T01:46:40.000Z') === 1e15; |
6196 var supportsExtendedYears = Date.parse('+033658-09-27T01:46:40.000Z') === 1e15; |
6010 var acceptsInvalidDates = !isNaN(Date.parse('2012-04-04T24:00:00.500Z')) || !isNaN(Date.parse('2012-11-31T23:59:59.000Z')) || !isNaN(Date.parse('2012-12-31T23:59:60.000Z')); |
6197 var acceptsInvalidDates = !isNaN(Date.parse('2012-04-04T24:00:00.500Z')) || !isNaN(Date.parse('2012-11-31T23:59:59.000Z')) || !isNaN(Date.parse('2012-12-31T23:59:60.000Z')); |
6011 var doesNotParseY2KNewYear = isNaN(Date.parse('2000-01-01T00:00:00.000Z')); |
6198 var doesNotParseY2KNewYear = isNaN(Date.parse('2000-01-01T00:00:00.000Z')); |
6012 if (!Date.parse || doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExtendedYears) { |
6199 if (doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExtendedYears) { |
6013 // XXX global assignment won't work in embeddings that use |
6200 // XXX global assignment won't work in embeddings that use |
6014 // an alternate object for the context. |
6201 // an alternate object for the context. |
6015 /* global Date: true */ |
6202 /* global Date: true */ |
6016 /* eslint-disable no-undef */ |
6203 /* eslint-disable no-undef */ |
6204 var maxSafeUnsigned32Bit = Math.pow(2, 31) - 1; |
|
6205 var hasSafariSignedIntBug = isActualNaN(new Date(1970, 0, 1, 0, 0, 0, maxSafeUnsigned32Bit + 1).getTime()); |
|
6017 Date = (function (NativeDate) { |
6206 Date = (function (NativeDate) { |
6018 /* eslint-enable no-undef */ |
6207 /* eslint-enable no-undef */ |
6019 // Date.length === 7 |
6208 // Date.length === 7 |
6020 var DateShim = function Date(Y, M, D, h, m, s, ms) { |
6209 var DateShim = function Date(Y, M, D, h, m, s, ms) { |
6021 var length = arguments.length; |
6210 var length = arguments.length; |
6022 var date; |
6211 var date; |
6023 if (this instanceof NativeDate) { |
6212 if (this instanceof NativeDate) { |
6213 var seconds = s; |
|
6214 var millis = ms; |
|
6215 if (hasSafariSignedIntBug && length >= 7 && ms > maxSafeUnsigned32Bit) { |
|
6216 // work around a Safari 8/9 bug where it treats the seconds as signed |
|
6217 var msToShift = Math.floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit; |
|
6218 var sToShift = Math.floor(msToShift / 1e3); |
|
6219 seconds += sToShift; |
|
6220 millis -= sToShift * 1e3; |
|
6221 } |
|
6024 date = length === 1 && $String(Y) === Y ? // isString(Y) |
6222 date = length === 1 && $String(Y) === Y ? // isString(Y) |
6025 // We explicitly pass it through parse: |
6223 // We explicitly pass it through parse: |
6026 new NativeDate(DateShim.parse(Y)) : |
6224 new NativeDate(DateShim.parse(Y)) : |
6027 // We have to manually make calls depending on argument |
6225 // We have to manually make calls depending on argument |
6028 // length here |
6226 // length here |
6029 length >= 7 ? new NativeDate(Y, M, D, h, m, s, ms) : |
6227 length >= 7 ? new NativeDate(Y, M, D, h, m, seconds, millis) : |
6030 length >= 6 ? new NativeDate(Y, M, D, h, m, s) : |
6228 length >= 6 ? new NativeDate(Y, M, D, h, m, seconds) : |
6031 length >= 5 ? new NativeDate(Y, M, D, h, m) : |
6229 length >= 5 ? new NativeDate(Y, M, D, h, m) : |
6032 length >= 4 ? new NativeDate(Y, M, D, h) : |
6230 length >= 4 ? new NativeDate(Y, M, D, h) : |
6033 length >= 3 ? new NativeDate(Y, M, D) : |
6231 length >= 3 ? new NativeDate(Y, M, D) : |
6034 length >= 2 ? new NativeDate(Y, M) : |
6232 length >= 2 ? new NativeDate(Y, M) : |
6035 length >= 1 ? new NativeDate(Y) : |
6233 length >= 1 ? new NativeDate(Y) : |
6036 new NativeDate(); |
6234 new NativeDate(); |
6037 } else { |
6235 } else { |
6038 date = NativeDate.apply(this, arguments); |
6236 date = NativeDate.apply(this, arguments); |
6039 } |
6237 } |
6040 // Prevent mixups with unfixed Date object |
6238 if (!isPrimitive(date)) { |
6041 defineProperties(date, { constructor: DateShim }, true); |
6239 // Prevent mixups with unfixed Date object |
6240 defineProperties(date, { constructor: DateShim }, true); |
|
6241 } |
|
6042 return date; |
6242 return date; |
6043 }; |
6243 }; |
6044 |
6244 |
6045 // 15.9.1.15 Date Time String Format. |
6245 // 15.9.1.15 Date Time String Format. |
6046 var isoDateExpression = new RegExp('^' + |
6246 var isoDateExpression = new RegExp('^' + |
6077 365 * (year - 1970) |
6277 365 * (year - 1970) |
6078 ); |
6278 ); |
6079 }; |
6279 }; |
6080 |
6280 |
6081 var toUTC = function toUTC(t) { |
6281 var toUTC = function toUTC(t) { |
6082 return $Number(new NativeDate(1970, 0, 1, 0, 0, 0, t)); |
6282 var s = 0; |
6283 var ms = t; |
|
6284 if (hasSafariSignedIntBug && ms > maxSafeUnsigned32Bit) { |
|
6285 // work around a Safari 8/9 bug where it treats the seconds as signed |
|
6286 var msToShift = Math.floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit; |
|
6287 var sToShift = Math.floor(msToShift / 1e3); |
|
6288 s += sToShift; |
|
6289 ms -= sToShift * 1e3; |
|
6290 } |
|
6291 return $Number(new NativeDate(1970, 0, 1, 0, 0, s, ms)); |
|
6083 }; |
6292 }; |
6084 |
6293 |
6085 // Copy any custom methods a 3rd party library may have added |
6294 // Copy any custom methods a 3rd party library may have added |
6086 for (var key in NativeDate) { |
6295 for (var key in NativeDate) { |
6087 if (owns(NativeDate, key)) { |
6296 if (owns(NativeDate, key)) { |
6119 isLocalTime = Boolean(match[4] && !match[8]), |
6328 isLocalTime = Boolean(match[4] && !match[8]), |
6120 signOffset = match[9] === '-' ? 1 : -1, |
6329 signOffset = match[9] === '-' ? 1 : -1, |
6121 hourOffset = $Number(match[10] || 0), |
6330 hourOffset = $Number(match[10] || 0), |
6122 minuteOffset = $Number(match[11] || 0), |
6331 minuteOffset = $Number(match[11] || 0), |
6123 result; |
6332 result; |
6333 var hasMinutesOrSecondsOrMilliseconds = minute > 0 || second > 0 || millisecond > 0; |
|
6124 if ( |
6334 if ( |
6125 hour < ( |
6335 hour < (hasMinutesOrSecondsOrMilliseconds ? 24 : 25) && |
6126 minute > 0 || second > 0 || millisecond > 0 ? |
|
6127 24 : 25 |
|
6128 ) && |
|
6129 minute < 60 && second < 60 && millisecond < 1000 && |
6336 minute < 60 && second < 60 && millisecond < 1000 && |
6130 month > -1 && month < 12 && hourOffset < 24 && |
6337 month > -1 && month < 12 && hourOffset < 24 && |
6131 minuteOffset < 60 && // detect invalid offsets |
6338 minuteOffset < 60 && // detect invalid offsets |
6132 day > -1 && |
6339 day > -1 && |
6133 day < ( |
6340 day < (dayFromMonth(year, month + 1) - dayFromMonth(year, month)) |
6134 dayFromMonth(year, month + 1) - |
|
6135 dayFromMonth(year, month) |
|
6136 ) |
|
6137 ) { |
6341 ) { |
6138 result = ( |
6342 result = ( |
6139 (dayFromMonth(year, month) + day) * 24 + |
6343 (dayFromMonth(year, month) + day) * 24 + |
6140 hour + |
6344 hour + |
6141 hourOffset * signOffset |
6345 hourOffset * signOffset |
6236 } |
6440 } |
6237 return n; |
6441 return n; |
6238 } |
6442 } |
6239 }; |
6443 }; |
6240 |
6444 |
6445 var toFixedShim = function toFixed(fractionDigits) { |
|
6446 var f, x, s, m, e, z, j, k; |
|
6447 |
|
6448 // Test for NaN and round fractionDigits down |
|
6449 f = $Number(fractionDigits); |
|
6450 f = isActualNaN(f) ? 0 : Math.floor(f); |
|
6451 |
|
6452 if (f < 0 || f > 20) { |
|
6453 throw new RangeError('Number.toFixed called with invalid number of decimals'); |
|
6454 } |
|
6455 |
|
6456 x = $Number(this); |
|
6457 |
|
6458 if (isActualNaN(x)) { |
|
6459 return 'NaN'; |
|
6460 } |
|
6461 |
|
6462 // If it is too big or small, return the string value of the number |
|
6463 if (x <= -1e21 || x >= 1e21) { |
|
6464 return $String(x); |
|
6465 } |
|
6466 |
|
6467 s = ''; |
|
6468 |
|
6469 if (x < 0) { |
|
6470 s = '-'; |
|
6471 x = -x; |
|
6472 } |
|
6473 |
|
6474 m = '0'; |
|
6475 |
|
6476 if (x > 1e-21) { |
|
6477 // 1e-21 < x < 1e21 |
|
6478 // -70 < log2(x) < 70 |
|
6479 e = toFixedHelpers.log(x * toFixedHelpers.pow(2, 69, 1)) - 69; |
|
6480 z = (e < 0 ? x * toFixedHelpers.pow(2, -e, 1) : x / toFixedHelpers.pow(2, e, 1)); |
|
6481 z *= 0x10000000000000; // Math.pow(2, 52); |
|
6482 e = 52 - e; |
|
6483 |
|
6484 // -18 < e < 122 |
|
6485 // x = z / 2 ^ e |
|
6486 if (e > 0) { |
|
6487 toFixedHelpers.multiply(0, z); |
|
6488 j = f; |
|
6489 |
|
6490 while (j >= 7) { |
|
6491 toFixedHelpers.multiply(1e7, 0); |
|
6492 j -= 7; |
|
6493 } |
|
6494 |
|
6495 toFixedHelpers.multiply(toFixedHelpers.pow(10, j, 1), 0); |
|
6496 j = e - 1; |
|
6497 |
|
6498 while (j >= 23) { |
|
6499 toFixedHelpers.divide(1 << 23); |
|
6500 j -= 23; |
|
6501 } |
|
6502 |
|
6503 toFixedHelpers.divide(1 << j); |
|
6504 toFixedHelpers.multiply(1, 1); |
|
6505 toFixedHelpers.divide(2); |
|
6506 m = toFixedHelpers.numToString(); |
|
6507 } else { |
|
6508 toFixedHelpers.multiply(0, z); |
|
6509 toFixedHelpers.multiply(1 << (-e), 0); |
|
6510 m = toFixedHelpers.numToString() + strSlice('0.00000000000000000000', 2, 2 + f); |
|
6511 } |
|
6512 } |
|
6513 |
|
6514 if (f > 0) { |
|
6515 k = m.length; |
|
6516 |
|
6517 if (k <= f) { |
|
6518 m = s + strSlice('0.0000000000000000000', 0, f - k + 2) + m; |
|
6519 } else { |
|
6520 m = s + strSlice(m, 0, k - f) + '.' + strSlice(m, k - f); |
|
6521 } |
|
6522 } else { |
|
6523 m = s + m; |
|
6524 } |
|
6525 |
|
6526 return m; |
|
6527 }; |
|
6528 defineProperties(NumberPrototype, { toFixed: toFixedShim }, hasToFixedBugs); |
|
6529 |
|
6530 var hasToPrecisionUndefinedBug = (function () { |
|
6531 try { |
|
6532 return 1.0.toPrecision(undefined) === '1'; |
|
6533 } catch (e) { |
|
6534 return true; |
|
6535 } |
|
6536 }()); |
|
6537 var originalToPrecision = NumberPrototype.toPrecision; |
|
6241 defineProperties(NumberPrototype, { |
6538 defineProperties(NumberPrototype, { |
6242 toFixed: function toFixed(fractionDigits) { |
6539 toPrecision: function toPrecision(precision) { |
6243 var f, x, s, m, e, z, j, k; |
6540 return typeof precision === 'undefined' ? originalToPrecision.call(this) : originalToPrecision.call(this, precision); |
6244 |
|
6245 // Test for NaN and round fractionDigits down |
|
6246 f = $Number(fractionDigits); |
|
6247 f = f !== f ? 0 : Math.floor(f); |
|
6248 |
|
6249 if (f < 0 || f > 20) { |
|
6250 throw new RangeError('Number.toFixed called with invalid number of decimals'); |
|
6251 } |
|
6252 |
|
6253 x = $Number(this); |
|
6254 |
|
6255 // Test for NaN |
|
6256 if (x !== x) { |
|
6257 return 'NaN'; |
|
6258 } |
|
6259 |
|
6260 // If it is too big or small, return the string value of the number |
|
6261 if (x <= -1e21 || x >= 1e21) { |
|
6262 return $String(x); |
|
6263 } |
|
6264 |
|
6265 s = ''; |
|
6266 |
|
6267 if (x < 0) { |
|
6268 s = '-'; |
|
6269 x = -x; |
|
6270 } |
|
6271 |
|
6272 m = '0'; |
|
6273 |
|
6274 if (x > 1e-21) { |
|
6275 // 1e-21 < x < 1e21 |
|
6276 // -70 < log2(x) < 70 |
|
6277 e = toFixedHelpers.log(x * toFixedHelpers.pow(2, 69, 1)) - 69; |
|
6278 z = (e < 0 ? x * toFixedHelpers.pow(2, -e, 1) : x / toFixedHelpers.pow(2, e, 1)); |
|
6279 z *= 0x10000000000000; // Math.pow(2, 52); |
|
6280 e = 52 - e; |
|
6281 |
|
6282 // -18 < e < 122 |
|
6283 // x = z / 2 ^ e |
|
6284 if (e > 0) { |
|
6285 toFixedHelpers.multiply(0, z); |
|
6286 j = f; |
|
6287 |
|
6288 while (j >= 7) { |
|
6289 toFixedHelpers.multiply(1e7, 0); |
|
6290 j -= 7; |
|
6291 } |
|
6292 |
|
6293 toFixedHelpers.multiply(toFixedHelpers.pow(10, j, 1), 0); |
|
6294 j = e - 1; |
|
6295 |
|
6296 while (j >= 23) { |
|
6297 toFixedHelpers.divide(1 << 23); |
|
6298 j -= 23; |
|
6299 } |
|
6300 |
|
6301 toFixedHelpers.divide(1 << j); |
|
6302 toFixedHelpers.multiply(1, 1); |
|
6303 toFixedHelpers.divide(2); |
|
6304 m = toFixedHelpers.numToString(); |
|
6305 } else { |
|
6306 toFixedHelpers.multiply(0, z); |
|
6307 toFixedHelpers.multiply(1 << (-e), 0); |
|
6308 m = toFixedHelpers.numToString() + strSlice('0.00000000000000000000', 2, 2 + f); |
|
6309 } |
|
6310 } |
|
6311 |
|
6312 if (f > 0) { |
|
6313 k = m.length; |
|
6314 |
|
6315 if (k <= f) { |
|
6316 m = s + strSlice('0.0000000000000000000', 0, f - k + 2) + m; |
|
6317 } else { |
|
6318 m = s + strSlice(m, 0, k - f) + '.' + strSlice(m, k - f); |
|
6319 } |
|
6320 } else { |
|
6321 m = s + m; |
|
6322 } |
|
6323 |
|
6324 return m; |
|
6325 } |
6541 } |
6326 }, hasToFixedBugs); |
6542 }, hasToPrecisionUndefinedBug); |
6327 |
6543 |
6328 // |
6544 // |
6329 // String |
6545 // String |
6330 // ====== |
6546 // ====== |
6331 // |
6547 // |
6353 ''.split(/.?/).length || |
6569 ''.split(/.?/).length || |
6354 '.'.split(/()()/).length > 1 |
6570 '.'.split(/()()/).length > 1 |
6355 ) { |
6571 ) { |
6356 (function () { |
6572 (function () { |
6357 var compliantExecNpcg = typeof (/()??/).exec('')[1] === 'undefined'; // NPCG: nonparticipating capturing group |
6573 var compliantExecNpcg = typeof (/()??/).exec('')[1] === 'undefined'; // NPCG: nonparticipating capturing group |
6574 var maxSafe32BitInt = Math.pow(2, 32) - 1; |
|
6358 |
6575 |
6359 StringPrototype.split = function (separator, limit) { |
6576 StringPrototype.split = function (separator, limit) { |
6360 var string = this; |
6577 var string = String(this); |
6361 if (typeof separator === 'undefined' && limit === 0) { |
6578 if (typeof separator === 'undefined' && limit === 0) { |
6362 return []; |
6579 return []; |
6363 } |
6580 } |
6364 |
6581 |
6365 // If `separator` is not a regex, use native split |
6582 // If `separator` is not a regex, use native split |
6374 (separator.sticky ? 'y' : ''), // Firefox 3+ and ES6 |
6591 (separator.sticky ? 'y' : ''), // Firefox 3+ and ES6 |
6375 lastLastIndex = 0, |
6592 lastLastIndex = 0, |
6376 // Make `global` and avoid `lastIndex` issues by working with a copy |
6593 // Make `global` and avoid `lastIndex` issues by working with a copy |
6377 separator2, match, lastIndex, lastLength; |
6594 separator2, match, lastIndex, lastLength; |
6378 var separatorCopy = new RegExp(separator.source, flags + 'g'); |
6595 var separatorCopy = new RegExp(separator.source, flags + 'g'); |
6379 string += ''; // Type-convert |
|
6380 if (!compliantExecNpcg) { |
6596 if (!compliantExecNpcg) { |
6381 // Doesn't need flags gy, but they don't hurt |
6597 // Doesn't need flags gy, but they don't hurt |
6382 separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); |
6598 separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); |
6383 } |
6599 } |
6384 /* Values for `limit`, per the spec: |
6600 /* Values for `limit`, per the spec: |
6385 * If undefined: 4294967295 // Math.pow(2, 32) - 1 |
6601 * If undefined: 4294967295 // maxSafe32BitInt |
6386 * If 0, Infinity, or NaN: 0 |
6602 * If 0, Infinity, or NaN: 0 |
6387 * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296; |
6603 * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296; |
6388 * If negative number: 4294967296 - Math.floor(Math.abs(limit)) |
6604 * If negative number: 4294967296 - Math.floor(Math.abs(limit)) |
6389 * If other: Type-convert, then use the above rules |
6605 * If other: Type-convert, then use the above rules |
6390 */ |
6606 */ |
6391 var splitLimit = typeof limit === 'undefined' ? |
6607 var splitLimit = typeof limit === 'undefined' ? maxSafe32BitInt : ES.ToUint32(limit); |
6392 -1 >>> 0 : // Math.pow(2, 32) - 1 |
|
6393 ES.ToUint32(limit); |
|
6394 match = separatorCopy.exec(string); |
6608 match = separatorCopy.exec(string); |
6395 while (match) { |
6609 while (match) { |
6396 // `separatorCopy.lastIndex` is not reliable cross-browser |
6610 // `separatorCopy.lastIndex` is not reliable cross-browser |
6397 lastIndex = match.index + match[0].length; |
6611 lastIndex = match.index + match[0].length; |
6398 if (lastIndex > lastLastIndex) { |
6612 if (lastIndex > lastLastIndex) { |
6399 array_push.call(output, strSlice(string, lastLastIndex, match.index)); |
6613 push(output, strSlice(string, lastLastIndex, match.index)); |
6400 // Fix browsers whose `exec` methods don't consistently return `undefined` for |
6614 // Fix browsers whose `exec` methods don't consistently return `undefined` for |
6401 // nonparticipating capturing groups |
6615 // nonparticipating capturing groups |
6402 if (!compliantExecNpcg && match.length > 1) { |
6616 if (!compliantExecNpcg && match.length > 1) { |
6403 /* eslint-disable no-loop-func */ |
6617 /* eslint-disable no-loop-func */ |
6404 match[0].replace(separator2, function () { |
6618 match[0].replace(separator2, function () { |
6409 } |
6623 } |
6410 }); |
6624 }); |
6411 /* eslint-enable no-loop-func */ |
6625 /* eslint-enable no-loop-func */ |
6412 } |
6626 } |
6413 if (match.length > 1 && match.index < string.length) { |
6627 if (match.length > 1 && match.index < string.length) { |
6414 array_push.apply(output, array_slice.call(match, 1)); |
6628 array_push.apply(output, arraySlice(match, 1)); |
6415 } |
6629 } |
6416 lastLength = match[0].length; |
6630 lastLength = match[0].length; |
6417 lastLastIndex = lastIndex; |
6631 lastLastIndex = lastIndex; |
6418 if (output.length >= splitLimit) { |
6632 if (output.length >= splitLimit) { |
6419 break; |
6633 break; |
6424 } |
6638 } |
6425 match = separatorCopy.exec(string); |
6639 match = separatorCopy.exec(string); |
6426 } |
6640 } |
6427 if (lastLastIndex === string.length) { |
6641 if (lastLastIndex === string.length) { |
6428 if (lastLength || !separatorCopy.test('')) { |
6642 if (lastLength || !separatorCopy.test('')) { |
6429 array_push.call(output, ''); |
6643 push(output, ''); |
6430 } |
6644 } |
6431 } else { |
6645 } else { |
6432 array_push.call(output, strSlice(string, lastLastIndex)); |
6646 push(output, strSlice(string, lastLastIndex)); |
6433 } |
6647 } |
6434 return output.length > splitLimit ? strSlice(output, 0, splitLimit) : output; |
6648 return output.length > splitLimit ? strSlice(output, 0, splitLimit) : output; |
6435 }; |
6649 }; |
6436 }()); |
6650 }()); |
6437 |
6651 |
6450 |
6664 |
6451 var str_replace = StringPrototype.replace; |
6665 var str_replace = StringPrototype.replace; |
6452 var replaceReportsGroupsCorrectly = (function () { |
6666 var replaceReportsGroupsCorrectly = (function () { |
6453 var groups = []; |
6667 var groups = []; |
6454 'x'.replace(/x(.)?/g, function (match, group) { |
6668 'x'.replace(/x(.)?/g, function (match, group) { |
6455 array_push.call(groups, group); |
6669 push(groups, group); |
6456 }); |
6670 }); |
6457 return groups.length === 1 && typeof groups[0] === 'undefined'; |
6671 return groups.length === 1 && typeof groups[0] === 'undefined'; |
6458 }()); |
6672 }()); |
6459 |
6673 |
6460 if (!replaceReportsGroupsCorrectly) { |
6674 if (!replaceReportsGroupsCorrectly) { |
6468 var length = arguments.length; |
6682 var length = arguments.length; |
6469 var originalLastIndex = searchValue.lastIndex; |
6683 var originalLastIndex = searchValue.lastIndex; |
6470 searchValue.lastIndex = 0; |
6684 searchValue.lastIndex = 0; |
6471 var args = searchValue.exec(match) || []; |
6685 var args = searchValue.exec(match) || []; |
6472 searchValue.lastIndex = originalLastIndex; |
6686 searchValue.lastIndex = originalLastIndex; |
6473 array_push.call(args, arguments[length - 2], arguments[length - 1]); |
6687 push(args, arguments[length - 2], arguments[length - 1]); |
6474 return replaceValue.apply(this, args); |
6688 return replaceValue.apply(this, args); |
6475 }; |
6689 }; |
6476 return str_replace.call(this, searchValue, wrappedReplaceValue); |
6690 return str_replace.call(this, searchValue, wrappedReplaceValue); |
6477 } |
6691 } |
6478 }; |
6692 }; |
6514 } |
6728 } |
6515 return $String(this).replace(trimBeginRegexp, '').replace(trimEndRegexp, ''); |
6729 return $String(this).replace(trimBeginRegexp, '').replace(trimEndRegexp, ''); |
6516 } |
6730 } |
6517 }, hasTrimWhitespaceBug); |
6731 }, hasTrimWhitespaceBug); |
6518 |
6732 |
6733 var hasLastIndexBug = StringPrototype.lastIndexOf && 'abcあい'.lastIndexOf('あい', 2) !== -1; |
|
6734 defineProperties(StringPrototype, { |
|
6735 lastIndexOf: function lastIndexOf(searchString) { |
|
6736 if (typeof this === 'undefined' || this === null) { |
|
6737 throw new TypeError("can't convert " + this + ' to object'); |
|
6738 } |
|
6739 var S = $String(this); |
|
6740 var searchStr = $String(searchString); |
|
6741 var numPos = arguments.length > 1 ? $Number(arguments[1]) : NaN; |
|
6742 var pos = isActualNaN(numPos) ? Infinity : ES.ToInteger(numPos); |
|
6743 var start = min(max(pos, 0), S.length); |
|
6744 var searchLen = searchStr.length; |
|
6745 var k = start + searchLen; |
|
6746 while (k > 0) { |
|
6747 k = max(0, k - searchLen); |
|
6748 var index = strIndexOf(strSlice(S, k, start + searchLen), searchStr); |
|
6749 if (index !== -1) { |
|
6750 return k + index; |
|
6751 } |
|
6752 } |
|
6753 return -1; |
|
6754 } |
|
6755 }, hasLastIndexBug); |
|
6756 |
|
6757 var originalLastIndexOf = StringPrototype.lastIndexOf; |
|
6758 defineProperties(StringPrototype, { |
|
6759 lastIndexOf: function lastIndexOf(searchString) { |
|
6760 return originalLastIndexOf.apply(this, arguments); |
|
6761 } |
|
6762 }, StringPrototype.lastIndexOf.length !== 1); |
|
6763 |
|
6519 // ES-5 15.1.2.2 |
6764 // ES-5 15.1.2.2 |
6765 /* eslint-disable radix */ |
|
6520 if (parseInt(ws + '08') !== 8 || parseInt(ws + '0x16') !== 22) { |
6766 if (parseInt(ws + '08') !== 8 || parseInt(ws + '0x16') !== 22) { |
6767 /* eslint-enable radix */ |
|
6521 /* global parseInt: true */ |
6768 /* global parseInt: true */ |
6522 parseInt = (function (origParseInt) { |
6769 parseInt = (function (origParseInt) { |
6523 var hexRegex = /^0[xX]/; |
6770 var hexRegex = /^[\-+]?0[xX]/; |
6524 return function parseInt(str, radix) { |
6771 return function parseInt(str, radix) { |
6525 var string = $String(str).trim(); |
6772 var string = $String(str).trim(); |
6526 var defaultedRadix = $Number(radix) || (hexRegex.test(string) ? 16 : 10); |
6773 var defaultedRadix = $Number(radix) || (hexRegex.test(string) ? 16 : 10); |
6527 return origParseInt(string, defaultedRadix); |
6774 return origParseInt(string, defaultedRadix); |
6528 }; |
6775 }; |
6529 }(parseInt)); |
6776 }(parseInt)); |
6777 } |
|
6778 |
|
6779 if (String(new RangeError('test')) !== 'RangeError: test') { |
|
6780 var errorToStringShim = function toString() { |
|
6781 if (typeof this === 'undefined' || this === null) { |
|
6782 throw new TypeError("can't convert " + this + ' to object'); |
|
6783 } |
|
6784 var name = this.name; |
|
6785 if (typeof name === 'undefined') { |
|
6786 name = 'Error'; |
|
6787 } else if (typeof name !== 'string') { |
|
6788 name = $String(name); |
|
6789 } |
|
6790 var msg = this.message; |
|
6791 if (typeof msg === 'undefined') { |
|
6792 msg = ''; |
|
6793 } else if (typeof msg !== 'string') { |
|
6794 msg = $String(msg); |
|
6795 } |
|
6796 if (!name) { |
|
6797 return msg; |
|
6798 } |
|
6799 if (!msg) { |
|
6800 return name; |
|
6801 } |
|
6802 return name + ': ' + msg; |
|
6803 }; |
|
6804 // can't use defineProperties here because of toString enumeration issue in IE <= 8 |
|
6805 Error.prototype.toString = errorToStringShim; |
|
6806 } |
|
6807 |
|
6808 if (supportsDescriptors) { |
|
6809 var ensureNonEnumerable = function (obj, prop) { |
|
6810 if (isEnum(obj, prop)) { |
|
6811 var desc = Object.getOwnPropertyDescriptor(obj, prop); |
|
6812 desc.enumerable = false; |
|
6813 Object.defineProperty(obj, prop, desc); |
|
6814 } |
|
6815 }; |
|
6816 ensureNonEnumerable(Error.prototype, 'message'); |
|
6817 if (Error.prototype.message !== '') { |
|
6818 Error.prototype.message = ''; |
|
6819 } |
|
6820 ensureNonEnumerable(Error.prototype, 'name'); |
|
6821 } |
|
6822 |
|
6823 if (String(/a/mig) !== '/a/gim') { |
|
6824 var regexToString = function toString() { |
|
6825 var str = '/' + this.source + '/'; |
|
6826 if (this.global) { |
|
6827 str += 'g'; |
|
6828 } |
|
6829 if (this.ignoreCase) { |
|
6830 str += 'i'; |
|
6831 } |
|
6832 if (this.multiline) { |
|
6833 str += 'm'; |
|
6834 } |
|
6835 return str; |
|
6836 }; |
|
6837 // can't use defineProperties here because of toString enumeration issue in IE <= 8 |
|
6838 RegExp.prototype.toString = regexToString; |
|
6530 } |
6839 } |
6531 |
6840 |
6532 })); |
6841 })); |
6533 |
6842 |
6534 },{}],26:[function(_dereq_,module,exports){ |
6843 },{}],26:[function(_dereq_,module,exports){ |
6627 } |
6936 } |
6628 } |
6937 } |
6629 setTimeout(function () { |
6938 setTimeout(function () { |
6630 each(paths, function loading(path, force) { |
6939 each(paths, function loading(path, force) { |
6631 if (path === null) return callback() |
6940 if (path === null) return callback() |
6632 path = !force && path.indexOf('.js') === -1 && !/^https?:\/\//.test(path) && scriptpath ? scriptpath + path + '.js' : path |
6941 |
6942 if (!force && !/^https?:\/\//.test(path) && scriptpath) { |
|
6943 path = (path.indexOf('.js') === -1) ? scriptpath + path + '.js' : scriptpath + path; |
|
6944 } |
|
6945 |
|
6633 if (scripts[path]) { |
6946 if (scripts[path]) { |
6634 if (id) ids[id] = 1 |
6947 if (id) ids[id] = 1 |
6635 return (scripts[path] == 2) ? callback() : setTimeout(function () { loading(path, true) }, 0) |
6948 return (scripts[path] == 2) ? callback() : setTimeout(function () { loading(path, true) }, 0) |
6636 } |
6949 } |
6637 |
6950 |