webshims-rails 0.4.7 → 1.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/lib/webshims-rails/version.rb +2 -2
- data/vendor/assets/javascripts/webshims/extras/custom-validity.js +1 -1
- data/vendor/assets/javascripts/webshims/extras/mousepress.js +1 -1
- data/vendor/assets/javascripts/webshims/polyfiller.js +197 -166
- data/vendor/assets/javascripts/webshims/shims/combos/1.js +1711 -1609
- data/vendor/assets/javascripts/webshims/shims/combos/10.js +2575 -2253
- data/vendor/assets/javascripts/webshims/shims/combos/11.js +2452 -1476
- data/vendor/assets/javascripts/webshims/shims/combos/12.js +1405 -1159
- data/vendor/assets/javascripts/webshims/shims/combos/13.js +1316 -963
- data/vendor/assets/javascripts/webshims/shims/combos/14.js +1862 -179
- data/vendor/assets/javascripts/webshims/shims/combos/15.js +4327 -287
- data/vendor/assets/javascripts/webshims/shims/combos/16.js +3887 -586
- data/vendor/assets/javascripts/webshims/shims/combos/17.js +2911 -2159
- data/vendor/assets/javascripts/webshims/shims/combos/18.js +3425 -1730
- data/vendor/assets/javascripts/webshims/shims/combos/19.js +2854 -1203
- data/vendor/assets/javascripts/webshims/shims/combos/2.js +3351 -2130
- data/vendor/assets/javascripts/webshims/shims/combos/20.js +2426 -581
- data/vendor/assets/javascripts/webshims/shims/combos/21.js +1915 -1574
- data/vendor/assets/javascripts/webshims/shims/combos/22.js +864 -2275
- data/vendor/assets/javascripts/webshims/shims/combos/23.js +609 -1811
- data/vendor/assets/javascripts/webshims/shims/combos/3.js +1655 -2736
- data/vendor/assets/javascripts/webshims/shims/combos/4.js +1037 -603
- data/vendor/assets/javascripts/webshims/shims/combos/5.js +3100 -773
- data/vendor/assets/javascripts/webshims/shims/combos/6.js +3631 -840
- data/vendor/assets/javascripts/webshims/shims/combos/7.js +3596 -1354
- data/vendor/assets/javascripts/webshims/shims/combos/8.js +1731 -188
- data/vendor/assets/javascripts/webshims/shims/combos/9.js +3243 -1431
- data/vendor/assets/javascripts/webshims/shims/dom-extend.js +107 -18
- data/vendor/assets/javascripts/webshims/shims/es5.js +1 -0
- data/vendor/assets/javascripts/webshims/shims/form-core.js +553 -464
- data/vendor/assets/javascripts/webshims/shims/form-datalist.js +160 -154
- data/vendor/assets/javascripts/webshims/shims/form-message.js +73 -49
- data/vendor/assets/javascripts/webshims/shims/form-native-extend.js +18 -1
- data/vendor/assets/javascripts/webshims/shims/form-number-date-api.js +161 -36
- data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +2130 -813
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +206 -58
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-ar.js → formcfg-ar.js} +30 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-ch-ZN.js → formcfg-ch-ZN.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-de.txt → formcfg-de.txt} +50 -11
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-el.js → formcfg-el.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-en.txt → formcfg-en.txt} +44 -11
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-es.js → formcfg-es.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-fr.js → formcfg-fr.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-he.js → formcfg-he.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-hi.js → formcfg-hi.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-hu.js → formcfg-hu.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-it.js → formcfg-it.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-ja.js → formcfg-ja.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-nl.js → formcfg-nl.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-pt-PT.js → formcfg-pt-PT.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-ru.js → formcfg-ru.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-sv.js → formcfg-sv.js} +32 -0
- data/vendor/assets/javascripts/webshims/shims/json-storage.js +16 -10
- data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +155 -122
- data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +76 -41
- data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +8 -16
- data/vendor/assets/javascripts/webshims/shims/range-ui.js +388 -0
- data/vendor/assets/javascripts/webshims/shims/styles/config.rb +12 -0
- data/vendor/assets/javascripts/webshims/shims/styles/forms.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +1186 -0
- data/vendor/assets/javascripts/webshims/shims/styles/shim.css +868 -548
- data/vendor/assets/javascripts/webshims/shims/styles/vertical-range.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/swfmini.js +497 -0
- data/vendor/assets/javascripts/webshims/shims/track-ui.js +3 -0
- data/vendor/assets/javascripts/webshims/shims/track.js +29 -29
- metadata +26 -125
- data/vendor/assets/javascripts/webshims/minified/extras/custom-validity.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/extras/modernizr-custom.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/extras/mousepress.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/polyfiller.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvas/canvas2png.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvas/flashcanvas.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvas/flashcanvas.swf +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvas/proxy.php +0 -73
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvas/save.php +0 -49
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvasPro/canvas2png.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvasPro/flash10canvas.swf +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvasPro/flash9canvas.swf +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvasPro/flashcanvas.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvasPro/proxy.php +0 -73
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvasPro/save.php +0 -49
- data/vendor/assets/javascripts/webshims/minified/shims/combos/1.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/10.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/11.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/12.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/13.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/14.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/15.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/16.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/17.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/18.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/19.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/2.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/20.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/21.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/22.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/23.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/24.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/25.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/26.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/27.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/3.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/4.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/5.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/59.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/6.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/7.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/8.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/9.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/details.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/dom-extend.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/es5.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/excanvas.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/form-core.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/form-datalist.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/form-message.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/form-native-extend.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/form-number-date-api.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/form-number-date-ui.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/form-shim-extend.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/geolocation.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-ar.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-ch-ZN.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-de.txt +0 -33
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-el.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-en.txt +0 -34
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-es.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-fr.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-he.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-hi.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-hu.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-it.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-ja.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-nl.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-pt-PT.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-ru.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-sv.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/json-storage.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/jwplayer/license.txt +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/jwplayer/player.swf +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/jwplayer/readme.html +0 -87
- data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-core.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-jaris.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-native-fix.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-swf.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-yt.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/styles/details-arrows.png +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/styles/forms.png +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/styles/polyfill-loader.gif +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/styles/shim.css +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/swf/JarisFLVPlayer.swf +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/swf/jwwebshims.swf +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/swf/localStorage.swf +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/track-ui.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/track.js +0 -1
- data/vendor/assets/javascripts/webshims/shims/FlashCanvas/README +0 -62
- data/vendor/assets/javascripts/webshims/shims/FlashCanvasPro/README +0 -82
- data/vendor/assets/javascripts/webshims/shims/combos/24.js +0 -2872
- data/vendor/assets/javascripts/webshims/shims/combos/25.js +0 -2376
- data/vendor/assets/javascripts/webshims/shims/combos/26.js +0 -3009
- data/vendor/assets/javascripts/webshims/shims/combos/27.js +0 -4150
- data/vendor/assets/javascripts/webshims/shims/combos/59.js +0 -1747
- data/vendor/assets/javascripts/webshims/shims/jwplayer/license.txt +0 -1
- data/vendor/assets/javascripts/webshims/shims/jwplayer/player.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/jwplayer/readme.html +0 -87
- data/vendor/assets/javascripts/webshims/shims/mediaelement-swf.js +0 -972
@@ -1 +0,0 @@
|
|
1
|
-
(function(e,t,n){"use strict";var r=t.audio&&t.video,i=!1,s=n.bugs,o=function(){n.ready(a,function(){n.mediaelement.createSWF||(n.mediaelement.loadSwf=!0,n.reTest([a],r))})},u=n.cfg.mediaelement,a=u&&u.player=="jwplayer"?"mediaelement-swf":"mediaelement-jaris",f;if(!u){n.error("mediaelement wasn't implemented but loaded");return}if(r){var l=document.createElement("video");t.videoBuffered="buffered"in l,i="loop"in l,n.capturingEvents(["play","playing","waiting","paused","ended","durationchange","loadedmetadata","canplay","volumechange"]),t.videoBuffered||(n.addPolyfill("mediaelement-native-fix",{f:"mediaelement",test:t.videoBuffered,d:["dom-support"]}),n.reTest("mediaelement-native-fix"))}if(r&&!u.preferFlash){var c=function(t){var r=t.target.parentNode;!u.preferFlash&&(e(t.target).is("audio, video")||r&&e("source:last",r)[0]==t.target)&&n.ready("DOM mediaelement",function(){f&&o(),n.ready("WINDOWLOAD "+a,function(){setTimeout(function(){f&&!u.preferFlash&&n.mediaelement.createSWF&&!e(t.target).closest("audio, video").is(".nonnative-api-active")?(u.preferFlash=!0,document.removeEventListener("error",c,!0),e("audio, video").each(function(){n.mediaelement.selectSource(this)}),n.info("switching mediaelements option to 'preferFlash', due to an error with native player: "+t.target.src)):f||document.removeEventListener("error",c,!0)},20)})})};document.addEventListener("error",c,!0),e("audio, video").each(function(){this.error&&c({target:this})})}t.track&&!s.track&&function(){s.track||(s.track=typeof e("<track />")[0].readyState!="number");if(!s.track)try{new TextTrackCue(2,3,"")}catch(t){s.track=!0}var r=n.cfg.track,i=function(t){e(t.target).filter("track").each(o)},o=function(){if(s.track||!r.override&&e.prop(this,"readyState")==3)r.override=!0,n.reTest("track"),document.removeEventListener("error",i,!0),this&&e.nodeName(this,"track")?n.error("track support was overwritten. Please check your vtt including your vtt mime-type"):n.info("track support was overwritten. due to bad browser support")},u=function(){document.addEventListener("error",i,!0),s.track?o():e("track").each(o)};r.override||(n.isReady("track")?u():e(u))}(),n.register("mediaelement-core",function(e,n,l,c,h){f=swfobject.hasFlashPlayerVersion("9.0.115"),e("html").addClass(f?"swf":"no-swf");var p=n.mediaelement;p.parseRtmp=function(e){var t=e.src.split("://"),r=t[1].split("/"),i,s,o;e.server=t[0]+"://"+r[0]+"/",e.streamId=[];for(i=1,s=r.length;i<s;i++)!o&&r[i].indexOf(":")!==-1&&(r[i]=r[i].split(":")[1],o=!0),o?e.streamId.push(r[i]):e.server+=r[i]+"/";e.streamId.length||n.error("Could not parse rtmp url"),e.streamId=e.streamId.join("/")};var d=function(t,n){t=e(t);var r={src:t.attr("src")||"",elem:t,srcProp:t.prop("src")},i;if(!r.src)return r;i=t.attr("data-server"),i!=null&&(r.server=i),i=t.attr("type"),i?(r.type=i,r.container=e.trim(i.split(";")[0])):(n||(n=t[0].nodeName.toLowerCase(),n=="source"&&(n=(t.closest("video, audio")[0]||{nodeName:"video"}).nodeName.toLowerCase())),r.server?(r.type=n+"/rtmp",r.container=n+"/rtmp"):(i=p.getTypeForSrc(r.src,n,r),i&&(r.type=i,r.container=i))),i=t.attr("media"),i&&(r.media=i);if(r.type=="audio/rtmp"||r.type=="video/rtmp")r.server?r.streamId=r.src:p.parseRtmp(r);return r},v=!f&&"postMessage"in l&&r,m=function(){if(m.loaded)return;m.loaded=!0,e(function(){n.loader.loadList(["track-ui"])})},g=function(){var t;return function(){if(t||!v)return;t=!0,n.loader.loadScript("https://www.youtube.com/player_api"),e(function(){n.polyfill("mediaelement-yt")})}}(),y=function(){f?o():g()};n.addPolyfill("mediaelement-yt",{test:!v,d:["dom-support"]}),p.mimeTypes={audio:{"audio/ogg":["ogg","oga","ogm"],'audio/ogg;codecs="opus"':"opus","audio/mpeg":["mp2","mp3","mpga","mpega"],"audio/mp4":["mp4","mpg4","m4r","m4a","m4p","m4b","aac"],"audio/wav":["wav"],"audio/3gpp":["3gp","3gpp"],"audio/webm":["webm"],"audio/fla":["flv","f4a","fla"],"application/x-mpegURL":["m3u8","m3u"]},video:{"video/ogg":["ogg","ogv","ogm"],"video/mpeg":["mpg","mpeg","mpe"],"video/mp4":["mp4","mpg4","m4v"],"video/quicktime":["mov","qt"],"video/x-msvideo":["avi"],"video/x-ms-asf":["asf","asx"],"video/flv":["flv","f4v"],"video/3gpp":["3gp","3gpp"],"video/webm":["webm"],"application/x-mpegURL":["m3u8","m3u"],"video/MP2T":["ts"]}},p.mimeTypes.source=e.extend({},p.mimeTypes.audio,p.mimeTypes.video),p.getTypeForSrc=function(t,n,r){if(t.indexOf("youtube.com/watch?")!=-1||t.indexOf("youtube.com/v/")!=-1)return"video/youtube";if(t.indexOf("rtmp")===0)return n+"/rtmp";t=t.split("?")[0].split("."),t=t[t.length-1];var i;return e.each(p.mimeTypes[n],function(e,n){if(n.indexOf(t)!==-1)return i=e,!1}),i},p.srces=function(t,n){t=e(t);if(!n){n=[];var r=t[0].nodeName.toLowerCase(),i=d(t,r);return i.src?n.push(i):e("source",t).each(function(){i=d(this,r),i.src&&n.push(i)}),n}t.removeAttr("src").removeAttr("type").find("source").remove(),e.isArray(n)||(n=[n]),n.forEach(function(e){var n=c.createElement("source");typeof e=="string"&&(e={src:e}),n.setAttribute("src",e.src),e.type&&n.setAttribute("type",e.type),e.media&&n.setAttribute("media",e.media),t.append(n)})},e.fn.loadMediaSrc=function(t,n){return this.each(function(){n!==h&&(e(this).removeAttr("poster"),n&&e.attr(this,"poster",n)),p.srces(this,t),e(this).mediaLoad()})},p.swfMimeTypes=["video/3gpp","video/x-msvideo","video/quicktime","video/x-m4v","video/mp4","video/m4p","video/x-flv","video/flv","audio/mpeg","audio/aac","audio/mp4","audio/x-m4a","audio/m4a","audio/mp3","audio/x-fla","audio/fla","youtube/flv","jwplayer/jwplayer","video/youtube","video/rtmp","audio/rtmp"],p.canThirdPlaySrces=function(t,n){var r="";if(f||v)t=e(t),n=n||p.srces(t),e.each(n,function(e,t){if(t.container&&t.src&&(f&&p.swfMimeTypes.indexOf(t.container)!=-1||v&&t.container=="video/youtube"))return r=t,!1});return r};var b={};p.canNativePlaySrces=function(t,n){var i="";if(r){t=e(t);var s=(t[0].nodeName||"").toLowerCase();if(!b[s])return i;n=n||p.srces(t),e.each(n,function(e,n){if(n.type&&b[s].prop._supvalue.call(t[0],n.type))return i=n,!1})}return i},p.setError=function(t,r){r||(r="can't play sources"),e(t).pause().data("mediaerror",r),n.warn("mediaelementError: "+r),setTimeout(function(){e(t).data("mediaerror")&&e(t).trigger("mediaerror")},1)};var w=function(){var e;return function(t,r,i){e||m(),n.ready(f?a:"mediaelement-yt",function(){p.createSWF?p.createSWF(t,r,i):e||(e=!0,y(),w(t,r,i))}),!e&&v&&!p.createSWF&&g()}}(),E=function(e,t,n,r,i){var s;n||n!==!1&&t&&t.isActive=="third"?(s=p.canThirdPlaySrces(e,r),s?w(e,s,t):i?p.setError(e,!1):E(e,t,!1,r,!0)):(s=p.canNativePlaySrces(e,r),s?t&&t.isActive=="third"&&p.setActive(e,"html5",t):i?(p.setError(e,!1),t&&t.isActive=="third"&&p.setActive(e,"html5",t)):E(e,t,!0,r,!0))},S=/^(?:embed|object|datalist)$/i,x=function(t,r){var i=n.data(t,"mediaelementBase")||n.data(t,"mediaelementBase",{}),s=p.srces(t),o=t.parentNode;clearTimeout(i.loadTimer),e.data(t,"mediaerror",!1);if(!s.length||!o||o.nodeType!=1||S.test(o.nodeName||""))return;r=r||n.data(t,"mediaelement"),E(t,r,u.preferFlash||h,s)};p.selectSource=x,e(c).on("ended",function(t){var r=n.data(t.target,"mediaelement");if(i&&(!r||r.isActive=="html5")&&!e.prop(t.target,"loop"))return;setTimeout(function(){if(e.prop(t.target,"paused")||!e.prop(t.target,"loop"))return;e(t.target).prop("currentTime",0).play()},1)}),i||n.defineNodeNamesBooleanProperty(["audio","video"],"loop"),["audio","video"].forEach(function(t){var i=n.defineNodeNameProperty(t,"load",{prop:{value:function(){var e=n.data(this,"mediaelement");x(this,e),r&&(!e||e.isActive=="html5")&&i.prop._supvalue&&i.prop._supvalue.apply(this,arguments)}}});b[t]=n.defineNodeNameProperty(t,"canPlayType",{prop:{value:function(n){var i="";return r&&b[t].prop._supvalue&&(i=b[t].prop._supvalue.call(this,n),i=="no"&&(i="")),!i&&f&&(n=e.trim((n||"").split(";")[0]),p.swfMimeTypes.indexOf(n)!=-1&&(i="maybe")),i}}})}),n.onNodeNamesPropertyModify(["audio","video"],["src","poster"],{set:function(){var e=this,t=n.data(e,"mediaelementBase")||n.data(e,"mediaelementBase",{});clearTimeout(t.loadTimer),t.loadTimer=setTimeout(function(){x(e),e=null},9)}});var T=function(){n.addReady(function(t,i){var s=e("video, audio",t).add(i.filter("video, audio")).each(function(){var t=n.data(this,"mediaelement");r&&e.prop(this,"paused")&&!e.prop(this,"readyState")&&e(this).is('audio[preload="none"][controls]:not([autoplay])')&&(!t||t.isActive=="html5")?e(this).prop("preload","metadata").mediaLoad():x(this,t),r&&function(){var t,n,r=this,i=function(){var t=e.prop(r,"buffered");if(!t)return;var n="";for(var i=0,s=t.length;i<s;i++)n+=t.end(i);return n},s=function(){var t=i();t!=n&&(n=t,e(r).triggerHandler("progress"))};e(this).on({"play loadstart progress":function(e){e.type=="progress"&&(n=i()),clearTimeout(t),t=setTimeout(s,999)},"emptied stalled mediaerror abort suspend":function(e){e.type=="emptied"&&(n=!1),clearTimeout(t)}})}()});!m.loaded&&e("track",s).length&&m(),s=null})};t.track&&!s.track&&n.defineProperty(TextTrack.prototype,"shimActiveCues",{get:function(){return this._shimActiveCues||this.activeCues}}),r?(n.isReady("mediaelement-core",!0),T(),n.ready("WINDOWLOAD mediaelement",y)):n.ready(a,T),n.ready("WINDOWLOAD mediaelement",m)})})(jQuery,Modernizr,jQuery.webshims);
|
@@ -1 +0,0 @@
|
|
1
|
-
jQuery.webshims.register("mediaelement-jaris",function(e,t,n,r,i,s){"use strict";var o=t.mediaelement,u=n.swfobject,a=Modernizr.audio&&Modernizr.video,f=u.hasFlashPlayerVersion("9.0.115"),l=0,c={paused:!0,ended:!1,currentSrc:"",duration:n.NaN,readyState:0,networkState:0,videoHeight:0,videoWidth:0,error:null,buffered:{start:function(e){if(e){t.error("buffered index size error");return}return 0},end:function(e){if(e){t.error("buffered index size error");return}return 0},length:0}},h=Object.keys(c),p={currentTime:0,volume:1,muted:!1},d=Object.keys(p),v=e.extend({isActive:"html5",activating:"html5",wasSwfReady:!1,_bufferedEnd:0,_bufferedStart:0,currentTime:0,_ppFlag:i,_calledMeta:!1,lastDuration:0},c,p),m=/^jarisplayer-/,g=function(e){var n=r.getElementById(e.replace(m,""));if(!n)return;var i=t.data(n,"mediaelement");return i.isActive=="third"?i:null},y=function(e){try{e.nodeName}catch(n){return null}var r=t.data(e,"mediaelement");return r&&r.isActive=="third"?r:null},b=function(t,n){n=e.Event(n),n.preventDefault(),e.event.trigger(n,i,t)},w=s.playerPath||t.cfg.basePath+"swf/"+(s.playerName||"JarisFLVPlayer.swf");t.extendUNDEFProp(s.params,{allowscriptaccess:"always",allowfullscreen:"true",wmode:"transparent",allowNetworking:"all"}),t.extendUNDEFProp(s.vars,{controltype:"1",jsapi:"1"}),t.extendUNDEFProp(s.attrs,{bgcolor:"#000000"});var E=function(e,t){e<3&&clearTimeout(t._canplaythroughTimer),e>=3&&t.readyState<3&&(t.readyState=e,b(t._elem,"canplay"),t.paused||b(t._elem,"playing"),clearTimeout(t._canplaythroughTimer),t._canplaythroughTimer=setTimeout(function(){E(4,t)},4e3)),e>=4&&t.readyState<4&&(t.readyState=e,b(t._elem,"canplaythrough")),t.readyState=e};e.extend(e.event.customEvent,{updatemediaelementdimensions:!0,flashblocker:!0,swfstageresize:!0,mediaelementapichange:!0}),o.jarisEvent={};var S,x={onPlayPause:function(e,t,n){var r,i;if(n==null)try{r=t.api.api_get("isPlaying")}catch(s){}else r=n;r==t.paused&&(t.paused=!r,i=t.paused?"pause":"play",t._ppFlag=!0,b(t._elem,i),t.readyState<3&&E(3,t),t.paused||b(t._elem,"playing"))},onNotBuffering:function(e,t){E(3,t)},onDataInitialized:function(e,t){var n=t.duration,r;t.duration=e.duration;if(n==t.duration||isNaN(t.duration))return;if(t._calledMeta&&(r=Math.abs(t.lastDuration-t.duration))<2)return;t.videoHeight=e.height,t.videoWidth=e.width,t.networkState||(t.networkState=2),t.readyState<1&&E(1,t),clearTimeout(t._durationChangeTimer),t._calledMeta&&t.duration?t._durationChangeTimer=setTimeout(function(){t.lastDuration=t.duration,b(t._elem,"durationchange")},r>50?0:r>9?9:99):(t.lastDuration=t.duration,t.duration&&b(t._elem,"durationchange"),t._calledMeta||b(t._elem,"loadedmetadata")),t._calledMeta=!0},onBuffering:function(e,t){t.ended&&(t.ended=!1),E(1,t),b(t._elem,"waiting")},onTimeUpdate:function(e,t){t.ended&&(t.ended=!1),t.readyState<3&&(E(3,t),b(t._elem,"playing")),b(t._elem,"timeupdate")},onProgress:function(t,n){n.ended&&(n.ended=!1);if(!n.duration||isNaN(n.duration))return;var r=t.loaded/t.total;r>.02&&r<.2?E(3,n):r>.2&&(r>.99&&(n.networkState=1),E(4,n)),n._bufferedEnd&&n._bufferedEnd>r&&(n._bufferedStart=n.currentTime||0),n._bufferedEnd=r,n.buffered.length=1,e.event.trigger("progress",i,n._elem,!0)},onPlaybackFinished:function(e,t){t.readyState<4&&E(4,t),t.ended=!0,b(t._elem,"ended")},onVolumeChange:function(e,t){if(t.volume!=e.volume||t.muted!=e.mute)t.volume=e.volume,t.muted=e.mute,b(t._elem,"volumechange")},ready:function(){var n=function(e){var t=!0;try{e.api.api_get("volume")}catch(n){t=!1}return t};return function(r,i){var s=0,o=function(){if(s>9){i.tryedReframeing=0;return}s++,i.tryedReframeing++,n(i)?(i.wasSwfReady=!0,i.tryedReframeing=0,N(i),T(i)):i.tryedReframeing<6?i.tryedReframeing<3?(i.reframeTimer=setTimeout(o,9),i.shadowElem.css({overflow:"visible"}),setTimeout(function(){i.shadowElem.css({overflow:"hidden"})},1)):(i.shadowElem.css({overflow:"hidden"}),e(i._elem).mediaLoad()):(clearTimeout(i.reframeTimer),t.error("reframing error"))};if(!i||!i.api)return;i.tryedReframeing||(i.tryedReframeing=0),clearTimeout(S),clearTimeout(i.reframeTimer),i.shadowElem.removeClass("flashblocker-assumed"),s?i.reframeTimer=setTimeout(o,9):o()}}()};x.onMute=x.onVolumeChange;var T=function(e){var n=e.actionQueue.length,r=0,i;if(n&&e.isActive=="third")while(e.actionQueue.length&&n>r){r++,i=e.actionQueue.shift();try{e.api[i.fn].apply(e.api,i.args)}catch(s){t.warn(s)}}e.actionQueue.length&&(e.actionQueue=[])},N=function(t){if(!t)return;(t._ppFlag===i&&e.prop(t._elem,"autoplay")||!t.paused)&&setTimeout(function(){if(t.isActive=="third"&&(t._ppFlag===i||!t.paused))try{e(t._elem).play(),t._ppFlag=!0}catch(n){}},1),t.muted&&e.prop(t._elem,"muted",!0),t.volume!=1&&e.prop(t._elem,"volume",t.volume)},C=e.noop;if(a){var k={play:1,playing:1},L=["play","pause","playing","canplay","progress","waiting","ended","loadedmetadata","durationchange","emptied"],A=L.map(function(e){return e+".webshimspolyfill"}).join(" "),O={html5:"third",third:"html5"},M=function(n){var r=t.data(n.target,"mediaelement");if(!r)return;var i=n.originalEvent&&n.originalEvent.type===n.type;i==(r.activating=="third")&&(n.stopImmediatePropagation(),k[n.type]&&(r.isActive!=r.activating?e(n.target).pause():(r.isActive=O[r.isActive],e(n.target).pause(),r.isActive=O[r.isActive])))};C=function(n){e(n).off(A).on(A,M),L.forEach(function(e){t.moveToFirstEvent(n,e)})},C(r)}o.setActive=function(n,r,i){i||(i=t.data(n,"mediaelement"));if(!i||i.isActive==r)return;r!="html5"&&r!="third"&&t.warn("wrong type for mediaelement activating: "+r);var s=t.data(n,"shadowData");i.activating=r,e(n).pause(),i.isActive=r,r=="third"?(s.shadowElement=s.shadowFocusElement=i.shadowElem[0],e(n).addClass("swf-api-active nonnative-api-active").hide().getShadowElement().show()):(e(n).removeClass("swf-api-active nonnative-api-active").show().getShadowElement().hide(),s.shadowElement=s.shadowFocusElement=!1),e(n).trigger("mediaelementapichange")};var _=function(){var e=["_calledMeta","lastDuration","_bufferedEnd","_bufferedStart","_ppFlag","currentSrc","currentTime","duration","ended","networkState","paused","videoHeight","videoWidth"],t=e.length;return function(n){if(!n)return;var r=t,i=n.networkState;E(0,n),clearTimeout(n._durationChangeTimer);while(--r>-1)delete n[e[r]];n.actionQueue=[],n.buffered.length=0,i&&b(n._elem,"emptied")}}(),D=function(t,n){var r=t._elem,i=t.shadowElem;e(r)[n?"addClass":"removeClass"]("webshims-controls"),t._elemNodeName=="audio"&&!n?i.css({width:0,height:0}):i.css({width:r.style.width||e(r).width(),height:r.style.height||e(r).height()})};o.createSWF=function(n,i,c){if(!f){setTimeout(function(){e(n).mediaLoad()},1);return}l<1?l=1:l++;var h=i.type=="audio/rtmp"||i.type=="video/rtmp",p=e.extend({},s.vars,{poster:e.attr(n,"poster")&&e.prop(n,"poster")||"",source:i.streamId||i.srcProp,server:i.server||""}),d=e(n).data("vars")||{};c||(c=t.data(n,"mediaelement"));var m=e.prop(n,"controls"),g="jarisplayer-"+t.getID(n),y=e.extend({},s.params,e(n).data("params")),b=n.nodeName.toLowerCase(),E=e.extend({},s.attrs,{name:g,id:g},e(n).data("attrs")),T;if(c&&c.swfCreated)o.setActive(n,"third",c),c.currentSrc=i.srcProp,c.shadowElem.html('<div id="'+g+'">'),c.api=!1,c.actionQueue=[],T=c.shadowElem,_(c);else{var N=function(){D(c,e.prop(n,"controls"))};T=e('<div class="polyfill-'+b+' polyfill-mediaelement" id="wrapper-'+g+'"><div id="'+g+'"></div>').css({position:"relative",overflow:"hidden"}),c=t.data(n,"mediaelement",t.objectCreate(v,{actionQueue:{value:[]},shadowElem:{value:T},_elemNodeName:{value:b},_elem:{value:n},currentSrc:{value:i.srcProp},swfCreated:{value:!0},id:{value:g.replace(/-/g,"")},buffered:{value:{start:function(e){if(e>=c.buffered.length){t.error("buffered index size error");return}return 0},end:function(e){if(e>=c.buffered.length){t.error("buffered index size error");return}return(c.duration-c._bufferedStart)*c._bufferedEnd+c._bufferedStart},length:0}}})),D(c,m),T.insertBefore(n),a&&e.extend(c,{volume:e.prop(n,"volume"),muted:e.prop(n,"muted"),paused:e.prop(n,"paused")}),t.addShadowDom(n,T),C(n),o.setActive(n,"third",c),e(r).on("updateshadowdom",N),e(n).on("updatemediaelementdimensions",N)}o.jarisEvent[c.id]||(o.jarisEvent[c.id]=function(e){e.type=="ready"?c.api?x[e.type](e,c):setTimeout(function(){x[e.type](e,c)},9):(c.currentTime=e.position,c.api&&(!c._calledMeta&&isNaN(e.duration)&&c.duration!=e.duration&&isNaN(c.duration)&&x.onDataInitialized(e,c),!c._ppFlag&&e.type!="onPlayPause"&&x.onPlayPause(e,c),x[e.type]&&x[e.type](e,c)),c.duration=e.duration)}),e.extend(p,{id:g,evtId:c.id,controls:""+m,autostart:"false",nodename:b},d),h?p.streamtype="rtmp":i.type=="audio/mpeg"||i.type=="audio/mp3"?(p.type="audio",p.streamtype="file"):i.type=="video/youtube"&&(p.streamtype="youtube"),s.changeSWF(p,n,i,c,"embed"),clearTimeout(c.flashBlock),u.embedSWF(w,g,"100%","100%","9.0.0",!1,p,y,E,function(r){r.success&&(c.api=r.ref,m||e(r.ref).attr("tabindex","-1").css("outline","none"),c.flashBlock=setTimeout(function(){if(!r.ref.parentNode&&T[0].parentNode||r.ref.style.display=="none")T.addClass("flashblocker-assumed"),e(n).trigger("flashblocker"),t.warn("flashblocker assumed");e(r.ref).css({minHeight:"2px",minWidth:"2px",display:"block"})},9),S||(clearTimeout(S),S=setTimeout(function(){var n=e(r.ref);n[0].offsetWidth>1&&n[0].offsetHeight>1&&location.protocol.indexOf("file:")===0?t.error("Add your local development-directory to the local-trusted security sandbox: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html"):(n[0].offsetWidth<2||n[0].offsetHeight<2)&&t.warn("JS-SWF connection can't be established on hidden or unconnected flash objects"),n=null},8e3)))})};var P=function(e,t,n,r){return r=r||y(e),r?(r.api&&r.api[t]?r.api[t].apply(r.api,n||[]):(r.actionQueue.push({fn:t,args:n}),r.actionQueue.length>10&&setTimeout(function(){r.actionQueue.length>5&&r.actionQueue.shift()},99)),r):!1};["audio","video"].forEach(function(n){var r={},i,s=function(e){if(n=="audio"&&(e=="videoHeight"||e=="videoWidth"))return;r[e]={get:function(){var t=y(this);return t?t[e]:a&&i[e].prop._supget?i[e].prop._supget.apply(this):v[e]},writeable:!1}},o=function(e,t){s(e),delete r[e].writeable,r[e].set=t};o("volume",function(e){var n=y(this);if(n)e*=1,isNaN(e)||((e<0||e>1)&&t.error("volume greater or less than allowed "+e/100),P(this,"api_volume",[e],n),n.volume!=e&&(n.volume=e,b(n._elem,"volumechange")),n=null);else if(i.volume.prop._supset)return i.volume.prop._supset.apply(this,arguments)}),o("muted",function(e){var t=y(this);if(t)e=!!e,P(this,"api_muted",[e],t),t.muted!=e&&(t.muted=e,b(t._elem,"volumechange")),t=null;else if(i.muted.prop._supset)return i.muted.prop._supset.apply(this,arguments)}),o("currentTime",function(e){var t=y(this);if(t)e*=1,isNaN(e)||P(this,"api_seek",[e],t);else if(i.currentTime.prop._supset)return i.currentTime.prop._supset.apply(this,arguments)}),["play","pause"].forEach(function(e){r[e]={value:function(){var t=y(this);if(t)t.stopPlayPause&&clearTimeout(t.stopPlayPause),P(this,e=="play"?"api_play":"api_pause",[],t),t._ppFlag=!0,t.paused!=(e!="play")&&(t.paused=e!="play",b(t._elem,e));else if(i[e].prop._supvalue)return i[e].prop._supvalue.apply(this,arguments)}}}),h.forEach(s),t.onNodeNamesPropertyModify(n,"controls",function(r,i){var s=y(this);e(this)[i?"addClass":"removeClass"]("webshims-controls"),s&&(t.warn("changing controls currently not fully supported with jaris player"),n=="audio"&&D(s,i),P(this,"api_controls",[i],s))}),i=t.defineNodeNameProperties(n,r,"prop")});if(f&&e.cleanData){var H=e.cleanData,B={object:1,OBJECT:1};e.cleanData=function(e){var t,n,r;if(e&&(n=e.length)&&l)for(t=0;t<n;t++)if(B[e[t].nodeName]){if("api_pause"in e[t]){l--;try{e[t].api_pause()}catch(i){}}try{for(r in e[t])typeof e[t][r]=="function"&&(e[t][r]=null)}catch(i){}}return H.apply(this,arguments)}}a||(["poster","src"].forEach(function(e){t.defineNodeNamesProperty(e=="src"?["audio","video","source"]:["video"],e,{reflect:!0,propType:"src"})}),["autoplay","controls"].forEach(function(e){t.defineNodeNamesBooleanProperty(["audio","video"],e)}),t.defineNodeNamesProperties(["audio","video"],{HAVE_CURRENT_DATA:{value:2},HAVE_ENOUGH_DATA:{value:4},HAVE_FUTURE_DATA:{value:3},HAVE_METADATA:{value:1},HAVE_NOTHING:{value:0},NETWORK_EMPTY:{value:0},NETWORK_IDLE:{value:1},NETWORK_LOADING:{value:2},NETWORK_NO_SOURCE:{value:3}},"prop"))});
|
@@ -1 +0,0 @@
|
|
1
|
-
jQuery.webshims.register("mediaelement-native-fix",function(e,t,n,r,i){if(Modernizr.videoBuffered)return;var s=function(e){var n=t.data(e,"mediaelementBuffered");return n||(n={buffered:{start:function(e){if(e>=n.buffered.length){t.error("buffered index size error");return}return 0},end:function(e){if(e>=n.buffered.length){t.error("buffered index size error");return}return n.loaded},length:0},loaded:0},t.data(e,"mediaelementBuffered",n)),n},o=function(n){n=n.originalEvent;if(!n||!("lengthComputable"in n))return;var r=t.data(n.target,"mediaelement");if(r&&r.isActive!="html5")return;if(n.lengthComputable&&"loaded"in n){var i=n.target.duration,o=s(n.target);o.loaded=i?n.loaded/n.total*i:0,o.loaded&&(o.buffered.length=1),n.type=="load"&&e(n.target).triggerHandler("progress")}},u=function(e){var t=s(e.target);t.buffered.length=0,t.loaded=0};["audio","video"].forEach(function(e){var n=t.defineNodeNameProperty(e,"buffered",{prop:{get:function(){var e=t.data(this,"mediaelement");if(!e||e.isActive!="flash"||!n.prop._supget)return s(this).buffered;n.prop._supget.apply(this)}}})}),function(){var e=r.createElement("video");if(!("preload"in e)&&"autobuffer"in e){var n={metadata:1,none:1};t.onNodeNamesPropertyModify(["audio","video"],["preload"],{set:function(e,r,i){n[e]||i=="removeAttr"?this.autobuffer=!1:!(t.data(this,"mediaelement")||{}).isActive=="html5"&&(this.autobuffer=!0)},initAttr:!0})}}(),t.addReady(function(t,n){e("video, audio",t).add(n.filter("video, audio")).on("load progress",o).on("emptied",u)})});
|
@@ -1 +0,0 @@
|
|
1
|
-
jQuery.webshims.register("mediaelement-swf",function(e,t,n,r,i,s){"use strict";var o="sendEvent",u=t.mediaelement,a=n.swfobject,f=Modernizr.audio&&Modernizr.video,l=a.hasFlashPlayerVersion("9.0.115"),c=0,h={paused:!0,ended:!1,currentSrc:"",duration:n.NaN,readyState:0,networkState:0,videoHeight:0,videoWidth:0,error:null,buffered:{start:function(e){if(e){t.error("buffered index size error");return}return 0},end:function(e){if(e){t.error("buffered index size error");return}return 0},length:0}},p=Object.keys(h),d={currentTime:0,volume:1,muted:!1},v=Object.keys(d),m=e.extend({isActive:"html5",activating:"html5",wasSwfReady:!1,_bufferedEnd:0,_bufferedStart:0,_metadata:!1,_durationCalcs:-1,_callMeta:!1,currentTime:0,_ppFlag:i},h,d),g=/^jwplayer-/,y=function(e){var n=r.getElementById(e.replace(g,""));if(!n)return;var i=t.data(n,"mediaelement");return i.isActive=="third"?i:null},b=function(e){try{e.nodeName}catch(n){return null}var r=t.data(e,"mediaelement");return r&&r.isActive=="third"?r:null},w=function(t,n){n=e.Event(n),n.preventDefault(),e.event.trigger(n,i,t)},E=s.playerPath||t.cfg.basePath+"jwplayer/"+(s.playerName||"player.swf"),S=s.pluginPath||t.cfg.basePath+"swf/jwwebshims.swf";t.extendUNDEFProp(s.params,{allowscriptaccess:"always",allowfullscreen:"true",wmode:"transparent"}),t.extendUNDEFProp(s.vars,{screencolor:"ffffffff"}),t.extendUNDEFProp(s.attrs,{bgcolor:"#000000"});var x=function(t,n){var r=t.duration;if(r&&t._durationCalcs>0)return;try{t.duration=t.jwapi.getPlaylist()[0].duration;if(!t.duration||t.duration<=0||t.duration===t._lastDuration)t.duration=r}catch(i){}t.duration&&t.duration!=t._lastDuration?(w(t._elem,"durationchange"),(t._elemNodeName=="audio"||t._callMeta)&&u.jwEvents.Model.META(e.extend({duration:t.duration},n),t),t._durationCalcs--):t._durationCalcs++},T=function(e,t){e<3&&clearTimeout(t._canplaythroughTimer),e>=3&&t.readyState<3&&(t.readyState=e,w(t._elem,"canplay"),clearTimeout(t._canplaythroughTimer),t._canplaythroughTimer=setTimeout(function(){T(4,t)},4e3)),e>=4&&t.readyState<4&&(t.readyState=e,w(t._elem,"canplaythrough")),t.readyState=e};e.extend(e.event.customEvent,{updatemediaelementdimensions:!0,flashblocker:!0,swfstageresize:!0,mediaelementapichange:!0}),u.jwEvents={View:{PLAY:function(e){var t=y(e.id);if(!t||t.stopPlayPause)return;t._ppFlag=!0,t.paused==e.state&&(t.paused=!e.state,t.ended&&(t.ended=!1),w(t._elem,e.state?"play":"pause"))}},Model:{BUFFER:function(t){var n=y(t.id);if(!n||!("percentage"in t)||n._bufferedEnd==t.percentage)return;n.networkState=t.percentage==100?1:2,(isNaN(n.duration)||t.percentage>5&&t.percentage<25||t.percentage===100)&&x(n,t),n.ended&&(n.ended=!1);if(!n.duration)return;t.percentage>2&&t.percentage<20?T(3,n):t.percentage>20&&T(4,n),n._bufferedEnd&&n._bufferedEnd>t.percentage&&(n._bufferedStart=n.currentTime||0),n._bufferedEnd=t.percentage,n.buffered.length=1,t.percentage==100&&(n.networkState=1,T(4,n)),e.event.trigger("progress",i,n._elem,!0)},META:function(e,t){t=t&&t.networkState?t:y(e.id);if(!t)return;if(!("duration"in e)){t._callMeta=!0;return}if(t._metadata&&(!e.height||t.videoHeight==e.height)&&e.duration===t.duration)return;t._metadata=!0;var n=t.duration;e.duration&&(t.duration=e.duration),t._lastDuration=t.duration;if(e.height||e.width)t.videoHeight=e.height||0,t.videoWidth=e.width||0;t.networkState||(t.networkState=2),t.readyState<1&&T(1,t),t.duration&&n!==t.duration&&w(t._elem,"durationchange"),w(t._elem,"loadedmetadata")},TIME:function(e){var t=y(e.id);if(!t||t.currentTime===e.position)return;t.currentTime=e.position,t.duration&&t.duration<t.currentTime&&x(t,e),t.readyState<2&&T(2,t),t.ended&&(t.ended=!1),w(t._elem,"timeupdate")},STATE:function(e){var t=y(e.id);if(!t)return;switch(e.newstate){case"BUFFERING":t.ended&&(t.ended=!1),T(1,t),w(t._elem,"waiting");break;case"PLAYING":t.paused=!1,t._ppFlag=!0,t.duration||x(t,e),t.readyState<3&&T(3,t),t.ended&&(t.ended=!1),w(t._elem,"playing");break;case"PAUSED":!t.paused&&!t.stopPlayPause&&(t.paused=!0,t._ppFlag=!0,w(t._elem,"pause"));break;case"COMPLETED":t.readyState<4&&T(4,t),t.ended=!0,w(t._elem,"ended")}}},Controller:{ERROR:function(e){var t=y(e.id);if(!t)return;u.setError(t._elem,e.message)},SEEK:function(e){var t=y(e.id);if(!t)return;t.ended&&(t.ended=!1);if(t.paused)try{t.jwapi[o]("play","false")}catch(n){}t.currentTime!=e.position&&(t.currentTime=e.position,w(t._elem,"timeupdate"))},VOLUME:function(e){var t=y(e.id);if(!t)return;var n=e.percentage/100;if(t.volume==n)return;t.volume=n,w(t._elem,"volumechange")},MUTE:function(e){if(e.state)return;var t=y(e.id);if(!t)return;if(t.muted==e.state)return;t.muted=e.state,w(t._elem,"volumechange")}}};var N=function(t){var n=!0;return e.each(u.jwEvents,function(r,i){e.each(i,function(e){try{t.jwapi["add"+r+"Listener"](e,"jQuery.webshims.mediaelement.jwEvents."+r+"."+e)}catch(i){return n=!1,!1}})}),n},C=function(e){var t=e.actionQueue.length,n=0,r;if(t&&e.isActive=="third")while(e.actionQueue.length&&t>n)n++,r=e.actionQueue.shift(),e.jwapi[r.fn].apply(e.jwapi,r.args);e.actionQueue.length&&(e.actionQueue=[])},k=function(t){if(!t)return;(t._ppFlag===i&&e.prop(t._elem,"autoplay")||!t.paused)&&setTimeout(function(){if(t.isActive=="third"&&(t._ppFlag===i||!t.paused))try{e(t._elem).play()}catch(n){}},1)};u.playerResize=function(t){if(!t)return;var n=r.getElementById(t.replace(g,""));n&&e(n).triggerHandler("swfstageresize"),n=null},e(r).on("emptied",function(e){var t=b(e.target);k(t)});var L;u.jwPlayerReady=function(n){var r=y(n.id),i=!0,s=0,o=function(){if(s>9)return;s++;if(N(r)){if(!r.wasSwfReady){var i=parseFloat(n.version,10);(i<5.1||i>=6)&&t.warn("mediaelement-swf is only testet with jwplayer 5.6+")}else e(r._elem).mediaLoad();r.wasSwfReady=!0,r.tryedReframeing=0,C(r),k(r)}else clearTimeout(r.reframeTimer),r.reframeTimer=setTimeout(o,9*s),s>2&&r.tryedReframeing<9&&(r.tryedReframeing++,r.shadowElem.css({overflow:"visible"}),setTimeout(function(){r.shadowElem.css({overflow:"hidden"})},16))};if(!r||!r.jwapi)return;r.tryedReframeing||(r.tryedReframeing=0),clearTimeout(L),r.jwData=n,r.shadowElem.removeClass("flashblocker-assumed"),e.prop(r._elem,"volume",r.volume),e.prop(r._elem,"muted",r.muted),o()};var A=e.noop;if(f){var O={play:1,playing:1},M=["play","pause","playing","canplay","progress","waiting","ended","loadedmetadata","durationchange","emptied"],_=M.map(function(e){return e+".webshimspolyfill"}).join(" "),D={html5:"third",third:"html5"},P=function(n){var r=t.data(n.target,"mediaelement");if(!r)return;var i=n.originalEvent&&n.originalEvent.type===n.type;i==(r.activating=="third")&&(n.stopImmediatePropagation(),O[n.type]&&(r.isActive!=r.activating?e(n.target).pause():(r.isActive=D[r.isActive],e(n.target).pause(),r.isActive=D[r.isActive])))};A=function(n){e(n).off(_).on(_,P),M.forEach(function(e){t.moveToFirstEvent(n,e)})},A(r)}u.setActive=function(n,r,i){i||(i=t.data(n,"mediaelement"));if(!i||i.isActive==r)return;r!="html5"&&r!="third"&&t.warn("wrong type for mediaelement activating: "+r);var s=t.data(n,"shadowData");i.activating=r,e(n).pause(),i.isActive=r,r=="third"?(s.shadowElement=s.shadowFocusElement=i.shadowElem[0],e(n).addClass("swf-api-active nonnative-api-active").hide().getShadowElement().show()):(e(n).removeClass("swf-api-active nonnative-api-active").show().getShadowElement().hide(),s.shadowElement=s.shadowFocusElement=!1),e(n).trigger("mediaelementapichange")};var H=function(){var e=["_bufferedEnd","_bufferedStart","_metadata","_ppFlag","currentSrc","currentTime","duration","ended","networkState","paused","videoHeight","videoWidth","_callMeta","_durationCalcs"],t=e.length;return function(n){if(!n)return;var r=t,i=n.networkState;T(0,n);while(--r)delete n[e[r]];n.actionQueue=[],n.buffered.length=0,i&&w(n._elem,"emptied")}}(),B=function(t,n){var r=t._elem,i=t.shadowElem;e(r)[n?"addClass":"removeClass"]("webshims-controls"),t._elemNodeName=="audio"&&!n?i.css({width:0,height:0}):i.css({width:r.style.width||e(r).width(),height:r.style.height||e(r).height()})};u.createSWF=function(n,i,h){if(!l){setTimeout(function(){e(n).mediaLoad()},1);return}c<1?c=1:c++;var p=e.extend({},s.vars,{image:e.attr(n,"poster")&&e.prop(n,"poster")||"",file:i.streamId||i.srcProp}),d=e(n).data("vars")||{};i.server&&(p.streamer=i.server),h||(h=t.data(n,"mediaelement"));if(h&&h.swfCreated){u.setActive(n,"third",h),H(h),h.currentSrc=i.srcProp,e.extend(p,d),s.changeSWF(p,n,i,h,"load"),j(n,o,["LOAD",p]);return}var v=e.prop(n,"controls"),g="jwplayer-"+t.getID(n),y=e.extend({},s.params,e(n).data("params")),b=n.nodeName.toLowerCase(),w=e.extend({},s.attrs,{name:g,id:g},e(n).data("attrs")),x=e('<div class="polyfill-'+b+' polyfill-mediaelement" id="wrapper-'+g+'"><div id="'+g+'"></div>').css({position:"relative",overflow:"hidden"}),T=function(){B(h,e.prop(n,"controls"))};h=t.data(n,"mediaelement",t.objectCreate(m,{actionQueue:{value:[]},shadowElem:{value:x},_elemNodeName:{value:b},_elem:{value:n},currentSrc:{value:i.srcProp},swfCreated:{value:!0},buffered:{value:{start:function(e){if(e>=h.buffered.length){t.error("buffered index size error");return}return 0},end:function(e){if(e>=h.buffered.length){t.error("buffered index size error");return}return(h.duration-h._bufferedStart)*h._bufferedEnd/100+h._bufferedStart},length:0}}})),B(h,v),x.insertBefore(n),f&&e.extend(h,{volume:e.prop(n,"volume"),muted:e.prop(n,"muted")}),e.extend(p,{id:g,controlbar:v?s.vars.controlbar||(b=="video"?"over":"bottom"):b=="video"?"none":"bottom",icons:""+(v&&b=="video")},d,{playerready:"jQuery.webshims.mediaelement.jwPlayerReady"}),p.plugins?p.plugins+=","+S:p.plugins=S,t.addShadowDom(n,x),A(n),u.setActive(n,"third",h),s.changeSWF(p,n,i,h,"embed"),e(r).on("updateshadowdom",T),e(n).on("updatemediaelementdimensions",T),a.embedSWF(E,g,"100%","100%","9.0.0",!1,p,y,w,function(r){r.success&&(h.jwapi=r.ref,v||e(r.ref).attr("tabindex","-1").css("outline","none"),setTimeout(function(){if(!r.ref.parentNode&&x[0].parentNode||r.ref.style.display=="none")x.addClass("flashblocker-assumed"),e(n).trigger("flashblocker"),t.warn("flashblocker assumed");e(r.ref).css({minHeight:"2px",minWidth:"2px",display:"block"})},9),L||(clearTimeout(L),L=setTimeout(function(){var n=e(r.ref);n[0].offsetWidth>1&&n[0].offsetHeight>1&&location.protocol.indexOf("file:")===0?t.error("Add your local development-directory to the local-trusted security sandbox: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html"):(n[0].offsetWidth<2||n[0].offsetHeight<2)&&t.warn("JS-SWF connection can't be established on hidden or unconnected flash objects"),n=null},8e3)))})};var j=function(e,t,n,r){return r=r||b(e),r?(r.jwapi&&r.jwapi[t]?r.jwapi[t].apply(r.jwapi,n||[]):(r.actionQueue.push({fn:t,args:n}),r.actionQueue.length>10&&setTimeout(function(){r.actionQueue.length>5&&r.actionQueue.shift()},99)),r):!1};["audio","video"].forEach(function(n){var r={},i,s=function(e){if(n=="audio"&&(e=="videoHeight"||e=="videoWidth"))return;r[e]={get:function(){var t=b(this);return t?t[e]:f&&i[e].prop._supget?i[e].prop._supget.apply(this):m[e]},writeable:!1}},u=function(e,t){s(e),delete r[e].writeable,r[e].set=t};u("volume",function(e){var n=b(this);if(n){e*=100;if(!isNaN(e)){var r=n.muted;(e<0||e>100)&&t.error("volume greater or less than allowed "+e/100),j(this,o,["VOLUME",e],n);if(r)try{n.jwapi.sendEvent("mute","true")}catch(s){}e/=100;if(n.volume==e||n.isActive!="third")return;n.volume=e,w(n._elem,"volumechange"),n=null}}else if(i.volume.prop._supset)return i.volume.prop._supset.apply(this,arguments)}),u("muted",function(e){var t=b(this);if(t){e=!!e,j(this,o,["mute",""+e],t);if(t.muted==e||t.isActive!="third")return;t.muted=e,w(t._elem,"volumechange"),t=null}else if(i.muted.prop._supset)return i.muted.prop._supset.apply(this,arguments)}),u("currentTime",function(e){var t=b(this);if(t){e*=1;if(!isNaN(e)){t.paused&&(clearTimeout(t.stopPlayPause),t.stopPlayPause=setTimeout(function(){t.paused=!0,t.stopPlayPause=!1},50)),j(this,o,["SEEK",""+e],t);if(t.paused){t.readyState>0&&(t.currentTime=e,w(t._elem,"timeupdate"));try{t.jwapi[o]("play","false")}catch(n){}}}}else if(i.currentTime.prop._supset)return i.currentTime.prop._supset.apply(this,arguments)}),["play","pause"].forEach(function(e){r[e]={value:function(){var t=b(this);if(t)t.stopPlayPause&&clearTimeout(t.stopPlayPause),j(this,o,["play",e=="play"],t),setTimeout(function(){t.isActive=="third"&&(t._ppFlag=!0,t.paused!=(e!="play")&&(t.paused=e!="play",w(t._elem,e)))},1);else if(i[e].prop._supvalue)return i[e].prop._supvalue.apply(this,arguments)}}}),p.forEach(s),t.onNodeNamesPropertyModify(n,"controls",function(r,i){var s=b(this);e(this)[i?"addClass":"removeClass"]("webshims-controls");if(s){try{j(this,i?"showControls":"hideControls",[n],s)}catch(o){t.warn("you need to generate a crossdomain.xml")}n=="audio"&&B(s,i),e(s.jwapi).attr("tabindex",i?"0":"-1")}}),i=t.defineNodeNameProperties(n,r,"prop")});if(l&&e.cleanData){var F=e.cleanData,I={object:1,OBJECT:1};e.cleanData=function(e){var t,n,r;if(e&&(n=e.length)&&c)for(t=0;t<n;t++)if(I[e[t].nodeName]){if(o in e[t]){c--;try{e[t][o]("play",!1)}catch(i){}}try{for(r in e[t])typeof e[t][r]=="function"&&(e[t][r]=null)}catch(i){}}return F.apply(this,arguments)}}f||(["poster","src"].forEach(function(e){t.defineNodeNamesProperty(e=="src"?["audio","video","source"]:["video"],e,{reflect:!0,propType:"src"})}),["autoplay","controls"].forEach(function(e){t.defineNodeNamesBooleanProperty(["audio","video"],e)}),t.defineNodeNamesProperties(["audio","video"],{HAVE_CURRENT_DATA:{value:2},HAVE_ENOUGH_DATA:{value:4},HAVE_FUTURE_DATA:{value:3},HAVE_METADATA:{value:1},HAVE_NOTHING:{value:0},NETWORK_EMPTY:{value:0},NETWORK_IDLE:{value:1},NETWORK_LOADING:{value:2},NETWORK_NO_SOURCE:{value:3}},"prop"))});
|
@@ -1 +0,0 @@
|
|
1
|
-
jQuery.webshims.register("mediaelement-yt",function(e,t,n,r,i,s){"use strict";var o=t.mediaelement,u=jQuery.Deferred();n.onYouTubePlayerAPIReady=function(){u.resolve()},n.YT&&YT.Player&&n.onYouTubePlayerAPIReady();var a={paused:!0,ended:!1,currentSrc:"",duration:n.NaN,readyState:0,networkState:0,videoHeight:0,videoWidth:0,error:null,buffered:{start:function(e){if(e){t.error("buffered index size error");return}return 0},end:function(e){if(e){t.error("buffered index size error");return}return 0},length:0}},f=Object.keys(a),l={currentTime:0,volume:1,muted:!1},c=Object.keys(l),h=e.extend({isActive:"html5",activating:"html5",wasSwfReady:!1,_metadata:!1,_callMeta:!1,currentTime:0,_buffered:0,_ppFlag:i},a,l),p=function(t,n){n=e.Event(n),n.preventDefault(),e.event.trigger(n,i,t)},d=function(){var e=["_buffered","_metadata","_ppFlag","currentSrc","currentTime","duration","ended","networkState","paused","videoHeight","videoWidth","_callMeta"],t=e.length;return function(n){if(!n)return;var r=t,i=n.networkState;n.readyState=0;while(--r)delete n[e[r]];n.buffered.length=0,clearInterval(n._timeInterval),i&&p(n._elem,"emptied")}}(),v=function(t){var n=t._elem,r=t.shadowElem;r.css({width:n.style.width||e(n).width(),height:n.style.height||e(n).height()})},m=function(e){try{e.nodeName}catch(n){return null}var r=t.data(e,"mediaelement");return r&&r.isActive=="third"?r:null},g=function(n){var r;return n=n.split("?"),n[0].indexOf("youtube.com/watch")!=-1&&n[1]?(n=n[1].split("&"),e.each(n,function(e,t){t=t.split("=");if(t[0]=="v")return n=t[1],r=!0,!1})):n[0].indexOf("youtube.com/v/")!=-1&&(n=n[0].split("/"),e.each(n,function(e,t){if(r)return n=t,!1;t=="v"&&(r=!0)})),r||t.warn("no youtube id found: "+n),n},y=function(t){if(!t)return;(t._ppFlag===i&&e.prop(t._elem,"autoplay")||!t.paused)&&setTimeout(function(){if(t.isActive=="third"&&(t._ppFlag===i||!t.paused))try{e(t._elem).play()}catch(n){}},1)},b=e.noop;(function(){var n={play:1,playing:1},i=["play","pause","playing","canplay","progress","waiting","ended","loadedmetadata","durationchange","emptied"],s=i.map(function(e){return e+".webshimspolyfill"}).join(" "),o={html5:"third",third:"html5"},u=function(r){var i=t.data(r.target,"mediaelement");if(!i)return;var s=r.originalEvent&&r.originalEvent.type===r.type;s==(i.activating=="third")&&(r.stopImmediatePropagation(),n[r.type]&&(i.isActive!=i.activating?e(r.target).pause():(i.isActive=o[i.isActive],e(r.target).pause(),i.isActive=o[i.isActive])))};b=function(n){e(n).off(s).on(s,u),i.forEach(function(e){t.moveToFirstEvent(n,e)})},b(r)})(),e(r).on("emptied",function(e){var t=m(e.target);y(t)}),o.setActive=function(n,r,i){i||(i=t.data(n,"mediaelement"));if(!i||i.isActive==r)return;r!="html5"&&r!="third"&&t.warn("wrong type for mediaelement activating: "+r);var s=t.data(n,"shadowData");i.activating=r,e(n).pause(),i.isActive=r,r=="third"?(s.shadowElement=s.shadowFocusElement=i.shadowElem[0],e(n).addClass("yt-api-active nonnative-api-active").hide().getShadowElement().show()):(clearInterval(i._timeInterval),e(n).removeClass("yt-api-active nonnative-api-active").show().getShadowElement().hide(),s.shadowElement=s.shadowFocusElement=!1),e(n).trigger("mediaelementapichange")};var w=function(t,n){n._ppFlag=!0,t=="playing"&&(w("play",n),n.readyState<3&&(n.readyState=3,p(n._elem,"canplay")),e(n._elem).trigger("playing")),t=="play"&&n.paused?(n.paused=!1,p(n._elem,"play")):t=="pause"&&!n.paused&&(n.paused=!0,p(n._elem,"pause"))},E=function(t,n,r,i){u.done(function(){var s=function(){var n,i;r._metadata&&r._ytAPI.getVideoLoadedFraction&&(i=r._ytAPI.getVideoLoadedFraction(),n=i*r.duration,r._buffered!==n&&(r._buffered=n,r.buffered.length=1,e(t).trigger("progress")),i>.99&&(r.networkState=1),r.readyState<4&&r.currentTime&&(r._buffered-r.currentTime>9||i>.9)&&(r.readyState=4,p(r._elem,"canplaythrough")))},o=function(){if(r._ytAPI&&r._ytAPI.getCurrentTime){var n=r._ytAPI.getCurrentTime();r.currentTime!=n&&(r.currentTime=n,e(t).trigger("timeupdate")),s()}},u=function(){if(r.isActive=="third"&&r._ytAPI&&r._ytAPI.getVolume){var n=r._ytAPI.getVolume()/100,i=r._ytAPI.isMuted(),u;n!=r.volume&&(r.volume=n,u=!0),i!=r.muted&&(r.muted=i,u=!0),o(),s(),u&&e(t).trigger("volumechange")}},a=function(){clearInterval(r._timeInterval),r._timeInterval=setInterval(function(){var n=r._ytAPI.getCurrentTime();r.currentTime!=n&&(r.currentTime=n,e(t).trigger("timeupdate"))},350)};r._ytAPI=new YT.Player(n,{height:"100%",width:"100%",playerVars:{allowfullscreen:!0,fs:1,rel:0,showinfo:0,autohide:1,controls:e.prop(t,"controls")?1:0},videoId:i,events:{onReady:function(e){y(r),setTimeout(u,9),setInterval(u,5e3)},onStateChange:function(n){if(!n.target.getDuration)return;var i;if(!r._metadata){var s=n.target.getDuration();s&&(r._metadata=!0,r.duration=s,r.readyState<1&&(r.readyState=1),r.networkState<1&&(r.networkState=2),i=!0)}i&&e(t).trigger("durationchange").trigger("loadedmetadata"),setTimeout(u,9),n.data==1?(w("playing",r),a()):n.data==2?(clearInterval(r._timeInterval),w("pause",r)):n.data==3?(r.readyState>2&&(r.readyState=2),r.networkState=2,e(t).trigger("waiting")):n.data===0&&(r.readyState>4&&(r.readyState=4),r.networkState=1,clearInterval(r._timeInterval),e(t).trigger("ended"))}}}),e(t).on("updateytdata",u)})};o.createSWF=function(n,i,s){s||(s=t.data(n,"mediaelement"));var a=g(i.src);if(s){o.setActive(n,"third",s),d(s),s.currentSrc=i.srcProp,u.done(function(){s._ytAPI.loadVideoById&&s._ytAPI.loadVideoById(a)});return}var f=e.prop(n,"controls"),l="yt-"+t.getID(n),c=e('<div class="polyfill-video polyfill-mediaelement" id="wrapper-'+l+'"><div id="'+l+'"></div>').css({position:"relative",overflow:"hidden"}),p=function(){v(s)};s=t.data(n,"mediaelement",t.objectCreate(h,{shadowElem:{value:c},_elem:{value:n},currentSrc:{value:i.srcProp},buffered:{value:{start:function(e){if(e>=s.buffered.length){t.error("buffered index size error");return}return 0},end:function(e){if(e>=s.buffered.length){t.error("buffered index size error");return}return s._buffered},length:0}}})),v(s),c.insertBefore(n),t.addShadowDom(n,c),o.setActive(n,"third",s),b(n),E(n,l,s,a),e(r).on("updateshadowdom",p),e(n).on("updatemediaelementdimensions",p)},function(){var n=function(t){clearTimeout(t.updateDataTimer),t.updateDataTimer=setTimeout(function(){e(t._elem).triggerHandler("updateytdata")},9)},r={},i,s=function(e){r[e]={get:function(){var t=m(this);return t?t[e]:i[e].prop._supget.apply(this)},writeable:!1}},o=function(e,t){s(e),delete r[e].writeable,r[e].set=t};f.forEach(s),o("currentTime",function(e){var t=m(this);if(!t)return i.currentTime.prop._supset.apply(this,arguments);e*=1,!isNaN(e)&&t._ytAPI&&t._ytAPI.seekTo&&(t._ytAPI.seekTo(e),n(t))}),o("muted",function(e){var t=m(this);if(!t)return i.muted.prop._supset.apply(this,arguments);t._ytAPI&&t._ytAPI.mute&&(t._ytAPI[e?"mute":"unMute"](),n(t))}),o("volume",function(e){var r=m(this);if(!r)return i.volume.prop._supset.apply(this,arguments);e*=100,!isNaN(e)&&r._ytAPI&&r._ytAPI.setVolume&&((e<0||e>100)&&t.error("volume greater or less than allowed "+e/100),r._ytAPI.setVolume(e),n(r))}),e.each(["play","pause"],function(e,t){var n=t+"Video";r[t]={value:function(){var e=m(this);if(!e)return i[t].prop._supvalue.apply(this,arguments);e._ytAPI&&e._ytAPI[n]&&(e._ytAPI[n](),w(t,e))}}}),i=t.defineNodeNameProperties("video",r,"prop")}()});
|
Binary file
|
Binary file
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
article,aside,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary{display:block}audio{display:none;height:0;width:0}audio,video{overflow:hidden}audio.webshims-controls,video{display:inline-block;min-height:45px;min-width:40px}audio[controls]{display:inline-block;min-height:45px;min-width:40px}video > *,audio > *{visibility:hidden}.no-swf video > *,.no-swf audio > *{visibility:inherit}.flashblocker-assumed{min-height:20px;min-width:20px}.cue-display{position:absolute!important;margin:0;padding:0!important;max-width:100%!important;max-height:100%!important;border:none!important;background:none!important;text-align:center;visibility:hidden;font-family:sans-serif;font-size:12px;white-space:pre-wrap;overflow:hidden}.cue-display b{font-weight:bold}.cue-display i{font-style:italic}.cue-display u{text-decoration:underline}.cue-display span.cue-wrapper{position:absolute;left:0;bottom:0;right:0;display:block;padding:0;margin:0;width:100%;font-size:160%;color:#fff;visibility:visible!important}.cue-display .cue-line{display:block}.cue-display span.cue{display:inline-block;padding:3px 5px;background:#000;background:rgba(0,0,0,0.8);color:#fff}.cue-display .description-cues{position:absolute;top:-99px;left:-99px;display:block;width:5px;height:5px;overflow:hidden}mark{background-color:#ff9;color:#000;font-style:italic;font-weight:bold}.input-range .ui-slider-range,.placeholder-box,.placeholder-text,.input-datetime-local,.step-controls,.step-controls span,.input-range,.input-range .ui-slider-handle,.input-range .ui-slider-range,.details-open-indicator{margin:0;padding:0;border:none;width:auto;background:transparent none}output{position:relative}.webshims-visual-hide{position:absolute!important;top:0!important;left:0!important;visibility:hidden!important;width:0!important;height:0!important;overflow:hidden!important}.webshims-visual-hide *{visibility:hidden!important}.placeholder-box{position:relative;display:inline-block;zoom:1}.polyfill-important .placeholder-box{position:relative!important;display:inline-block!important;margin:0!important;padding:0!important;width:auto!important;height:auto!important}.placeholder-box-input{vertical-align:bottom}.placeholder-box-left{float:left}.placeholder-box-right{float:right}.placeholder-text{position:absolute;display:none;top:0;left:0;overflow:hidden;color:#999;line-height:1;cursor:text}.polyfill-important .placeholder-text{margin:0!important;padding-right:0!important;padding-bottom:0!important;display:none!important}.placeholder-box-input .placeholder-text{white-space:nowrap}.placeholder-visible{color:#999}.placeholder-visible .placeholder-text,.placeholder-text.placeholder-visible{display:inline-block}.placeholder-focused.placeholder-visible{color:#ccc}.polyfill-important .placeholder-visible .placeholder-text,.polyfill-important .placeholder-text.placeholder-visible{display:inline-block!important}.input-datetime-local{display:inline-block;zoom:1;vertical-align:middle}.polyfill-important .input-datetime-local{display:inline-block!important;height:auto!important;padding:0!important;margin:0!important;border:none!important}.polyfill-important .input-datetime-local input{display:inline!important}.input-datetime-local-date{margin:0 2px 0 0}.polyfill-important .input-datetime-local-date{margin:0 2px 0 0!important}.input-datetime-local-time{margin:0 0 0 2px}.polyfill-important .input-datetime-local-time{margin:0 0 0 2px!important}img.ui-datepicker-trigger{display:inline;display:inline-block;width:16px}.has-step-controls{display:inline}.polyfill-important .has-step-controls{display:inline!important}.step-controls{position:relative;zoom:1;overflow:hidden;display:inline-block;font-size:0;vertical-align:middle;vertical-align:top;margin-left:-17px;height:19px;width:15px}.polyfill-important .step-controls{display:inline-block!important;padding:0!important;vertical-align:top!important}.step-controls span{position:absolute;display:inline-block;overflow:hidden;margin:0!important;padding:0!important;width:15px;height:9px;cursor:pointer;font-size:0;line-height:0;background:url(forms.png) no-repeat 0 0}.polyfill-important .step-controls span{display:inline-block!important;margin:0!important;padding:0!important;font-size:0!important}.step-controls span.step-up{top:0;background-position:-80px 0}.step-controls span.step-up:hover{background-position:-105px 0}.step-controls > span.mousepress-ui.step-up{background-position:-105px -20px}.step-controls span.step-down{bottom:0;background-position:-155px 0}.step-controls span.step-down:hover{background-position:-180px 0}.step-controls > span.mousepress-ui.step-down{background-position:-180px -20px}.step-controls.disabled-step-control span{opacity:0.95;cursor:default}.step-controls.disabled-step-control span.step-up{background-position:-130px 0}.step-controls.disabled-step-control span.step-down{background-position:-205px 0}.input-range{position:relative;display:inline-block;vertical-align:middle;margin:5px 0;zoom:1;border:none;height:9px;width:155px;border-radius:1px;background:url(forms.png) 0 -43px no-repeat;cursor:pointer;font-size:0;line-height:0}.polyfill-important .input-range{display:inline-block!important;padding:0!important;font-size:0!important}.input-range .ui-slider-handle{top:0;position:absolute;display:block;z-index:4;overflow:hidden;margin:-5px 0 0 -8px;height:22px;width:17px;background:url(forms.png) 0 0 no-repeat;cursor:pointer;outline:none;font-size:0;line-height:0}.input-range .ui-slider-handle:hover,.input-range .ui-slider-handle:focus{background-position:-17px 0}.input-range .ui-slider-handle.ui-state-active{background-position:-34px 0}.input-range.ui-slider-disabled{cursor:default;opacity:0.95}.input-range.ui-slider-disabled .ui-slider-handle{cursor:default;background-position:-51px 0}.input-range .ui-slider-range{position:absolute;z-index:1;overflow:hidden;display:block;background:#b6e2fb}.input-range .input-range .ui-slider-range,.polyfill-important .input-range .ui-slider-handle{position:absolute!important;display:block!important;padding:0!important}.input-range.ui-slider-horizontal .ui-slider-range{top:4px;height:1px}.input-range.ui-slider-horizontal .ui-slider-range-min{left:0}.input-range.ui-slider-horizontal .ui-slider-range-max{right:0}.input-date-datepicker-control{position:absolute;zoom:1;display:none;background-color:#fff;z-index:100;overflow:visible;padding:5px;font-family:"MS Shell Dlg","Lucida Grande","Calibri",sans-serif;font-size:14px;border:1px solid #333}.polyfill-important .input-date-datepicker-control{z-index:999999999!important}.input-date-datepicker-control .ui-datepicker-header{position:relative;margin:0 0 3px;padding:2px 0}.input-date-datepicker-control .ui-datepicker-header select{border:1px solid #333;padding:1px 2px 2px}.input-date-datepicker-control .ui-datepicker-header option{padding-right:8px}.input-date-datepicker-control .ui-datepicker-header .ui-icon{position:absolute;display:block;top:0.2em;width:15px;height:18px;text-indent:-9999em;font-size:10px;line-height:0;background:url(forms.png) no-repeat;cursor:pointer}.input-date-datepicker-control .ui-datepicker-header .ui-state-disabled .ui-icon{cursor:default}.input-date-datepicker-control .ui-datepicker-header .ui-icon-circle-triangle-w{left:3px;background-position:-235px 3px}.input-date-datepicker-control .ui-datepicker-header .ui-state-hover .ui-icon-circle-triangle-w{background-position:-235px -17px}.input-date-datepicker-control .ui-datepicker-header .ui-icon-circle-triangle-e{right:3px;background-position:-248px 3px}.input-date-datepicker-control .ui-datepicker-header .ui-state-hover .ui-icon-circle-triangle-e{background-position:-248px -17px}.input-date-datepicker-control table{font-size:100%;border-spacing:1px}.input-date-datepicker-control .ui-datepicker-title{margin:0 20px}.input-date-datepicker-control .ui-datepicker-title,.input-date-datepicker-control th{color:#069;text-align:center;font-weight:bold}.input-date-datepicker-control td,.input-date-datepicker-control th{padding:0 2px;text-align:center;font-weight:normal}.input-date-datepicker-control td{padding:0 4px;cursor:pointer;text-align:right;border:1px solid #fff;border-radius:2px}.input-date-datepicker-control td.ui-datepicker-current-day{background-color:#adf;color:#000;border-color:#06c}.input-date-datepicker-control td.ui-datepicker-today{border-color:#06c}.input-date-datepicker-control td.ui-datepicker-current-day a{color:#000}.input-date-datepicker-control td a{color:#000;text-decoration:none}.input-date-datepicker-control td:hover{background-color:#bef;border-color:#06c}.input-date-datepicker-control td.ui-state-disabled{cursor:default;border-color:#fff;color:#bbb;background-color:transparent}.input-date-datepicker-control .ui-datepicker-buttonpane{margin:4px 0 0}.input-date-datepicker-control .ui-datepicker-cover{display:none;display position:absolute;z-index:-1;filter:mask();top:-4px;left:-4px;width:200px;height:200px}datalist{display:none}.datalist-polyfill{position:absolute!important;font-family:"Lucida Grande","MS Shell Dlg","Calibri",sans-serif;font-size:100%;top:0;left:0;margin:0;padding:0;display:none;z-index:999999999}.datalist-polyfill.datalist-visible{display:block}.datalist-polyfill div{margin:0;padding:0}.datalist-polyfill .datalist-box{border:1px solid #333;max-height:200px;overflow:hidden;overflow-x:hidden!important;overflow-y:auto}.datalist-polyfill ul,.datalist-polyfill li{font-size:100%;list-style:none!important}.datalist-polyfill ul{position:static!important;overflow:hidden;margin:0;padding:2px 0;height:auto!important;background-color:#fff;color:#000}.datalist-polyfill li{margin:1px 1px 1px 0;padding:2px 2px 2px 5px;overflow:hidden;white-space:nowrap;cursor:default;zoom:1;overflow:hidden}.datalist-polyfill .option-label{display:inline-block;float:left;max-width:100%;text-overflow:ellipsis}.datalist-polyfill .option-value{display:none;float:right;text-overflow:ellipsis}.datalist-polyfill .hidden-item{display:none!important}.datalist-polyfill .active-item{background-color:#39f;color:#fff;cursor:default}.validity-alert-wrapper{position:absolute!important;overflow:hidden;padding:0 6px 6px 0;font:12px/140% sans-serif;z-index:1000000000}.validity-alert{display:inline-block;padding:8px 0 0}.validity-alert .va-box{display:inline-block!important;background:#fafafa;color:#000;border:1px solid #ccc;padding:5px;border-radius:5px;box-shadow:2px 2px 5px rgba(0,0,0,0.5);zoom:1!important;min-width:60px}.validity-alert .va-arrow{position:absolute;top:1px;left:20px;display:block;width:0;height:0;border-left:9px solid transparent;border-right:9px solid transparent;border-bottom:7px solid #ccc;border-top:none;zoom:1;font-size:0}html .validity-alert span.va-arrow,html .validity-alert .va-arrow .va-arrow-box{border-left-color:transparent;border-right-color:transparent}.polyfill-important .validity-alert span.va-arrow,.polyfill-important .validity-alert .va-arrow .va-arrow-box{border-left-color:transparent!important;border-right-color:transparent!important}* html .validity-alert .va-arrow{display:none}.validity-alert .va-arrow .va-arrow-box{position:relative;top:1px;left:-9px;display:block;width:0;height:0;border-left:9px solid transparent;border-right:9px solid transparent;border-bottom:7px solid #fafafa;border-top:none}#swflocalstorageshim-wrapper{position:absolute;top:-999px;left:-9999px;overflow:hidden;width:215px;min-width:215px!important;z-index:2147483647}#swflocalstorageshim-wrapper .polyfill-exceeded-message{margin:0 0 5px;padding:5px;background:#ffd;color:#000;font-size:13px}#swflocalstorageshim-wrapper object{min-height:138px!important;min-width:215px!important}details{overflow:hidden}summary{position:relative}.closed-details-child{display:none!important}.details-open-indicator{margin:-1px 0 0;display:inline-block;width:16px;height:11px;background:url(details-arrows.png) no-repeat 0 0;vertical-align:middle}.closed-details-summary .details-open-indicator{background-position:0 -20px}.polyfill-important .details-open-indicator{margin:-1px 0 0!important;padding:0!important;border:0!important;display:inline-block!important;width:16px!important;height:11px!important;background:url(details-arrows.png) no-repeat 0 0!important;vertical-align:middle!important}.polyfill-important .closed-details-summary .details-open-indicator{background-position:0 -20px!important}summary.summary-has-focus{outline:1px dotted #aaa;outline-offset:-1px}
|
Binary file
|
Binary file
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
jQuery.webshims.register("track-ui",function(e,t,n,r,i){"use strict";function h(e,t){var n=!0,r=0,i=e.length;if(i!=t.length)n=!1;else for(;r<i;r++)if(e[r]!=t[r]){n=!1;break}return n}var s=t.cfg.track,o={type:"enter"},u={type:"exit"},a={subtitles:1,captions:1,descriptions:1},f=t.mediaelement,l=function(){return!s.override&&Modernizr.track},c={update:function(n,r){n.activeCues.length?h(n.displayedActiveCues,n.activeCues)||(n.displayedActiveCues=n.activeCues,n.trackDisplay||(n.trackDisplay=e('<div class="cue-display"><span class="description-cues" aria-live="assertive" /></div>').insertAfter(r),this.addEvents(n,r),t.docObserve()),n.hasDirtyTrackDisplay&&r.triggerHandler("forceupdatetrackdisplay"),this.showCues(n)):this.hide(n)},showCues:function(t){var n=e('<span class="cue-wrapper" />');e.each(t.displayedActiveCues,function(r,i){var s=i.id?'id="cue-id-'+i.id+'"':"",o=e('<span class="cue-line"><span '+s+' class="cue" /></span>').find("span").html(i.getCueAsHTML()).end();i.track.kind=="descriptions"?setTimeout(function(){e("span.description-cues",t.trackDisplay).html(o)},0):n.prepend(o)}),e("span.cue-wrapper",t.trackDisplay).remove(),t.trackDisplay.append(n)},addEvents:function(t,n){if(s.positionDisplay){var i,o=function(e){if(t.displayedActiveCues.length||e===!0){t.trackDisplay.css({display:"none"});var r=n.getShadowElement(),i=r.offsetParent(),s=r.innerHeight(),o=r.innerWidth(),u=r.position(),a=s*o;t.trackDisplay.css({left:u.left,width:o,height:s-45,top:u.top,display:"block"}),t.trackDisplay.css("fontSize",Math.max(Math.round(s/30),7)),t.hasDirtyTrackDisplay=!1}else t.hasDirtyTrackDisplay=!0},u=function(e){clearTimeout(i),i=setTimeout(o,0)},a=function(){o(!0)};n.on("playerdimensionchange mediaelementapichange updatetrackdisplay updatemediaelementdimensions swfstageresize",u),e(r).on("updateshadowdom",u),n.on("forceupdatetrackdisplay",a),a()}},hide:function(t){t.trackDisplay&&t.displayedActiveCues.length&&(t.displayedActiveCues=[],e("span.cue-wrapper",t.trackDisplay).remove(),e("span.description-cues",t.trackDisplay).empty())}};e.extend(e.event.customEvent,{updatetrackdisplay:!0,forceupdatetrackdisplay:!0}),f.trackDisplay=c;if(!f.createCueList){var p={getCueById:function(e){var t=null;for(var n=0,r=this.length;n<r;n++)if(this[n].id===e){t=this[n];break}return t}};f.createCueList=function(){return e.extend([],p)}}f.getActiveCue=function(t,n,r,i){t._lastFoundCue||(t._lastFoundCue={index:0,time:0}),Modernizr.track&&!s.override&&!t._shimActiveCues&&(t._shimActiveCues=f.createCueList());var o=0,u,l;for(;o<t.shimActiveCues.length;o++)l=t.shimActiveCues[o],l.startTime>r||l.endTime<r?(t.shimActiveCues.splice(o,1),o--,l.pauseOnExit&&e(n).pause(),e(t).triggerHandler("cuechange"),e(l).triggerHandler("exit")):t.mode=="showing"&&a[t.kind]&&e.inArray(l,i.activeCues)==-1&&i.activeCues.push(l);u=t.cues.length,o=t._lastFoundCue.time<r?t._lastFoundCue.index:0;for(;o<u;o++){l=t.cues[o],l.startTime<=r&&l.endTime>=r&&e.inArray(l,t.shimActiveCues)==-1&&(t.shimActiveCues.push(l),t.mode=="showing"&&a[t.kind]&&i.activeCues.push(l),e(t).triggerHandler("cuechange"),e(l).triggerHandler("enter"),t._lastFoundCue.time=r,t._lastFoundCue.index=o);if(l.startTime>r)break}},l()&&function(){var n,r=function(t){setTimeout(function(){n=!0,e(t).triggerHandler("updatetrackdisplay"),n=!1},9)},i=function(i,s,o){var u="_sup"+o,a={prop:{}},f;a.prop[o]=function(){return!n&&l()&&r(e(this).closest("audio, video")),f.prop[u].apply(this,arguments)},f=t.defineNodeNameProperty(i,s,a)};i("track","track","get"),["audio","video"].forEach(function(e){i(e,"textTracks","get"),i("nodeName","addTextTrack","value")})}(),t.addReady(function(n,r){e("video, audio",n).add(r.filter("video, audio")).each(function(){var n=e(this),r=function(e){var r,i;if(!u||!o)u=n.prop("textTracks"),o=t.data(n[0],"mediaelementBase")||t.data(n[0],"mediaelementBase",{}),o.displayedActiveCues||(o.displayedActiveCues=[]);if(!u)return;i=n.prop("currentTime");if(!i&&i!==0)return;o.activeCues=[];for(var s=0,a=u.length;s<a;s++)r=u[s],r.mode!="disabled"&&r.cues&&r.cues.length&&f.getActiveCue(r,n,i,o);c.update(o,n)},i=function(e){clearTimeout(a),e&&e.type=="timeupdate"?(r(),setTimeout(i,90)):a=setTimeout(r,9)},s=function(){n.off(".trackview").on("play.trackview timeupdate.trackview updatetrackdisplay.trackview",i)},o,u,a;l()?n.on("mediaelementapichange trackapichange",function(){!l()||n.is(".nonnative-api-active")?s():(u=n.prop("textTracks"),o=t.data(n[0],"mediaelementBase")||t.data(n[0],"mediaelementBase",{}),e.each(u,function(e,t){t._shimActiveCues&&delete t._shimActiveCues}),c.hide(o),n.unbind(".trackview"))}):s()})})});
|
@@ -1 +0,0 @@
|
|
1
|
-
jQuery.webshims.register("track",function(e,t,n,r,i){"use strict";var s=t.mediaelement,o=(new Date).getTime(),u=e.fn.addBack?"addBack":"andSelf",a={subtitles:1,captions:1,descriptions:1},f=function(){t.error("not implemented yet")},l=e("<track />"),c=Modernizr.ES5&&Modernizr.objectAccessor,h=function(e){var n={};return e.addEventListener=function(e,r){n[e]&&t.error("always use $.on to the shimed event: "+e+" already bound fn was: "+n[e]+" your fn was: "+r),n[e]=r},e.removeEventListener=function(e,r){n[e]&&n[e]!=r&&t.error("always use $.on/$.off to the shimed event: "+e+" already bound fn was: "+n[e]+" your fn was: "+r),n[e]&&delete n[e]},e},p={getCueById:function(e){var t=null;for(var n=0,r=this.length;n<r;n++)if(this[n].id===e){t=this[n];break}return t}},d={0:"disabled",1:"hidden",2:"showing"},v={shimActiveCues:null,_shimActiveCues:null,activeCues:null,cues:null,kind:"subtitles",label:"",language:"",mode:"disabled",readyState:0,oncuechange:null,toString:function(){return"[object TextTrack]"},addCue:function(e){if(!this.cues)this.cues=s.createCueList();else{var n=this.cues[this.cues.length-1];n&&n.startTime>e.startTime&&t.error("cue startTime higher than previous cue's startTime")}e.track&&e.track.removeCue&&e.track.removeCue(e),e.track=this,this.cues.push(e)},removeCue:function(e){var n=this.cues||[],r=0,i=n.length;if(e.track!=this){t.error("cue not part of track");return}for(;r<i;r++)if(n[r]===e){n.splice(r,1),e.track=null;break}if(e.track){t.error("cue not part of track");return}},DISABLED:"disabled",OFF:"disabled",HIDDEN:"hidden",SHOWING:"showing",ERROR:3,LOADED:2,LOADING:1,NONE:0},m=["kind","label","srclang"],g={srclang:"language"},y=Function.prototype.call.bind(Object.prototype.hasOwnProperty),b=function(n,r){var i=[],s=[],o=[],u,a;n||(n=t.data(this,"mediaelementBase")||t.data(this,"mediaelementBase",{})),r||(n.blockTrackListUpdate=!0,r=e.prop(this,"textTracks"),n.blockTrackListUpdate=!1),clearTimeout(n.updateTrackListTimer),e("track",this).each(function(){var t=e.prop(this,"track");o.push(t),r.indexOf(t)==-1&&s.push(t)});if(n.scriptedTextTracks)for(u=0,a=n.scriptedTextTracks.length;u<a;u++)o.push(n.scriptedTextTracks[u]),r.indexOf(n.scriptedTextTracks[u])==-1&&s.push(n.scriptedTextTracks[u]);for(u=0,a=r.length;u<a;u++)o.indexOf(r[u])==-1&&i.push(r[u]);if(i.length||s.length){r.splice(0);for(u=0,a=o.length;u<a;u++)r.push(o[u]);for(u=0,a=i.length;u<a;u++)e([r]).triggerHandler(e.Event({type:"removetrack",track:i[u]}));for(u=0,a=s.length;u<a;u++)e([r]).triggerHandler(e.Event({type:"addtrack",track:s[u]}));(n.scriptedTextTracks||i.length)&&e(this).triggerHandler("updatetrackdisplay")}},w=function(n,r){r||(r=t.data(n,"trackData")),r&&!r.isTriggering&&(r.isTriggering=!0,setTimeout(function(){(r.track||{}).readyState?e(n).closest("audio, video").triggerHandler("updatetrackdisplay"):e(n).triggerHandler("checktrackmode"),r.isTriggering=!1},1))},E=e("<div />")[0];n.TextTrackCue=function(e,n,r){arguments.length!=3&&t.error("wrong arguments.length for TextTrackCue.constructor"),this.startTime=e,this.endTime=n,this.text=r,this.id="",this.pauseOnExit=!1,h(this)},n.TextTrackCue.prototype={onenter:null,onexit:null,pauseOnExit:!1,getCueAsHTML:function(){var e="",t="",n=r.createDocumentFragment(),i;return y(this,"getCueAsHTML")||(i=this.getCueAsHTML=function(){var r,i;if(e!=this.text){e=this.text,t=s.parseCueTextToHTML(e),E.innerHTML=t;for(r=0,i=E.childNodes.length;r<i;r++)n.appendChild(E.childNodes[r].cloneNode(!0))}return n.cloneNode(!0)}),i?i.apply(this,arguments):n.cloneNode(!0)},track:null,id:""},s.createCueList=function(){return e.extend([],p)},s.parseCueTextToHTML=function(){var e=/(<\/?[^>]+>)/ig,t=/^(?:c|v|ruby|rt|b|i|u)/,n=/\<\s*\//,r=function(e,t,r,i){var s;return n.test(i)?s="</"+e+">":(r.splice(0,1),s="<"+e+" "+t+'="'+r.join(" ").replace(/\"/g,""")+'">'),s},i=function(e){var n=e.replace(/[<\/>]+/ig,"").split(/[\s\.]+/);return n[0]&&(n[0]=n[0].toLowerCase(),t.test(n[0])?n[0]=="c"?e=r("span","class",n,e):n[0]=="v"&&(e=r("q","title",n,e)):e=""),e};return function(t){return t.replace(e,i)}}(),s.loadTextTrack=function(n,r,i,o){var u="play playing timeupdate updatetrackdisplay",f=i.track,l=function(){var i=e.prop(r,"src"),o,a;if(f.mode!="disabled"&&i&&e.attr(r,"src")){e(n).unbind(u,l),e(r).unbind("checktrackmode",l);if(!f.readyState){o=function(){f.readyState=3,f.cues=null,f.activeCues=f.shimActiveCues=f._shimActiveCues=null,e(r).triggerHandler("error")},f.readyState=1;try{f.cues=s.createCueList(),f.activeCues=f.shimActiveCues=f._shimActiveCues=s.createCueList(),a=e.ajax({dataType:"text",url:i,success:function(i){a.getResponseHeader("content-type")!="text/vtt"&&t.error("set the mime-type of your WebVTT files to text/vtt. see: http://dev.w3.org/html5/webvtt/#text/vtt"),s.parseCaptions(i,f,function(t){t&&"length"in t?(f.readyState=2,e(r).triggerHandler("load"),e(n).triggerHandler("updatetrackdisplay")):o()})},error:o})}catch(c){o(),t.warn(c)}}}};f.readyState=0,f.shimActiveCues=null,f._shimActiveCues=null,f.activeCues=null,f.cues=null,e(n).unbind(u,l),e(r).unbind("checktrackmode",l),e(n).on(u,l),e(r).on("checktrackmode",l),o&&(f.mode=a[f.kind]?"showing":"hidden",l())},s.createTextTrack=function(n,r){var i,o;return r.nodeName&&(o=t.data(r,"trackData"),o&&(w(r,o),i=o.track)),i||(i=h(t.objectCreate(v)),c||m.forEach(function(t){var n=e.prop(r,t);n&&(i[g[t]||t]=n)}),r.nodeName?(c&&m.forEach(function(n){t.defineProperty(i,g[n]||n,{get:function(){return e.prop(r,n)}})}),o=t.data(r,"trackData",{track:i}),s.loadTextTrack(n,r,o,e.prop(r,"default")&&e(r).siblings("track[default]")[u]()[0]==r)):(c&&m.forEach(function(e){t.defineProperty(i,g[e]||e,{value:r[e],writeable:!1})}),i.cues=s.createCueList(),i.activeCues=i._shimActiveCues=i.shimActiveCues=s.createCueList(),i.mode="hidden",i.readyState=2)),i},s.parseCaptionChunk=function(){var e=/^(\d{2})?:?(\d{2}):(\d{2})\.(\d+)\s+\-\-\>\s+(\d{2})?:?(\d{2}):(\d{2})\.(\d+)\s*(.*)/,n=/^([\d\.]+)\s+\+([\d\.]+)\s*(.*)/,r=/^(DEFAULTS|DEFAULT)\s+\-\-\>\s+(.*)/g,i=/^(STYLE|STYLES)\s+\-\-\>\s*\n([\s\S]*)/g,s=/^(COMMENT|COMMENTS)\s+\-\-\>\s+(.*)/g;return function(n,o){var u=[],a,f,l,c,h,p,d="",v,m,g,y;if(m=r.exec(n))return null;if(m=i.exec(n))return null;if(m=s.exec(n))return null;a=n.split(/\n/g);while(!a[0].replace(/\s+/ig,"").length&&a.length>0)a.shift();a[0].match(/^\s*[a-z0-9-\_]+\s*$/ig)&&(v=String(a.shift().replace(/\s*/ig,"")));for(p=0;p<a.length;p++){var b=a[p];if(g=e.exec(b))h=g.slice(1),f=parseInt((h[0]||0)*60*60,10)+parseInt((h[1]||0)*60,10)+parseInt(h[2]||0,10)+parseFloat("0."+(h[3]||0)),l=parseInt((h[4]||0)*60*60,10)+parseInt((h[5]||0)*60,10)+parseInt(h[6]||0,10)+parseFloat("0."+(h[7]||0));a=a.slice(0,p).concat(a.slice(p+1));break}return!f&&!l?(t.warn("couldn't extract time information: "+[f,l,a.join("\n"),v].join(" ; ")),null):(c=a.join("\n"),y=new TextTrackCue(f,l,c),v&&(y.id=v),y)}}(),s.parseCaptions=function(e,n,r){var i=s.createCueList(),o,u,a,f,l;e?(a=/^WEBVTT(\s*FILE)?/ig,u=function(i,c){for(;i<c;i++){o=e[i];if(a.test(o))l=!0;else if(o.replace(/\s*/ig,"").length){if(!l){t.error("please use WebVTT format. This is the standard"),r(null);break}o=s.parseCaptionChunk(o,i),o&&n.addCue(o)}if(f<(new Date).getTime()-30){i++,setTimeout(function(){f=(new Date).getTime(),u(i,c)},90);break}}i>=c&&(l||t.error("please use WebVTT format. This is the standard"),r(n.cues))},e=e.replace(/\r\n/g,"\n"),setTimeout(function(){e=e.replace(/\r/g,"\n"),setTimeout(function(){f=(new Date).getTime(),e=e.split(/\n\n+/g),u(0,e.length)},9)},9)):t.error("Required parameter captionData not supplied.")},s.createTrackList=function(e,n){return n=n||t.data(e,"mediaelementBase")||t.data(e,"mediaelementBase",{}),n.textTracks||(n.textTracks=[],t.defineProperties(n.textTracks,{onaddtrack:{value:null},onremovetrack:{value:null}}),h(n.textTracks)),n.textTracks},Modernizr.track||(t.defineNodeNamesBooleanProperty(["track"],"default"),t.reflectProperties(["track"],["srclang","label"]),t.defineNodeNameProperties("track",{src:{reflect:!0,propType:"src"}})),t.defineNodeNameProperties("track",{kind:{attr:Modernizr.track?{set:function(e){var n=t.data(this,"trackData");this.setAttribute("data-kind",e),n&&(n.attrKind=e)},get:function(){var e=t.data(this,"trackData");return e&&"attrKind"in e?e.attrKind:this.getAttribute("kind")}}:{},reflect:!0,propType:"enumarated",defaultValue:"subtitles",limitedTo:["subtitles","captions","descriptions","chapters","metadata"]}}),e.each(m,function(n,r){var i=g[r]||r;t.onNodeNamesPropertyModify("track",r,function(){var n=t.data(this,"trackData"),s=this;n&&(r=="kind"&&w(this,n),c||(n.track[i]=e.prop(this,r)),clearTimeout(n.changedTrackPropTimer),n.changedTrackPropTimer=setTimeout(function(){e(s).trigger("updatesubtitlestate")},1))})}),t.onNodeNamesPropertyModify("track","src",function(n){if(n){var r=t.data(this,"trackData"),i;r&&(i=e(this).closest("video, audio"),i[0]&&s.loadTextTrack(i,this,r))}}),t.defineNodeNamesProperties(["track"],{ERROR:{value:3},LOADED:{value:2},LOADING:{value:1},NONE:{value:0},readyState:{get:function(){return(e.prop(this,"track")||{readyState:0}).readyState},writeable:!1},track:{get:function(){return s.createTextTrack(e(this).closest("audio, video")[0],this)},writeable:!1}},"prop"),t.defineNodeNamesProperties(["audio","video"],{textTracks:{get:function(){var e=this,n=t.data(e,"mediaelementBase")||t.data(e,"mediaelementBase",{}),r=s.createTrackList(e,n);return n.blockTrackListUpdate||b.call(e,n,r),r},writeable:!1},addTextTrack:{value:function(e,n,r){var i=s.createTextTrack(this,{kind:l.prop("kind",e||"").prop("kind"),label:n||"",srclang:r||""}),o=t.data(this,"mediaelementBase")||t.data(this,"mediaelementBase",{});return o.scriptedTextTracks||(o.scriptedTextTracks=[]),o.scriptedTextTracks.push(i),b.call(this),i}}},"prop"),e(r).on("emptied ended updatetracklist",function(n){if(e(n.target).is("audio, video")){var r=t.data(n.target,"mediaelementBase");r&&(clearTimeout(r.updateTrackListTimer),r.updateTrackListTimer=setTimeout(function(){b.call(n.target,r)},0))}});var S=function(e,t){return t.readyState||e.readyState};t.addReady(function(n,r){var i=r.filter("video, audio, track").closest("audio, video");e("video, audio",n).add(i).each(function(){b.call(this)}).each(function(){if(Modernizr.track){var n=e.prop(this,"textTracks"),r=this.textTracks;n.length!=r.length&&t.error("textTracks couldn't be copied"),e("track",this).each(function(){var t=e.prop(this,"track"),n=this.track,r,i;if(n){r=e.prop(this,"kind"),i=S(this,n);if(n.mode||i)t.mode=d[n.mode]||n.mode;r!="descriptions"&&(n.mode=typeof n.mode=="string"?"disabled":0,this.kind="metadata",e(this).attr({kind:r}))}}).on("load error",function(e){e.originalEvent&&e.stopImmediatePropagation()})}}),i.each(function(){var e=this,n=t.data(e,"mediaelementBase");n&&(clearTimeout(n.updateTrackListTimer),n.updateTrackListTimer=setTimeout(function(){b.call(e,n)},9))})}),Modernizr.track&&e("video, audio").trigger("trackapichange")});
|
@@ -1,62 +0,0 @@
|
|
1
|
-
FlashCanvas
|
2
|
-
===========
|
3
|
-
|
4
|
-
An implementation of the HTML5 Canvas API for Internet Explorer.
|
5
|
-
|
6
|
-
|
7
|
-
Description
|
8
|
-
-----------
|
9
|
-
|
10
|
-
FlashCanvas is a JavaScript library which adds the HTML5 Canvas support
|
11
|
-
to Internet Explorer. It renders shapes and images via Flash drawing
|
12
|
-
API, and in many cases, runs faster than other similar libraries which
|
13
|
-
use VML or Silverlight.
|
14
|
-
|
15
|
-
|
16
|
-
Requirements
|
17
|
-
------------
|
18
|
-
|
19
|
-
* Microsoft Internet Explorer
|
20
|
-
* Adobe Flash Player 9 or later
|
21
|
-
|
22
|
-
|
23
|
-
Usage
|
24
|
-
-----
|
25
|
-
|
26
|
-
FlashCanvas consists of JavaScript, Flash and PHP files:
|
27
|
-
|
28
|
-
* flashcanvas.js
|
29
|
-
* flashcanvas.swf
|
30
|
-
* canvas2png.js (helps you to save a canvas image)
|
31
|
-
* proxy.php (used to load a file from other domain)
|
32
|
-
* save.php (used to save a canvas image)
|
33
|
-
|
34
|
-
These files can be found in the bin directory in this distribution
|
35
|
-
package. To install FlashCanvas, copy these files into some directory on
|
36
|
-
a Web server, and then add the following HTML code between <head> and
|
37
|
-
</head> tags on your web page.
|
38
|
-
|
39
|
-
<!--[if lt IE 9]>
|
40
|
-
<script type="text/javascript" src="path/to/flashcanvas.js"></script>
|
41
|
-
<![endif]-->
|
42
|
-
|
43
|
-
That's all you have to do in most cases. For more details, please read
|
44
|
-
the online manual at the project page.
|
45
|
-
|
46
|
-
|
47
|
-
License
|
48
|
-
-------
|
49
|
-
|
50
|
-
FlashCanvas is developed by FlashCanvas Project and released under the
|
51
|
-
MIT License.
|
52
|
-
|
53
|
-
|
54
|
-
Contact
|
55
|
-
-------
|
56
|
-
|
57
|
-
If you have a question about FlashCanvas, please utilize the discussion
|
58
|
-
group and issue tracker found at the project page. If you need to
|
59
|
-
contact us directly, you can reach us at the e-mail address.
|
60
|
-
|
61
|
-
Project page: http://code.google.com/p/flashcanvas/
|
62
|
-
E-mail: flashcanvas@gmail.com
|
@@ -1,82 +0,0 @@
|
|
1
|
-
FlashCanvas Pro
|
2
|
-
===============
|
3
|
-
|
4
|
-
An implementation of the HTML5 Canvas API for Internet Explorer.
|
5
|
-
|
6
|
-
|
7
|
-
Description
|
8
|
-
-----------
|
9
|
-
|
10
|
-
FlashCanvas is a JavaScript library which adds the HTML5 Canvas support
|
11
|
-
to Internet Explorer. It renders shapes and images via Flash drawing
|
12
|
-
API, and in many cases, runs faster than other similar libraries which
|
13
|
-
use VML or Silverlight.
|
14
|
-
|
15
|
-
FlashCanvas Pro is a professional edition of FlashCanvas. It supports
|
16
|
-
almost all Canvas APIs including text, shadow and pixel manipulation.
|
17
|
-
Moreover, it utilizes Flash Player 10 features if available, that
|
18
|
-
provides better performance and compatibility.
|
19
|
-
|
20
|
-
|
21
|
-
Requirements
|
22
|
-
------------
|
23
|
-
|
24
|
-
* Microsoft Internet Explorer
|
25
|
-
* Adobe Flash Player 9 or later
|
26
|
-
|
27
|
-
|
28
|
-
Usage
|
29
|
-
-----
|
30
|
-
|
31
|
-
FlashCanvas Pro consists of JavaScript, Flash and PHP files:
|
32
|
-
|
33
|
-
* flashcanvas.js
|
34
|
-
* flash9canvas.swf
|
35
|
-
* flash10canvas.swf
|
36
|
-
* canvas2png.js (helps you to save a canvas image)
|
37
|
-
* proxy.php (used to load a file from other domain)
|
38
|
-
* save.php (used to save a canvas image)
|
39
|
-
|
40
|
-
These files can be found in the bin directory in this distribution
|
41
|
-
package. To install FlashCanvas Pro, copy these files into some
|
42
|
-
directory on a Web server, and then add the following HTML code between
|
43
|
-
<head> and </head> tags on your web page.
|
44
|
-
|
45
|
-
<!--[if lt IE 9]>
|
46
|
-
<script type="text/javascript" src="path/to/flashcanvas.js"></script>
|
47
|
-
<![endif]-->
|
48
|
-
|
49
|
-
That's all you have to do in most cases. For more details, please read
|
50
|
-
the online manual at the project page.
|
51
|
-
|
52
|
-
|
53
|
-
License
|
54
|
-
-------
|
55
|
-
|
56
|
-
FlashCanvas Pro is released under the FlashCanvas Pro License. This
|
57
|
-
license is based on the MIT License, but includes the following
|
58
|
-
modifications:
|
59
|
-
|
60
|
-
* Remove the rights to "sublicense, and/or sell copies of the Software".
|
61
|
-
* Permit to use "free of charge" only for non-profit use.
|
62
|
-
* Add conditions for commercial use.
|
63
|
-
|
64
|
-
As a result, FlashCanvas Pro is available free of charge for non-profit
|
65
|
-
use. If you use FlashCanvas Pro for commercial purposes, however, you
|
66
|
-
are required to purchase a commercial license. This commercial license
|
67
|
-
includes the following rights:
|
68
|
-
|
69
|
-
* The licensee can use FlashCanvas Pro as many times as needed.
|
70
|
-
* The licensee can download the latest version of FlashCanvas Pro as
|
71
|
-
many times as needed.
|
72
|
-
|
73
|
-
|
74
|
-
Contact
|
75
|
-
-------
|
76
|
-
|
77
|
-
If you have a question about FlashCanvas Pro, please utilize the
|
78
|
-
discussion group and issue tracker found at the project page. If you
|
79
|
-
need to contact us directly, you can reach us at the e-mail address.
|
80
|
-
|
81
|
-
Project page: http://flashcanvas.net/
|
82
|
-
E-mail: info@flashcanvas.net
|
@@ -1,2872 +0,0 @@
|
|
1
|
-
//DOM-Extension helper
|
2
|
-
jQuery.webshims.register('dom-extend', function($, webshims, window, document, undefined){
|
3
|
-
"use strict";
|
4
|
-
//shortcus
|
5
|
-
var modules = webshims.modules;
|
6
|
-
var listReg = /\s*,\s*/;
|
7
|
-
|
8
|
-
//proxying attribute
|
9
|
-
var olds = {};
|
10
|
-
var havePolyfill = {};
|
11
|
-
var extendedProps = {};
|
12
|
-
var extendQ = {};
|
13
|
-
var modifyProps = {};
|
14
|
-
|
15
|
-
var oldVal = $.fn.val;
|
16
|
-
var singleVal = function(elem, name, val, pass, _argless){
|
17
|
-
return (_argless) ? oldVal.call($(elem)) : oldVal.call($(elem), val);
|
18
|
-
};
|
19
|
-
|
20
|
-
$.fn.onTrigger = function(evt, fn){
|
21
|
-
return this.on(evt, fn).each(fn);
|
22
|
-
};
|
23
|
-
|
24
|
-
$.fn.val = function(val){
|
25
|
-
var elem = this[0];
|
26
|
-
if(arguments.length && val == null){
|
27
|
-
val = '';
|
28
|
-
}
|
29
|
-
if(!arguments.length){
|
30
|
-
if(!elem || elem.nodeType !== 1){return oldVal.call(this);}
|
31
|
-
return $.prop(elem, 'value', val, 'val', true);
|
32
|
-
}
|
33
|
-
if($.isArray(val)){
|
34
|
-
return oldVal.apply(this, arguments);
|
35
|
-
}
|
36
|
-
var isFunction = $.isFunction(val);
|
37
|
-
return this.each(function(i){
|
38
|
-
elem = this;
|
39
|
-
if(elem.nodeType === 1){
|
40
|
-
if(isFunction){
|
41
|
-
var genVal = val.call( elem, i, $.prop(elem, 'value', undefined, 'val', true));
|
42
|
-
if(genVal == null){
|
43
|
-
genVal = '';
|
44
|
-
}
|
45
|
-
$.prop(elem, 'value', genVal, 'val') ;
|
46
|
-
} else {
|
47
|
-
$.prop(elem, 'value', val, 'val');
|
48
|
-
}
|
49
|
-
}
|
50
|
-
});
|
51
|
-
};
|
52
|
-
|
53
|
-
var dataID = '_webshimsLib'+ (Math.round(Math.random() * 1000));
|
54
|
-
var elementData = function(elem, key, val){
|
55
|
-
elem = elem.jquery ? elem[0] : elem;
|
56
|
-
if(!elem){return val || {};}
|
57
|
-
var data = $.data(elem, dataID);
|
58
|
-
if(val !== undefined){
|
59
|
-
if(!data){
|
60
|
-
data = $.data(elem, dataID, {});
|
61
|
-
}
|
62
|
-
if(key){
|
63
|
-
data[key] = val;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
return key ? data && data[key] : data;
|
68
|
-
};
|
69
|
-
|
70
|
-
|
71
|
-
[{name: 'getNativeElement', prop: 'nativeElement'}, {name: 'getShadowElement', prop: 'shadowElement'}, {name: 'getShadowFocusElement', prop: 'shadowFocusElement'}].forEach(function(data){
|
72
|
-
$.fn[data.name] = function(){
|
73
|
-
return this.map(function(){
|
74
|
-
var shadowData = elementData(this, 'shadowData');
|
75
|
-
return shadowData && shadowData[data.prop] || this;
|
76
|
-
});
|
77
|
-
};
|
78
|
-
});
|
79
|
-
|
80
|
-
|
81
|
-
['removeAttr', 'prop', 'attr'].forEach(function(type){
|
82
|
-
olds[type] = $[type];
|
83
|
-
$[type] = function(elem, name, value, pass, _argless){
|
84
|
-
var isVal = (pass == 'val');
|
85
|
-
var oldMethod = !isVal ? olds[type] : singleVal;
|
86
|
-
if( !elem || !havePolyfill[name] || elem.nodeType !== 1 || (!isVal && pass && type == 'attr' && $.attrFn[name]) ){
|
87
|
-
return oldMethod(elem, name, value, pass, _argless);
|
88
|
-
}
|
89
|
-
|
90
|
-
var nodeName = (elem.nodeName || '').toLowerCase();
|
91
|
-
var desc = extendedProps[nodeName];
|
92
|
-
var curType = (type == 'attr' && (value === false || value === null)) ? 'removeAttr' : type;
|
93
|
-
var propMethod;
|
94
|
-
var oldValMethod;
|
95
|
-
var ret;
|
96
|
-
|
97
|
-
|
98
|
-
if(!desc){
|
99
|
-
desc = extendedProps['*'];
|
100
|
-
}
|
101
|
-
if(desc){
|
102
|
-
desc = desc[name];
|
103
|
-
}
|
104
|
-
|
105
|
-
if(desc){
|
106
|
-
propMethod = desc[curType];
|
107
|
-
}
|
108
|
-
|
109
|
-
if(propMethod){
|
110
|
-
if(name == 'value'){
|
111
|
-
oldValMethod = propMethod.isVal;
|
112
|
-
propMethod.isVal = isVal;
|
113
|
-
}
|
114
|
-
if(curType === 'removeAttr'){
|
115
|
-
return propMethod.value.call(elem);
|
116
|
-
} else if(value === undefined){
|
117
|
-
return (propMethod.get) ?
|
118
|
-
propMethod.get.call(elem) :
|
119
|
-
propMethod.value
|
120
|
-
;
|
121
|
-
} else if(propMethod.set) {
|
122
|
-
if(type == 'attr' && value === true){
|
123
|
-
value = name;
|
124
|
-
}
|
125
|
-
|
126
|
-
ret = propMethod.set.call(elem, value);
|
127
|
-
}
|
128
|
-
if(name == 'value'){
|
129
|
-
propMethod.isVal = oldValMethod;
|
130
|
-
}
|
131
|
-
} else {
|
132
|
-
ret = oldMethod(elem, name, value, pass, _argless);
|
133
|
-
}
|
134
|
-
if((value !== undefined || curType === 'removeAttr') && modifyProps[nodeName] && modifyProps[nodeName][name]){
|
135
|
-
|
136
|
-
var boolValue;
|
137
|
-
if(curType == 'removeAttr'){
|
138
|
-
boolValue = false;
|
139
|
-
} else if(curType == 'prop'){
|
140
|
-
boolValue = !!(value);
|
141
|
-
} else {
|
142
|
-
boolValue = true;
|
143
|
-
}
|
144
|
-
|
145
|
-
modifyProps[nodeName][name].forEach(function(fn){
|
146
|
-
if(!fn.only || (fn.only = 'prop' && type == 'prop') || (fn.only == 'attr' && type != 'prop')){
|
147
|
-
fn.call(elem, value, boolValue, (isVal) ? 'val' : curType, type);
|
148
|
-
}
|
149
|
-
});
|
150
|
-
}
|
151
|
-
return ret;
|
152
|
-
};
|
153
|
-
|
154
|
-
extendQ[type] = function(nodeName, prop, desc){
|
155
|
-
|
156
|
-
if(!extendedProps[nodeName]){
|
157
|
-
extendedProps[nodeName] = {};
|
158
|
-
}
|
159
|
-
if(!extendedProps[nodeName][prop]){
|
160
|
-
extendedProps[nodeName][prop] = {};
|
161
|
-
}
|
162
|
-
var oldDesc = extendedProps[nodeName][prop][type];
|
163
|
-
var getSup = function(propType, descriptor, oDesc){
|
164
|
-
if(descriptor && descriptor[propType]){
|
165
|
-
return descriptor[propType];
|
166
|
-
}
|
167
|
-
if(oDesc && oDesc[propType]){
|
168
|
-
return oDesc[propType];
|
169
|
-
}
|
170
|
-
if(type == 'prop' && prop == 'value'){
|
171
|
-
return function(value){
|
172
|
-
var elem = this;
|
173
|
-
return (desc.isVal) ?
|
174
|
-
singleVal(elem, prop, value, false, (arguments.length === 0)) :
|
175
|
-
olds[type](elem, prop, value)
|
176
|
-
;
|
177
|
-
};
|
178
|
-
}
|
179
|
-
if(type == 'prop' && propType == 'value' && desc.value.apply){
|
180
|
-
return function(value){
|
181
|
-
var sup = olds[type](this, prop);
|
182
|
-
if(sup && sup.apply){
|
183
|
-
sup = sup.apply(this, arguments);
|
184
|
-
}
|
185
|
-
return sup;
|
186
|
-
};
|
187
|
-
}
|
188
|
-
return function(value){
|
189
|
-
return olds[type](this, prop, value);
|
190
|
-
};
|
191
|
-
};
|
192
|
-
extendedProps[nodeName][prop][type] = desc;
|
193
|
-
if(desc.value === undefined){
|
194
|
-
if(!desc.set){
|
195
|
-
desc.set = desc.writeable ?
|
196
|
-
getSup('set', desc, oldDesc) :
|
197
|
-
(webshims.cfg.useStrict && prop == 'prop') ?
|
198
|
-
function(){throw(prop +' is readonly on '+ nodeName);} :
|
199
|
-
$.noop
|
200
|
-
;
|
201
|
-
}
|
202
|
-
if(!desc.get){
|
203
|
-
desc.get = getSup('get', desc, oldDesc);
|
204
|
-
}
|
205
|
-
|
206
|
-
}
|
207
|
-
|
208
|
-
['value', 'get', 'set'].forEach(function(descProp){
|
209
|
-
if(desc[descProp]){
|
210
|
-
desc['_sup'+descProp] = getSup(descProp, oldDesc);
|
211
|
-
}
|
212
|
-
});
|
213
|
-
};
|
214
|
-
|
215
|
-
});
|
216
|
-
|
217
|
-
//see also: https://github.com/lojjic/PIE/issues/40 | https://prototype.lighthouseapp.com/projects/8886/tickets/1107-ie8-fatal-crash-when-prototypejs-is-loaded-with-rounded-cornershtc
|
218
|
-
var isExtendNativeSave = Modernizr.ES5;
|
219
|
-
var extendNativeValue = (function(){
|
220
|
-
var UNKNOWN = webshims.getPrototypeOf(document.createElement('foobar'));
|
221
|
-
var has = Object.prototype.hasOwnProperty;
|
222
|
-
return function(nodeName, prop, desc){
|
223
|
-
var elem;
|
224
|
-
var elemProto;
|
225
|
-
if( isExtendNativeSave && (elem = document.createElement(nodeName)) && (elemProto = webshims.getPrototypeOf(elem)) && UNKNOWN !== elemProto && ( !elem[prop] || !has.call(elem, prop) ) ){
|
226
|
-
var sup = elem[prop];
|
227
|
-
desc._supvalue = function(){
|
228
|
-
if(sup && sup.apply){
|
229
|
-
return sup.apply(this, arguments);
|
230
|
-
}
|
231
|
-
return sup;
|
232
|
-
};
|
233
|
-
elemProto[prop] = desc.value;
|
234
|
-
} else {
|
235
|
-
desc._supvalue = function(){
|
236
|
-
var data = elementData(this, 'propValue');
|
237
|
-
if(data && data[prop] && data[prop].apply){
|
238
|
-
return data[prop].apply(this, arguments);
|
239
|
-
}
|
240
|
-
return data && data[prop];
|
241
|
-
};
|
242
|
-
initProp.extendValue(nodeName, prop, desc.value);
|
243
|
-
}
|
244
|
-
desc.value._supvalue = desc._supvalue;
|
245
|
-
};
|
246
|
-
})();
|
247
|
-
|
248
|
-
var initProp = (function(){
|
249
|
-
|
250
|
-
var initProps = {};
|
251
|
-
|
252
|
-
webshims.addReady(function(context, contextElem){
|
253
|
-
var nodeNameCache = {};
|
254
|
-
var getElementsByName = function(name){
|
255
|
-
if(!nodeNameCache[name]){
|
256
|
-
nodeNameCache[name] = $(context.getElementsByTagName(name));
|
257
|
-
if(contextElem[0] && $.nodeName(contextElem[0], name)){
|
258
|
-
nodeNameCache[name] = nodeNameCache[name].add(contextElem);
|
259
|
-
}
|
260
|
-
}
|
261
|
-
};
|
262
|
-
|
263
|
-
|
264
|
-
$.each(initProps, function(name, fns){
|
265
|
-
getElementsByName(name);
|
266
|
-
if(!fns || !fns.forEach){
|
267
|
-
webshims.warn('Error: with '+ name +'-property. methods: '+ fns);
|
268
|
-
return;
|
269
|
-
}
|
270
|
-
fns.forEach(function(fn){
|
271
|
-
nodeNameCache[name].each(fn);
|
272
|
-
});
|
273
|
-
});
|
274
|
-
nodeNameCache = null;
|
275
|
-
});
|
276
|
-
|
277
|
-
var tempCache;
|
278
|
-
var emptyQ = $([]);
|
279
|
-
var createNodeNameInit = function(nodeName, fn){
|
280
|
-
if(!initProps[nodeName]){
|
281
|
-
initProps[nodeName] = [fn];
|
282
|
-
} else {
|
283
|
-
initProps[nodeName].push(fn);
|
284
|
-
}
|
285
|
-
if($.isDOMReady){
|
286
|
-
(tempCache || $( document.getElementsByTagName(nodeName) )).each(fn);
|
287
|
-
}
|
288
|
-
};
|
289
|
-
|
290
|
-
var elementExtends = {};
|
291
|
-
return {
|
292
|
-
createTmpCache: function(nodeName){
|
293
|
-
if($.isDOMReady){
|
294
|
-
tempCache = tempCache || $( document.getElementsByTagName(nodeName) );
|
295
|
-
}
|
296
|
-
return tempCache || emptyQ;
|
297
|
-
},
|
298
|
-
flushTmpCache: function(){
|
299
|
-
tempCache = null;
|
300
|
-
},
|
301
|
-
content: function(nodeName, prop){
|
302
|
-
createNodeNameInit(nodeName, function(){
|
303
|
-
var val = $.attr(this, prop);
|
304
|
-
if(val != null){
|
305
|
-
$.attr(this, prop, val);
|
306
|
-
}
|
307
|
-
});
|
308
|
-
},
|
309
|
-
createElement: function(nodeName, fn){
|
310
|
-
createNodeNameInit(nodeName, fn);
|
311
|
-
},
|
312
|
-
extendValue: function(nodeName, prop, value){
|
313
|
-
createNodeNameInit(nodeName, function(){
|
314
|
-
$(this).each(function(){
|
315
|
-
var data = elementData(this, 'propValue', {});
|
316
|
-
data[prop] = this[prop];
|
317
|
-
this[prop] = value;
|
318
|
-
});
|
319
|
-
});
|
320
|
-
}
|
321
|
-
};
|
322
|
-
})();
|
323
|
-
|
324
|
-
var createPropDefault = function(descs, removeType){
|
325
|
-
if(descs.defaultValue === undefined){
|
326
|
-
descs.defaultValue = '';
|
327
|
-
}
|
328
|
-
if(!descs.removeAttr){
|
329
|
-
descs.removeAttr = {
|
330
|
-
value: function(){
|
331
|
-
descs[removeType || 'prop'].set.call(this, descs.defaultValue);
|
332
|
-
descs.removeAttr._supvalue.call(this);
|
333
|
-
}
|
334
|
-
};
|
335
|
-
}
|
336
|
-
if(!descs.attr){
|
337
|
-
descs.attr = {};
|
338
|
-
}
|
339
|
-
};
|
340
|
-
|
341
|
-
$.extend(webshims, {
|
342
|
-
|
343
|
-
getID: (function(){
|
344
|
-
var ID = new Date().getTime();
|
345
|
-
return function(elem){
|
346
|
-
elem = $(elem);
|
347
|
-
var id = elem.attr('id');
|
348
|
-
if(!id){
|
349
|
-
ID++;
|
350
|
-
id = 'ID-'+ ID;
|
351
|
-
elem.attr('id', id);
|
352
|
-
}
|
353
|
-
return id;
|
354
|
-
};
|
355
|
-
})(),
|
356
|
-
extendUNDEFProp: function(obj, props){
|
357
|
-
$.each(props, function(name, prop){
|
358
|
-
if( !(name in obj) ){
|
359
|
-
obj[name] = prop;
|
360
|
-
}
|
361
|
-
});
|
362
|
-
},
|
363
|
-
//http://www.w3.org/TR/html5/common-dom-interfaces.html#reflect
|
364
|
-
createPropDefault: createPropDefault,
|
365
|
-
data: elementData,
|
366
|
-
moveToFirstEvent: function(elem, eventType, bindType){
|
367
|
-
var events = ($._data(elem, 'events') || {})[eventType];
|
368
|
-
var fn;
|
369
|
-
|
370
|
-
if(events && events.length > 1){
|
371
|
-
fn = events.pop();
|
372
|
-
if(!bindType){
|
373
|
-
bindType = 'bind';
|
374
|
-
}
|
375
|
-
if(bindType == 'bind' && events.delegateCount){
|
376
|
-
events.splice( events.delegateCount, 0, fn);
|
377
|
-
} else {
|
378
|
-
events.unshift( fn );
|
379
|
-
}
|
380
|
-
|
381
|
-
|
382
|
-
}
|
383
|
-
elem = null;
|
384
|
-
},
|
385
|
-
addShadowDom: (function(){
|
386
|
-
var resizeTimer;
|
387
|
-
var lastHeight;
|
388
|
-
var lastWidth;
|
389
|
-
|
390
|
-
var docObserve = {
|
391
|
-
init: false,
|
392
|
-
runs: 0,
|
393
|
-
test: function(){
|
394
|
-
var height = docObserve.getHeight();
|
395
|
-
var width = docObserve.getWidth();
|
396
|
-
|
397
|
-
if(height != docObserve.height || width != docObserve.width){
|
398
|
-
docObserve.height = height;
|
399
|
-
docObserve.width = width;
|
400
|
-
docObserve.handler({type: 'docresize'});
|
401
|
-
docObserve.runs++;
|
402
|
-
if(docObserve.runs < 9){
|
403
|
-
setTimeout(docObserve.test, 90);
|
404
|
-
}
|
405
|
-
} else {
|
406
|
-
docObserve.runs = 0;
|
407
|
-
}
|
408
|
-
},
|
409
|
-
handler: function(e){
|
410
|
-
clearTimeout(resizeTimer);
|
411
|
-
resizeTimer = setTimeout(function(){
|
412
|
-
if(e.type == 'resize'){
|
413
|
-
var width = $(window).width();
|
414
|
-
var height = $(window).width();
|
415
|
-
if(height == lastHeight && width == lastWidth){
|
416
|
-
return;
|
417
|
-
}
|
418
|
-
lastHeight = height;
|
419
|
-
lastWidth = width;
|
420
|
-
|
421
|
-
docObserve.height = docObserve.getHeight();
|
422
|
-
docObserve.width = docObserve.getWidth();
|
423
|
-
|
424
|
-
}
|
425
|
-
$(document).triggerHandler('updateshadowdom');
|
426
|
-
}, (e.type == 'resize') ? 50 : 9);
|
427
|
-
},
|
428
|
-
_create: function(){
|
429
|
-
$.each({ Height: "getHeight", Width: "getWidth" }, function(name, type){
|
430
|
-
var body = document.body;
|
431
|
-
var doc = document.documentElement;
|
432
|
-
docObserve[type] = function(){
|
433
|
-
return Math.max(
|
434
|
-
body[ "scroll" + name ], doc[ "scroll" + name ],
|
435
|
-
body[ "offset" + name ], doc[ "offset" + name ],
|
436
|
-
doc[ "client" + name ]
|
437
|
-
);
|
438
|
-
};
|
439
|
-
});
|
440
|
-
},
|
441
|
-
start: function(){
|
442
|
-
if(!this.init && document.body){
|
443
|
-
this.init = true;
|
444
|
-
this._create();
|
445
|
-
this.height = docObserve.getHeight();
|
446
|
-
this.width = docObserve.getWidth();
|
447
|
-
setInterval(this.test, 600);
|
448
|
-
$(this.test);
|
449
|
-
webshims.ready('WINDOWLOAD', this.test);
|
450
|
-
$(window).bind('resize', this.handler);
|
451
|
-
(function(){
|
452
|
-
var oldAnimate = $.fn.animate;
|
453
|
-
var animationTimer;
|
454
|
-
|
455
|
-
$.fn.animate = function(){
|
456
|
-
clearTimeout(animationTimer);
|
457
|
-
animationTimer = setTimeout(function(){
|
458
|
-
docObserve.test();
|
459
|
-
}, 99);
|
460
|
-
|
461
|
-
return oldAnimate.apply(this, arguments);
|
462
|
-
};
|
463
|
-
})();
|
464
|
-
}
|
465
|
-
}
|
466
|
-
};
|
467
|
-
|
468
|
-
|
469
|
-
webshims.docObserve = function(){
|
470
|
-
webshims.ready('DOM', function(){
|
471
|
-
docObserve.start();
|
472
|
-
});
|
473
|
-
};
|
474
|
-
return function(nativeElem, shadowElem, opts){
|
475
|
-
opts = opts || {};
|
476
|
-
if(nativeElem.jquery){
|
477
|
-
nativeElem = nativeElem[0];
|
478
|
-
}
|
479
|
-
if(shadowElem.jquery){
|
480
|
-
shadowElem = shadowElem[0];
|
481
|
-
}
|
482
|
-
var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
|
483
|
-
var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
|
484
|
-
var shadowFocusElementData = {};
|
485
|
-
if(!opts.shadowFocusElement){
|
486
|
-
opts.shadowFocusElement = shadowElem;
|
487
|
-
} else if(opts.shadowFocusElement){
|
488
|
-
if(opts.shadowFocusElement.jquery){
|
489
|
-
opts.shadowFocusElement = opts.shadowFocusElement[0];
|
490
|
-
}
|
491
|
-
shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
|
492
|
-
}
|
493
|
-
|
494
|
-
nativeData.hasShadow = shadowElem;
|
495
|
-
shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
|
496
|
-
shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
|
497
|
-
nativeElement: nativeElem,
|
498
|
-
shadowElement: shadowElem,
|
499
|
-
shadowFocusElement: opts.shadowFocusElement
|
500
|
-
};
|
501
|
-
if(opts.shadowChilds){
|
502
|
-
opts.shadowChilds.each(function(){
|
503
|
-
elementData(this, 'shadowData', shadowData.shadowData);
|
504
|
-
});
|
505
|
-
}
|
506
|
-
|
507
|
-
if(opts.data){
|
508
|
-
shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
|
509
|
-
}
|
510
|
-
opts = null;
|
511
|
-
webshims.docObserve();
|
512
|
-
};
|
513
|
-
})(),
|
514
|
-
propTypes: {
|
515
|
-
standard: function(descs, name){
|
516
|
-
createPropDefault(descs);
|
517
|
-
if(descs.prop){return;}
|
518
|
-
descs.prop = {
|
519
|
-
set: function(val){
|
520
|
-
descs.attr.set.call(this, ''+val);
|
521
|
-
},
|
522
|
-
get: function(){
|
523
|
-
return descs.attr.get.call(this) || descs.defaultValue;
|
524
|
-
}
|
525
|
-
};
|
526
|
-
|
527
|
-
},
|
528
|
-
"boolean": function(descs, name){
|
529
|
-
|
530
|
-
createPropDefault(descs);
|
531
|
-
if(descs.prop){return;}
|
532
|
-
descs.prop = {
|
533
|
-
set: function(val){
|
534
|
-
if(val){
|
535
|
-
descs.attr.set.call(this, "");
|
536
|
-
} else {
|
537
|
-
descs.removeAttr.value.call(this);
|
538
|
-
}
|
539
|
-
},
|
540
|
-
get: function(){
|
541
|
-
return descs.attr.get.call(this) != null;
|
542
|
-
}
|
543
|
-
};
|
544
|
-
},
|
545
|
-
"src": (function(){
|
546
|
-
var anchor = document.createElement('a');
|
547
|
-
anchor.style.display = "none";
|
548
|
-
return function(descs, name){
|
549
|
-
|
550
|
-
createPropDefault(descs);
|
551
|
-
if(descs.prop){return;}
|
552
|
-
descs.prop = {
|
553
|
-
set: function(val){
|
554
|
-
descs.attr.set.call(this, val);
|
555
|
-
},
|
556
|
-
get: function(){
|
557
|
-
var href = this.getAttribute(name);
|
558
|
-
var ret;
|
559
|
-
if(href == null){return '';}
|
560
|
-
|
561
|
-
anchor.setAttribute('href', href+'' );
|
562
|
-
|
563
|
-
if(!$.support.hrefNormalized){
|
564
|
-
try {
|
565
|
-
$(anchor).insertAfter(this);
|
566
|
-
ret = anchor.getAttribute('href', 4);
|
567
|
-
} catch(er){
|
568
|
-
ret = anchor.getAttribute('href', 4);
|
569
|
-
}
|
570
|
-
$(anchor).detach();
|
571
|
-
}
|
572
|
-
return ret || anchor.href;
|
573
|
-
}
|
574
|
-
};
|
575
|
-
};
|
576
|
-
})(),
|
577
|
-
enumarated: function(descs, name){
|
578
|
-
|
579
|
-
createPropDefault(descs);
|
580
|
-
if(descs.prop){return;}
|
581
|
-
descs.prop = {
|
582
|
-
set: function(val){
|
583
|
-
descs.attr.set.call(this, val);
|
584
|
-
},
|
585
|
-
get: function(){
|
586
|
-
var val = (descs.attr.get.call(this) || '').toLowerCase();
|
587
|
-
if(!val || descs.limitedTo.indexOf(val) == -1){
|
588
|
-
val = descs.defaultValue;
|
589
|
-
}
|
590
|
-
return val;
|
591
|
-
}
|
592
|
-
};
|
593
|
-
}
|
594
|
-
|
595
|
-
// ,unsignedLong: $.noop
|
596
|
-
// ,"doubble": $.noop
|
597
|
-
// ,"long": $.noop
|
598
|
-
// ,tokenlist: $.noop
|
599
|
-
// ,settableTokenlist: $.noop
|
600
|
-
},
|
601
|
-
reflectProperties: function(nodeNames, props){
|
602
|
-
if(typeof props == 'string'){
|
603
|
-
props = props.split(listReg);
|
604
|
-
}
|
605
|
-
props.forEach(function(prop){
|
606
|
-
webshims.defineNodeNamesProperty(nodeNames, prop, {
|
607
|
-
prop: {
|
608
|
-
set: function(val){
|
609
|
-
$.attr(this, prop, val);
|
610
|
-
},
|
611
|
-
get: function(){
|
612
|
-
return $.attr(this, prop) || '';
|
613
|
-
}
|
614
|
-
}
|
615
|
-
});
|
616
|
-
});
|
617
|
-
},
|
618
|
-
defineNodeNameProperty: function(nodeName, prop, descs){
|
619
|
-
havePolyfill[prop] = true;
|
620
|
-
|
621
|
-
if(descs.reflect){
|
622
|
-
webshims.propTypes[descs.propType || 'standard'](descs, prop);
|
623
|
-
}
|
624
|
-
|
625
|
-
['prop', 'attr', 'removeAttr'].forEach(function(type){
|
626
|
-
var desc = descs[type];
|
627
|
-
if(desc){
|
628
|
-
if(type === 'prop'){
|
629
|
-
desc = $.extend({writeable: true}, desc);
|
630
|
-
} else {
|
631
|
-
desc = $.extend({}, desc, {writeable: true});
|
632
|
-
}
|
633
|
-
|
634
|
-
extendQ[type](nodeName, prop, desc);
|
635
|
-
if(nodeName != '*' && webshims.cfg.extendNative && type == 'prop' && desc.value && $.isFunction(desc.value)){
|
636
|
-
extendNativeValue(nodeName, prop, desc);
|
637
|
-
}
|
638
|
-
descs[type] = desc;
|
639
|
-
}
|
640
|
-
});
|
641
|
-
if(descs.initAttr){
|
642
|
-
initProp.content(nodeName, prop);
|
643
|
-
}
|
644
|
-
return descs;
|
645
|
-
},
|
646
|
-
|
647
|
-
defineNodeNameProperties: function(name, descs, propType, _noTmpCache){
|
648
|
-
var olddesc;
|
649
|
-
for(var prop in descs){
|
650
|
-
if(!_noTmpCache && descs[prop].initAttr){
|
651
|
-
initProp.createTmpCache(name);
|
652
|
-
}
|
653
|
-
if(propType){
|
654
|
-
if(descs[prop][propType]){
|
655
|
-
//webshims.log('override: '+ name +'['+prop +'] for '+ propType);
|
656
|
-
} else {
|
657
|
-
descs[prop][propType] = {};
|
658
|
-
['value', 'set', 'get'].forEach(function(copyProp){
|
659
|
-
if(copyProp in descs[prop]){
|
660
|
-
descs[prop][propType][copyProp] = descs[prop][copyProp];
|
661
|
-
delete descs[prop][copyProp];
|
662
|
-
}
|
663
|
-
});
|
664
|
-
}
|
665
|
-
}
|
666
|
-
descs[prop] = webshims.defineNodeNameProperty(name, prop, descs[prop]);
|
667
|
-
}
|
668
|
-
if(!_noTmpCache){
|
669
|
-
initProp.flushTmpCache();
|
670
|
-
}
|
671
|
-
return descs;
|
672
|
-
},
|
673
|
-
|
674
|
-
createElement: function(nodeName, create, descs){
|
675
|
-
var ret;
|
676
|
-
if($.isFunction(create)){
|
677
|
-
create = {
|
678
|
-
after: create
|
679
|
-
};
|
680
|
-
}
|
681
|
-
initProp.createTmpCache(nodeName);
|
682
|
-
if(create.before){
|
683
|
-
initProp.createElement(nodeName, create.before);
|
684
|
-
}
|
685
|
-
if(descs){
|
686
|
-
ret = webshims.defineNodeNameProperties(nodeName, descs, false, true);
|
687
|
-
}
|
688
|
-
if(create.after){
|
689
|
-
initProp.createElement(nodeName, create.after);
|
690
|
-
}
|
691
|
-
initProp.flushTmpCache();
|
692
|
-
return ret;
|
693
|
-
},
|
694
|
-
onNodeNamesPropertyModify: function(nodeNames, props, desc, only){
|
695
|
-
if(typeof nodeNames == 'string'){
|
696
|
-
nodeNames = nodeNames.split(listReg);
|
697
|
-
}
|
698
|
-
if($.isFunction(desc)){
|
699
|
-
desc = {set: desc};
|
700
|
-
}
|
701
|
-
|
702
|
-
nodeNames.forEach(function(name){
|
703
|
-
if(!modifyProps[name]){
|
704
|
-
modifyProps[name] = {};
|
705
|
-
}
|
706
|
-
if(typeof props == 'string'){
|
707
|
-
props = props.split(listReg);
|
708
|
-
}
|
709
|
-
if(desc.initAttr){
|
710
|
-
initProp.createTmpCache(name);
|
711
|
-
}
|
712
|
-
props.forEach(function(prop){
|
713
|
-
if(!modifyProps[name][prop]){
|
714
|
-
modifyProps[name][prop] = [];
|
715
|
-
havePolyfill[prop] = true;
|
716
|
-
}
|
717
|
-
if(desc.set){
|
718
|
-
if(only){
|
719
|
-
desc.set.only = only;
|
720
|
-
}
|
721
|
-
modifyProps[name][prop].push(desc.set);
|
722
|
-
}
|
723
|
-
|
724
|
-
if(desc.initAttr){
|
725
|
-
initProp.content(name, prop);
|
726
|
-
}
|
727
|
-
});
|
728
|
-
initProp.flushTmpCache();
|
729
|
-
|
730
|
-
});
|
731
|
-
},
|
732
|
-
defineNodeNamesBooleanProperty: function(elementNames, prop, descs){
|
733
|
-
if(!descs){
|
734
|
-
descs = {};
|
735
|
-
}
|
736
|
-
if($.isFunction(descs)){
|
737
|
-
descs.set = descs;
|
738
|
-
}
|
739
|
-
webshims.defineNodeNamesProperty(elementNames, prop, {
|
740
|
-
attr: {
|
741
|
-
set: function(val){
|
742
|
-
this.setAttribute(prop, val);
|
743
|
-
if(descs.set){
|
744
|
-
descs.set.call(this, true);
|
745
|
-
}
|
746
|
-
},
|
747
|
-
get: function(){
|
748
|
-
var ret = this.getAttribute(prop);
|
749
|
-
return (ret == null) ? undefined : prop;
|
750
|
-
}
|
751
|
-
},
|
752
|
-
removeAttr: {
|
753
|
-
value: function(){
|
754
|
-
this.removeAttribute(prop);
|
755
|
-
if(descs.set){
|
756
|
-
descs.set.call(this, false);
|
757
|
-
}
|
758
|
-
}
|
759
|
-
},
|
760
|
-
reflect: true,
|
761
|
-
propType: 'boolean',
|
762
|
-
initAttr: descs.initAttr || false
|
763
|
-
});
|
764
|
-
},
|
765
|
-
contentAttr: function(elem, name, val){
|
766
|
-
if(!elem.nodeName){return;}
|
767
|
-
var attr;
|
768
|
-
if(val === undefined){
|
769
|
-
attr = (elem.attributes[name] || {});
|
770
|
-
val = attr.specified ? attr.value : null;
|
771
|
-
return (val == null) ? undefined : val;
|
772
|
-
}
|
773
|
-
|
774
|
-
if(typeof val == 'boolean'){
|
775
|
-
if(!val){
|
776
|
-
elem.removeAttribute(name);
|
777
|
-
} else {
|
778
|
-
elem.setAttribute(name, name);
|
779
|
-
}
|
780
|
-
} else {
|
781
|
-
elem.setAttribute(name, val);
|
782
|
-
}
|
783
|
-
},
|
784
|
-
|
785
|
-
// set current Lang:
|
786
|
-
// - webshims.activeLang(lang:string);
|
787
|
-
// get current lang
|
788
|
-
// - webshims.activeLang();
|
789
|
-
// get current lang
|
790
|
-
// webshims.activeLang({
|
791
|
-
// register: moduleName:string,
|
792
|
-
// callback: callback:function
|
793
|
-
// });
|
794
|
-
// get/set including removeLang
|
795
|
-
// - webshims.activeLang({
|
796
|
-
// module: moduleName:string,
|
797
|
-
// callback: callback:function,
|
798
|
-
// langObj: languageObj:array/object
|
799
|
-
// });
|
800
|
-
activeLang: (function(){
|
801
|
-
var callbacks = [];
|
802
|
-
var registeredCallbacks = {};
|
803
|
-
var currentLang;
|
804
|
-
var shortLang;
|
805
|
-
var notLocal = /:\/\/|^\.*\//;
|
806
|
-
var loadRemoteLang = function(data, lang, options){
|
807
|
-
var langSrc;
|
808
|
-
if(lang && options && $.inArray(lang, options.availabeLangs || []) !== -1){
|
809
|
-
data.loading = true;
|
810
|
-
langSrc = options.langSrc;
|
811
|
-
if(!notLocal.test(langSrc)){
|
812
|
-
langSrc = webshims.cfg.basePath+langSrc;
|
813
|
-
}
|
814
|
-
webshims.loader.loadScript(langSrc+lang+'.js', function(){
|
815
|
-
if(data.langObj[lang]){
|
816
|
-
data.loading = false;
|
817
|
-
callLang(data, true);
|
818
|
-
} else {
|
819
|
-
$(function(){
|
820
|
-
if(data.langObj[lang]){
|
821
|
-
callLang(data, true);
|
822
|
-
}
|
823
|
-
data.loading = false;
|
824
|
-
});
|
825
|
-
}
|
826
|
-
});
|
827
|
-
return true;
|
828
|
-
}
|
829
|
-
return false;
|
830
|
-
};
|
831
|
-
var callRegister = function(module){
|
832
|
-
if(registeredCallbacks[module]){
|
833
|
-
registeredCallbacks[module].forEach(function(data){
|
834
|
-
data.callback();
|
835
|
-
});
|
836
|
-
}
|
837
|
-
};
|
838
|
-
var callLang = function(data, _noLoop){
|
839
|
-
if(data.activeLang != currentLang && data.activeLang !== shortLang){
|
840
|
-
var options = modules[data.module].options;
|
841
|
-
if( data.langObj[currentLang] || (shortLang && data.langObj[shortLang]) ){
|
842
|
-
data.activeLang = currentLang;
|
843
|
-
data.callback(data.langObj[currentLang] || data.langObj[shortLang], currentLang);
|
844
|
-
callRegister(data.module);
|
845
|
-
} else if( !_noLoop &&
|
846
|
-
!loadRemoteLang(data, currentLang, options) &&
|
847
|
-
!loadRemoteLang(data, shortLang, options) &&
|
848
|
-
data.langObj[''] && data.activeLang !== '' ) {
|
849
|
-
data.activeLang = '';
|
850
|
-
data.callback(data.langObj[''], currentLang);
|
851
|
-
callRegister(data.module);
|
852
|
-
}
|
853
|
-
}
|
854
|
-
};
|
855
|
-
|
856
|
-
|
857
|
-
var activeLang = function(lang){
|
858
|
-
|
859
|
-
if(typeof lang == 'string' && lang !== currentLang){
|
860
|
-
currentLang = lang;
|
861
|
-
shortLang = currentLang.split('-')[0];
|
862
|
-
if(currentLang == shortLang){
|
863
|
-
shortLang = false;
|
864
|
-
}
|
865
|
-
$.each(callbacks, function(i, data){
|
866
|
-
callLang(data);
|
867
|
-
});
|
868
|
-
} else if(typeof lang == 'object'){
|
869
|
-
|
870
|
-
if(lang.register){
|
871
|
-
if(!registeredCallbacks[lang.register]){
|
872
|
-
registeredCallbacks[lang.register] = [];
|
873
|
-
}
|
874
|
-
registeredCallbacks[lang.register].push(lang);
|
875
|
-
lang.callback();
|
876
|
-
} else {
|
877
|
-
if(!lang.activeLang){
|
878
|
-
lang.activeLang = '';
|
879
|
-
}
|
880
|
-
callbacks.push(lang);
|
881
|
-
callLang(lang);
|
882
|
-
}
|
883
|
-
}
|
884
|
-
return currentLang;
|
885
|
-
};
|
886
|
-
|
887
|
-
return activeLang;
|
888
|
-
})()
|
889
|
-
});
|
890
|
-
|
891
|
-
$.each({
|
892
|
-
defineNodeNamesProperty: 'defineNodeNameProperty',
|
893
|
-
defineNodeNamesProperties: 'defineNodeNameProperties',
|
894
|
-
createElements: 'createElement'
|
895
|
-
}, function(name, baseMethod){
|
896
|
-
webshims[name] = function(names, a, b, c){
|
897
|
-
if(typeof names == 'string'){
|
898
|
-
names = names.split(listReg);
|
899
|
-
}
|
900
|
-
var retDesc = {};
|
901
|
-
names.forEach(function(nodeName){
|
902
|
-
retDesc[nodeName] = webshims[baseMethod](nodeName, a, b, c);
|
903
|
-
});
|
904
|
-
return retDesc;
|
905
|
-
};
|
906
|
-
});
|
907
|
-
|
908
|
-
webshims.isReady('webshimLocalization', true);
|
909
|
-
});
|
910
|
-
//html5a11y
|
911
|
-
(function($, document){
|
912
|
-
//if we support basic styleing or do not support ARIA (assumed) abort
|
913
|
-
if(!Modernizr.localstorage || ('hidden' in document.createElement('a'))){return;}
|
914
|
-
|
915
|
-
var elemMappings = {
|
916
|
-
article: "article",
|
917
|
-
aside: "complementary",
|
918
|
-
section: "region",
|
919
|
-
nav: "navigation",
|
920
|
-
address: "contentinfo"
|
921
|
-
};
|
922
|
-
var addRole = function(elem, role){
|
923
|
-
var hasRole = elem.getAttribute('role');
|
924
|
-
if (!hasRole) {
|
925
|
-
elem.setAttribute('role', role);
|
926
|
-
}
|
927
|
-
};
|
928
|
-
|
929
|
-
$.webshims.addReady(function(context, contextElem){
|
930
|
-
$.each(elemMappings, function(name, role){
|
931
|
-
var elems = $(name, context).add(contextElem.filter(name));
|
932
|
-
for (var i = 0, len = elems.length; i < len; i++) {
|
933
|
-
addRole(elems[i], role);
|
934
|
-
}
|
935
|
-
});
|
936
|
-
if (context === document) {
|
937
|
-
var header = document.getElementsByTagName('header')[0];
|
938
|
-
var footers = document.getElementsByTagName('footer');
|
939
|
-
var footerLen = footers.length;
|
940
|
-
if (header && !$(header).closest('section, article')[0]) {
|
941
|
-
addRole(header, 'banner');
|
942
|
-
}
|
943
|
-
if (!footerLen) {
|
944
|
-
return;
|
945
|
-
}
|
946
|
-
var footer = footers[footerLen - 1];
|
947
|
-
if (!$(footer).closest('section, article')[0]) {
|
948
|
-
addRole(footer, 'contentinfo');
|
949
|
-
}
|
950
|
-
}
|
951
|
-
});
|
952
|
-
|
953
|
-
})(jQuery, document);
|
954
|
-
|
955
|
-
//additional tests for partial implementation of forms features
|
956
|
-
(function($){
|
957
|
-
"use strict";
|
958
|
-
var isWebkit = /webkit/i.test(navigator.userAgent);
|
959
|
-
var Modernizr = window.Modernizr;
|
960
|
-
var webshims = $.webshims;
|
961
|
-
var bugs = webshims.bugs;
|
962
|
-
var form = $('<form action="#" style="width: 1px; height: 1px; overflow: hidden;"><select name="b" required="" /><input required="" name="a" /></form>');
|
963
|
-
var testRequiredFind = function(){
|
964
|
-
if(form[0].querySelector){
|
965
|
-
try {
|
966
|
-
bugs.findRequired = !(form[0].querySelector('select:required'));
|
967
|
-
} catch(er){
|
968
|
-
bugs.findRequired = false;
|
969
|
-
}
|
970
|
-
}
|
971
|
-
};
|
972
|
-
var inputElem = $('input', form).eq(0);
|
973
|
-
var onDomextend = function(fn){
|
974
|
-
webshims.loader.loadList(['dom-extend']);
|
975
|
-
webshims.ready('dom-extend', fn);
|
976
|
-
};
|
977
|
-
|
978
|
-
bugs.findRequired = false;
|
979
|
-
bugs.validationMessage = false;
|
980
|
-
|
981
|
-
webshims.capturingEventPrevented = function(e){
|
982
|
-
if(!e._isPolyfilled){
|
983
|
-
var isDefaultPrevented = e.isDefaultPrevented;
|
984
|
-
var preventDefault = e.preventDefault;
|
985
|
-
e.preventDefault = function(){
|
986
|
-
clearTimeout($.data(e.target, e.type + 'DefaultPrevented'));
|
987
|
-
$.data(e.target, e.type + 'DefaultPrevented', setTimeout(function(){
|
988
|
-
$.removeData(e.target, e.type + 'DefaultPrevented');
|
989
|
-
}, 30));
|
990
|
-
return preventDefault.apply(this, arguments);
|
991
|
-
};
|
992
|
-
e.isDefaultPrevented = function(){
|
993
|
-
return !!(isDefaultPrevented.apply(this, arguments) || $.data(e.target, e.type + 'DefaultPrevented') || false);
|
994
|
-
};
|
995
|
-
e._isPolyfilled = true;
|
996
|
-
}
|
997
|
-
};
|
998
|
-
|
999
|
-
if(!Modernizr.formvalidation || bugs.bustedValidity){
|
1000
|
-
testRequiredFind();
|
1001
|
-
} else {
|
1002
|
-
//create delegatable events
|
1003
|
-
webshims.capturingEvents(['input']);
|
1004
|
-
webshims.capturingEvents(['invalid'], true);
|
1005
|
-
|
1006
|
-
if(window.opera || window.testGoodWithFix){
|
1007
|
-
|
1008
|
-
form.appendTo('head');
|
1009
|
-
|
1010
|
-
testRequiredFind();
|
1011
|
-
bugs.validationMessage = !(inputElem.prop('validationMessage'));
|
1012
|
-
|
1013
|
-
webshims.reTest(['form-native-extend', 'form-message']);
|
1014
|
-
|
1015
|
-
form.remove();
|
1016
|
-
|
1017
|
-
$(function(){
|
1018
|
-
onDomextend(function(){
|
1019
|
-
|
1020
|
-
//Opera shows native validation bubbles in case of input.checkValidity()
|
1021
|
-
// Opera 11.6/12 hasn't fixed this issue right, it's buggy
|
1022
|
-
var preventDefault = function(e){
|
1023
|
-
e.preventDefault();
|
1024
|
-
};
|
1025
|
-
|
1026
|
-
['form', 'input', 'textarea', 'select'].forEach(function(name){
|
1027
|
-
var desc = webshims.defineNodeNameProperty(name, 'checkValidity', {
|
1028
|
-
prop: {
|
1029
|
-
value: function(){
|
1030
|
-
if (!webshims.fromSubmit) {
|
1031
|
-
$(this).on('invalid.checkvalidity', preventDefault);
|
1032
|
-
}
|
1033
|
-
|
1034
|
-
webshims.fromCheckValidity = true;
|
1035
|
-
var ret = desc.prop._supvalue.apply(this, arguments);
|
1036
|
-
if (!webshims.fromSubmit) {
|
1037
|
-
$(this).unbind('invalid.checkvalidity', preventDefault);
|
1038
|
-
}
|
1039
|
-
webshims.fromCheckValidity = false;
|
1040
|
-
return ret;
|
1041
|
-
}
|
1042
|
-
}
|
1043
|
-
});
|
1044
|
-
});
|
1045
|
-
|
1046
|
-
});
|
1047
|
-
});
|
1048
|
-
}
|
1049
|
-
|
1050
|
-
if(isWebkit && !webshims.bugs.bustedValidity){
|
1051
|
-
(function(){
|
1052
|
-
var elems = /^(?:textarea|input)$/i;
|
1053
|
-
var form = false;
|
1054
|
-
|
1055
|
-
document.addEventListener('contextmenu', function(e){
|
1056
|
-
if(elems.test( e.target.nodeName || '') && (form = e.target.form)){
|
1057
|
-
setTimeout(function(){
|
1058
|
-
form = false;
|
1059
|
-
}, 1);
|
1060
|
-
}
|
1061
|
-
}, false);
|
1062
|
-
|
1063
|
-
$(window).on('invalid', function(e){
|
1064
|
-
if(e.originalEvent && form && form == e.target.form){
|
1065
|
-
e.wrongWebkitInvalid = true;
|
1066
|
-
e.stopImmediatePropagation();
|
1067
|
-
}
|
1068
|
-
});
|
1069
|
-
|
1070
|
-
})();
|
1071
|
-
}
|
1072
|
-
}
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
jQuery.webshims.register('form-core', function($, webshims, window, document, undefined, options){
|
1077
|
-
"use strict";
|
1078
|
-
|
1079
|
-
|
1080
|
-
var checkTypes = {checkbox: 1, radio: 1};
|
1081
|
-
var emptyJ = $([]);
|
1082
|
-
var bugs = webshims.bugs;
|
1083
|
-
var groupTypes = {radio: 1};
|
1084
|
-
var getGroupElements = function(elem){
|
1085
|
-
elem = $(elem);
|
1086
|
-
var name;
|
1087
|
-
var form;
|
1088
|
-
var ret = emptyJ;
|
1089
|
-
if(groupTypes[elem[0].type]){
|
1090
|
-
form = elem.prop('form');
|
1091
|
-
name = elem[0].name;
|
1092
|
-
if(!name){
|
1093
|
-
ret = elem;
|
1094
|
-
} else if(form){
|
1095
|
-
ret = $(form[name]);
|
1096
|
-
} else {
|
1097
|
-
ret = $(document.getElementsByName(name)).filter(function(){
|
1098
|
-
return !$.prop(this, 'form');
|
1099
|
-
});
|
1100
|
-
}
|
1101
|
-
ret = ret.filter('[type="radio"]');
|
1102
|
-
}
|
1103
|
-
return ret;
|
1104
|
-
};
|
1105
|
-
|
1106
|
-
var getContentValidationMessage = webshims.getContentValidationMessage = function(elem, validity, key){
|
1107
|
-
var message = $(elem).data('errormessage') || elem.getAttribute('x-moz-errormessage') || '';
|
1108
|
-
if(key && message[key]){
|
1109
|
-
message = message[key];
|
1110
|
-
}
|
1111
|
-
if(typeof message == 'object'){
|
1112
|
-
validity = validity || $.prop(elem, 'validity') || {valid: 1};
|
1113
|
-
if(!validity.valid){
|
1114
|
-
$.each(validity, function(name, prop){
|
1115
|
-
if(prop && name != 'valid' && message[name]){
|
1116
|
-
message = message[name];
|
1117
|
-
return false;
|
1118
|
-
}
|
1119
|
-
});
|
1120
|
-
}
|
1121
|
-
}
|
1122
|
-
|
1123
|
-
if(typeof message == 'object'){
|
1124
|
-
message = message.defaultMessage;
|
1125
|
-
}
|
1126
|
-
return message || '';
|
1127
|
-
};
|
1128
|
-
|
1129
|
-
/*
|
1130
|
-
* Selectors for all browsers
|
1131
|
-
*/
|
1132
|
-
var rangeTypes = {number: 1, range: 1, date: 1/*, time: 1, 'datetime-local': 1, datetime: 1, month: 1, week: 1*/};
|
1133
|
-
var hasInvalid = function(elem){
|
1134
|
-
var ret = false;
|
1135
|
-
$($.prop(elem, 'elements')).each(function(){
|
1136
|
-
ret = $(this).is(':invalid');
|
1137
|
-
if(ret){
|
1138
|
-
return false;
|
1139
|
-
}
|
1140
|
-
});
|
1141
|
-
return ret;
|
1142
|
-
};
|
1143
|
-
$.extend($.expr[":"], {
|
1144
|
-
"valid-element": function(elem){
|
1145
|
-
return $.nodeName(elem, 'form') ? !hasInvalid(elem) :!!($.prop(elem, 'willValidate') && isValid(elem));
|
1146
|
-
},
|
1147
|
-
"invalid-element": function(elem){
|
1148
|
-
return $.nodeName(elem, 'form') ? hasInvalid(elem) : !!($.prop(elem, 'willValidate') && !isValid(elem));
|
1149
|
-
},
|
1150
|
-
"required-element": function(elem){
|
1151
|
-
return !!($.prop(elem, 'willValidate') && $.prop(elem, 'required'));
|
1152
|
-
},
|
1153
|
-
"user-error": function(elem){
|
1154
|
-
return ($.prop(elem, 'willValidate') && $(elem).hasClass('user-error'));
|
1155
|
-
},
|
1156
|
-
"optional-element": function(elem){
|
1157
|
-
return !!($.prop(elem, 'willValidate') && $.prop(elem, 'required') === false);
|
1158
|
-
},
|
1159
|
-
"in-range": function(elem){
|
1160
|
-
if(!rangeTypes[$.prop(elem, 'type')] || !$.prop(elem, 'willValidate')){
|
1161
|
-
return false;
|
1162
|
-
}
|
1163
|
-
var val = $.prop(elem, 'validity');
|
1164
|
-
return !!(val && !val.rangeOverflow && !val.rangeUnderflow);
|
1165
|
-
},
|
1166
|
-
"out-of-range": function(elem){
|
1167
|
-
if(!rangeTypes[$.prop(elem, 'type')] || !$.prop(elem, 'willValidate')){
|
1168
|
-
return false;
|
1169
|
-
}
|
1170
|
-
var val = $.prop(elem, 'validity');
|
1171
|
-
return !!(val && (val.rangeOverflow || val.rangeUnderflow));
|
1172
|
-
}
|
1173
|
-
|
1174
|
-
});
|
1175
|
-
|
1176
|
-
['valid', 'invalid', 'required', 'optional'].forEach(function(name){
|
1177
|
-
$.expr[":"][name] = $.expr.filters[name+"-element"];
|
1178
|
-
});
|
1179
|
-
|
1180
|
-
|
1181
|
-
$.expr[":"].focus = function( elem ) {
|
1182
|
-
try {
|
1183
|
-
var doc = elem.ownerDocument;
|
1184
|
-
return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus());
|
1185
|
-
} catch(e){}
|
1186
|
-
return false;
|
1187
|
-
};
|
1188
|
-
|
1189
|
-
if(Modernizr.formvalidation && isWebkit && !webshims.bugs.bustedValidity){
|
1190
|
-
(function(){
|
1191
|
-
var retriggerRadioValidity = function(){
|
1192
|
-
var validity;
|
1193
|
-
if((validity = this.validity) && !validity.customError){
|
1194
|
-
this.setCustomValidity('');
|
1195
|
-
}
|
1196
|
-
};
|
1197
|
-
|
1198
|
-
webshims.addReady(function(context, insertedElement){
|
1199
|
-
if(context !== document){
|
1200
|
-
$('input[type="radio"]:invalid', context)
|
1201
|
-
.add(insertedElement.filter('input[type="radio"]:invalid'))
|
1202
|
-
.each(retriggerRadioValidity)
|
1203
|
-
;
|
1204
|
-
}
|
1205
|
-
});
|
1206
|
-
})();
|
1207
|
-
}
|
1208
|
-
|
1209
|
-
var customEvents = $.event.customEvent || {};
|
1210
|
-
var isValid = function(elem){
|
1211
|
-
return ($.prop(elem, 'validity') || {valid: 1}).valid;
|
1212
|
-
};
|
1213
|
-
|
1214
|
-
if (bugs.bustedValidity || bugs.findRequired) {
|
1215
|
-
(function(){
|
1216
|
-
var find = $.find;
|
1217
|
-
var matchesSelector = $.find.matchesSelector;
|
1218
|
-
|
1219
|
-
var regExp = /(\:valid|\:invalid|\:optional|\:required|\:in-range|\:out-of-range)(?=[\s\[\~\.\+\>\:\#*]|$)/ig;
|
1220
|
-
var regFn = function(sel){
|
1221
|
-
return sel + '-element';
|
1222
|
-
};
|
1223
|
-
|
1224
|
-
$.find = (function(){
|
1225
|
-
var slice = Array.prototype.slice;
|
1226
|
-
var fn = function(sel){
|
1227
|
-
var ar = arguments;
|
1228
|
-
ar = slice.call(ar, 1, ar.length);
|
1229
|
-
ar.unshift(sel.replace(regExp, regFn));
|
1230
|
-
return find.apply(this, ar);
|
1231
|
-
};
|
1232
|
-
for (var i in find) {
|
1233
|
-
if(find.hasOwnProperty(i)){
|
1234
|
-
fn[i] = find[i];
|
1235
|
-
}
|
1236
|
-
}
|
1237
|
-
return fn;
|
1238
|
-
})();
|
1239
|
-
if(!Modernizr.prefixed || Modernizr.prefixed("matchesSelector", document.documentElement)){
|
1240
|
-
$.find.matchesSelector = function(node, expr){
|
1241
|
-
expr = expr.replace(regExp, regFn);
|
1242
|
-
return matchesSelector.call(this, node, expr);
|
1243
|
-
};
|
1244
|
-
}
|
1245
|
-
|
1246
|
-
})();
|
1247
|
-
}
|
1248
|
-
|
1249
|
-
//ToDo needs testing
|
1250
|
-
var oldAttr = $.prop;
|
1251
|
-
var changeVals = {selectedIndex: 1, value: 1, checked: 1, disabled: 1, readonly: 1};
|
1252
|
-
$.prop = function(elem, name, val){
|
1253
|
-
var ret = oldAttr.apply(this, arguments);
|
1254
|
-
if(elem && 'form' in elem && changeVals[name] && val !== undefined && $(elem).hasClass(invalidClass)){
|
1255
|
-
if(isValid(elem)){
|
1256
|
-
$(elem).getShadowElement().removeClass(invalidClasses);
|
1257
|
-
if(name == 'checked' && val) {
|
1258
|
-
getGroupElements(elem).not(elem).removeClass(invalidClasses).removeAttr('aria-invalid');
|
1259
|
-
}
|
1260
|
-
}
|
1261
|
-
}
|
1262
|
-
return ret;
|
1263
|
-
};
|
1264
|
-
|
1265
|
-
var returnValidityCause = function(validity, elem){
|
1266
|
-
var ret;
|
1267
|
-
$.each(validity, function(name, value){
|
1268
|
-
if(value){
|
1269
|
-
ret = (name == 'customError') ? $.prop(elem, 'validationMessage') : name;
|
1270
|
-
return false;
|
1271
|
-
}
|
1272
|
-
});
|
1273
|
-
return ret;
|
1274
|
-
};
|
1275
|
-
|
1276
|
-
var isInGroup = function(name){
|
1277
|
-
var ret;
|
1278
|
-
try {
|
1279
|
-
ret = document.activeElement.name === name;
|
1280
|
-
} catch(e){}
|
1281
|
-
return ret;
|
1282
|
-
};
|
1283
|
-
/* form-ui-invalid/form-ui-valid are deprecated. use user-error/user-success instead */
|
1284
|
-
var invalidClass = 'user-error';
|
1285
|
-
var invalidClasses = 'user-error form-ui-invalid';
|
1286
|
-
var validClass = 'user-success';
|
1287
|
-
var validClasses = 'user-success form-ui-valid';
|
1288
|
-
var switchValidityClass = function(e){
|
1289
|
-
var elem, timer;
|
1290
|
-
if(!e.target){return;}
|
1291
|
-
elem = $(e.target).getNativeElement()[0];
|
1292
|
-
if(elem.type == 'submit' || !$.prop(elem, 'willValidate')){return;}
|
1293
|
-
timer = $.data(elem, 'webshimsswitchvalidityclass');
|
1294
|
-
var switchClass = function(){
|
1295
|
-
if(e.type == 'focusout' && elem.type == 'radio' && isInGroup(elem.name)){return;}
|
1296
|
-
var validity = $.prop(elem, 'validity');
|
1297
|
-
var shadowElem = $(elem).getShadowElement();
|
1298
|
-
var addClass, removeClass, trigger, generaltrigger, validityCause;
|
1299
|
-
|
1300
|
-
$(elem).trigger('refreshCustomValidityRules');
|
1301
|
-
if(validity.valid){
|
1302
|
-
if(!shadowElem.hasClass(validClass)){
|
1303
|
-
addClass = validClasses;
|
1304
|
-
removeClass = invalidClasses;
|
1305
|
-
generaltrigger = 'changedvaliditystate';
|
1306
|
-
trigger = 'changedvalid';
|
1307
|
-
if(checkTypes[elem.type] && elem.checked){
|
1308
|
-
getGroupElements(elem).not(elem).removeClass(removeClass).addClass(addClass).removeAttr('aria-invalid');
|
1309
|
-
}
|
1310
|
-
$.removeData(elem, 'webshimsinvalidcause');
|
1311
|
-
}
|
1312
|
-
} else {
|
1313
|
-
validityCause = returnValidityCause(validity, elem);
|
1314
|
-
if($.data(elem, 'webshimsinvalidcause') != validityCause){
|
1315
|
-
$.data(elem, 'webshimsinvalidcause', validityCause);
|
1316
|
-
generaltrigger = 'changedvaliditystate';
|
1317
|
-
}
|
1318
|
-
if(!shadowElem.hasClass(invalidClass)){
|
1319
|
-
addClass = invalidClasses;
|
1320
|
-
removeClass = validClasses;
|
1321
|
-
if (checkTypes[elem.type] && !elem.checked) {
|
1322
|
-
getGroupElements(elem).not(elem).removeClass(removeClass).addClass(addClass);
|
1323
|
-
}
|
1324
|
-
trigger = 'changedinvalid';
|
1325
|
-
}
|
1326
|
-
}
|
1327
|
-
if(addClass){
|
1328
|
-
shadowElem.addClass(addClass).removeClass(removeClass);
|
1329
|
-
//jQuery 1.6.1 IE9 bug (doubble trigger bug)
|
1330
|
-
setTimeout(function(){
|
1331
|
-
$(elem).trigger(trigger);
|
1332
|
-
}, 0);
|
1333
|
-
}
|
1334
|
-
if(generaltrigger){
|
1335
|
-
setTimeout(function(){
|
1336
|
-
$(elem).trigger(generaltrigger);
|
1337
|
-
}, 0);
|
1338
|
-
}
|
1339
|
-
$.removeData(e.target, 'webshimsswitchvalidityclass');
|
1340
|
-
};
|
1341
|
-
|
1342
|
-
if(timer){
|
1343
|
-
clearTimeout(timer);
|
1344
|
-
}
|
1345
|
-
if(e.type == 'refreshvalidityui'){
|
1346
|
-
switchClass();
|
1347
|
-
} else {
|
1348
|
-
$.data(elem, 'webshimsswitchvalidityclass', setTimeout(switchClass, 9));
|
1349
|
-
}
|
1350
|
-
};
|
1351
|
-
|
1352
|
-
$(document).on(options.validityUIEvents || 'focusout change refreshvalidityui', switchValidityClass);
|
1353
|
-
customEvents.changedvaliditystate = true;
|
1354
|
-
customEvents.refreshCustomValidityRules = true;
|
1355
|
-
customEvents.changedvalid = true;
|
1356
|
-
customEvents.changedinvalid = true;
|
1357
|
-
customEvents.refreshvalidityui = true;
|
1358
|
-
|
1359
|
-
|
1360
|
-
webshims.triggerInlineForm = function(elem, event){
|
1361
|
-
$(elem).trigger(event);
|
1362
|
-
};
|
1363
|
-
|
1364
|
-
webshims.modules["form-core"].getGroupElements = getGroupElements;
|
1365
|
-
|
1366
|
-
|
1367
|
-
var setRoot = function(){
|
1368
|
-
webshims.scrollRoot = (isWebkit || document.compatMode == 'BackCompat') ?
|
1369
|
-
$(document.body) :
|
1370
|
-
$(document.documentElement)
|
1371
|
-
;
|
1372
|
-
};
|
1373
|
-
setRoot();
|
1374
|
-
webshims.ready('DOM', setRoot);
|
1375
|
-
|
1376
|
-
webshims.getRelOffset = function(posElem, relElem){
|
1377
|
-
posElem = $(posElem);
|
1378
|
-
var offset = $(relElem).offset();
|
1379
|
-
var bodyOffset;
|
1380
|
-
$.swap($(posElem)[0], {visibility: 'hidden', display: 'inline-block', left: 0, top: 0}, function(){
|
1381
|
-
bodyOffset = posElem.offset();
|
1382
|
-
});
|
1383
|
-
offset.top -= bodyOffset.top;
|
1384
|
-
offset.left -= bodyOffset.left;
|
1385
|
-
return offset;
|
1386
|
-
};
|
1387
|
-
|
1388
|
-
/* some extra validation UI */
|
1389
|
-
webshims.validityAlert = (function(){
|
1390
|
-
var alertElem = 'span';
|
1391
|
-
var errorBubble;
|
1392
|
-
var hideTimer = false;
|
1393
|
-
var focusTimer = false;
|
1394
|
-
var resizeTimer = false;
|
1395
|
-
var boundHide;
|
1396
|
-
|
1397
|
-
var api = {
|
1398
|
-
hideDelay: 5000,
|
1399
|
-
|
1400
|
-
showFor: function(elem, message, noFocusElem, noBubble){
|
1401
|
-
api._create();
|
1402
|
-
elem = $(elem);
|
1403
|
-
var visual = $(elem).getShadowElement();
|
1404
|
-
var offset = api.getOffsetFromBody(visual);
|
1405
|
-
api.clear();
|
1406
|
-
if(noBubble){
|
1407
|
-
this.hide();
|
1408
|
-
} else {
|
1409
|
-
|
1410
|
-
this.getMessage(elem, message);
|
1411
|
-
this.position(visual, offset);
|
1412
|
-
|
1413
|
-
this.show();
|
1414
|
-
if(this.hideDelay){
|
1415
|
-
hideTimer = setTimeout(boundHide, this.hideDelay);
|
1416
|
-
}
|
1417
|
-
$(window)
|
1418
|
-
.on('resize.validityalert reposoverlay.validityalert', function(){
|
1419
|
-
clearTimeout(resizeTimer);
|
1420
|
-
resizeTimer = setTimeout(function(){
|
1421
|
-
api.position(visual);
|
1422
|
-
}, 9);
|
1423
|
-
})
|
1424
|
-
;
|
1425
|
-
}
|
1426
|
-
|
1427
|
-
if(!noFocusElem){
|
1428
|
-
this.setFocus(visual, offset);
|
1429
|
-
}
|
1430
|
-
},
|
1431
|
-
getOffsetFromBody: function(elem){
|
1432
|
-
return webshims.getRelOffset(errorBubble, elem);
|
1433
|
-
},
|
1434
|
-
setFocus: function(visual, offset){
|
1435
|
-
var focusElem = $(visual).getShadowFocusElement();
|
1436
|
-
var scrollTop = webshims.scrollRoot.scrollTop();
|
1437
|
-
var elemTop = ((offset || focusElem.offset()).top) - 30;
|
1438
|
-
var smooth;
|
1439
|
-
|
1440
|
-
if(webshims.getID && alertElem == 'label'){
|
1441
|
-
errorBubble.attr('for', webshims.getID(focusElem));
|
1442
|
-
}
|
1443
|
-
|
1444
|
-
if(scrollTop > elemTop){
|
1445
|
-
webshims.scrollRoot.animate(
|
1446
|
-
{scrollTop: elemTop - 5},
|
1447
|
-
{
|
1448
|
-
queue: false,
|
1449
|
-
duration: Math.max( Math.min( 600, (scrollTop - elemTop) * 1.5 ), 80 )
|
1450
|
-
}
|
1451
|
-
);
|
1452
|
-
smooth = true;
|
1453
|
-
}
|
1454
|
-
try {
|
1455
|
-
focusElem[0].focus();
|
1456
|
-
} catch(e){}
|
1457
|
-
if(smooth){
|
1458
|
-
webshims.scrollRoot.scrollTop(scrollTop);
|
1459
|
-
setTimeout(function(){
|
1460
|
-
webshims.scrollRoot.scrollTop(scrollTop);
|
1461
|
-
}, 0);
|
1462
|
-
}
|
1463
|
-
setTimeout(function(){
|
1464
|
-
$(document).on('focusout.validityalert', boundHide);
|
1465
|
-
}, 10);
|
1466
|
-
$(window).triggerHandler('reposoverlay');
|
1467
|
-
},
|
1468
|
-
getMessage: function(elem, message){
|
1469
|
-
if (!message) {
|
1470
|
-
message = getContentValidationMessage(elem[0]) || elem.prop('customValidationMessage') || elem.prop('validationMessage');
|
1471
|
-
}
|
1472
|
-
if (message) {
|
1473
|
-
$('span.va-box', errorBubble).text(message);
|
1474
|
-
}
|
1475
|
-
else {
|
1476
|
-
this.hide();
|
1477
|
-
}
|
1478
|
-
},
|
1479
|
-
position: function(elem, offset){
|
1480
|
-
offset = offset ? $.extend({}, offset) : api.getOffsetFromBody(elem);
|
1481
|
-
offset.top += elem.outerHeight();
|
1482
|
-
errorBubble.css(offset);
|
1483
|
-
},
|
1484
|
-
show: function(){
|
1485
|
-
if(errorBubble.css('display') === 'none'){
|
1486
|
-
errorBubble.css({opacity: 0}).show();
|
1487
|
-
}
|
1488
|
-
errorBubble.addClass('va-visible').fadeTo(400, 1);
|
1489
|
-
},
|
1490
|
-
hide: function(){
|
1491
|
-
errorBubble.removeClass('va-visible').fadeOut();
|
1492
|
-
},
|
1493
|
-
clear: function(){
|
1494
|
-
clearTimeout(focusTimer);
|
1495
|
-
clearTimeout(hideTimer);
|
1496
|
-
$(document).unbind('.validityalert');
|
1497
|
-
$(window).unbind('.validityalert');
|
1498
|
-
errorBubble.stop().removeAttr('for');
|
1499
|
-
},
|
1500
|
-
_create: function(){
|
1501
|
-
if(errorBubble){return;}
|
1502
|
-
errorBubble = api.errorBubble = $('<'+alertElem+' class="validity-alert-wrapper" role="alert"><span class="validity-alert"><span class="va-arrow"><span class="va-arrow-box"></span></span><span class="va-box"></span></span></'+alertElem+'>').css({position: 'absolute', display: 'none'});
|
1503
|
-
webshims.ready('DOM', function(){
|
1504
|
-
errorBubble.appendTo('body');
|
1505
|
-
if($.fn.bgIframe){
|
1506
|
-
errorBubble.bgIframe();
|
1507
|
-
}
|
1508
|
-
});
|
1509
|
-
}
|
1510
|
-
};
|
1511
|
-
|
1512
|
-
|
1513
|
-
boundHide = $.proxy(api, 'hide');
|
1514
|
-
|
1515
|
-
return api;
|
1516
|
-
})();
|
1517
|
-
|
1518
|
-
|
1519
|
-
/* extension, but also used to fix native implementation workaround/bugfixes */
|
1520
|
-
(function(){
|
1521
|
-
var firstEvent,
|
1522
|
-
invalids = [],
|
1523
|
-
stopSubmitTimer,
|
1524
|
-
form
|
1525
|
-
;
|
1526
|
-
|
1527
|
-
$(document).on('invalid', function(e){
|
1528
|
-
if(e.wrongWebkitInvalid){return;}
|
1529
|
-
var jElm = $(e.target);
|
1530
|
-
var shadowElem = jElm.getShadowElement();
|
1531
|
-
if(!shadowElem.hasClass(invalidClass)){
|
1532
|
-
shadowElem.addClass(invalidClasses).removeClass(validClasses);
|
1533
|
-
setTimeout(function(){
|
1534
|
-
$(e.target).trigger('changedinvalid').trigger('changedvaliditystate');
|
1535
|
-
}, 0);
|
1536
|
-
}
|
1537
|
-
|
1538
|
-
if(!firstEvent){
|
1539
|
-
//trigger firstinvalid
|
1540
|
-
firstEvent = $.Event('firstinvalid');
|
1541
|
-
firstEvent.isInvalidUIPrevented = e.isDefaultPrevented;
|
1542
|
-
var firstSystemInvalid = $.Event('firstinvalidsystem');
|
1543
|
-
$(document).triggerHandler(firstSystemInvalid, {element: e.target, form: e.target.form, isInvalidUIPrevented: e.isDefaultPrevented});
|
1544
|
-
jElm.trigger(firstEvent);
|
1545
|
-
}
|
1546
|
-
|
1547
|
-
//if firstinvalid was prevented all invalids will be also prevented
|
1548
|
-
if( firstEvent && firstEvent.isDefaultPrevented() ){
|
1549
|
-
e.preventDefault();
|
1550
|
-
}
|
1551
|
-
invalids.push(e.target);
|
1552
|
-
e.extraData = 'fix';
|
1553
|
-
clearTimeout(stopSubmitTimer);
|
1554
|
-
stopSubmitTimer = setTimeout(function(){
|
1555
|
-
var lastEvent = {type: 'lastinvalid', cancelable: false, invalidlist: $(invalids)};
|
1556
|
-
//reset firstinvalid
|
1557
|
-
firstEvent = false;
|
1558
|
-
invalids = [];
|
1559
|
-
$(e.target).trigger(lastEvent, lastEvent);
|
1560
|
-
}, 9);
|
1561
|
-
jElm = null;
|
1562
|
-
shadowElem = null;
|
1563
|
-
});
|
1564
|
-
})();
|
1565
|
-
|
1566
|
-
$.fn.getErrorMessage = function(){
|
1567
|
-
var message = '';
|
1568
|
-
var elem = this[0];
|
1569
|
-
if(elem){
|
1570
|
-
message = getContentValidationMessage(elem) || $.prop(elem, 'customValidationMessage') || $.prop(elem, 'validationMessage');
|
1571
|
-
}
|
1572
|
-
return message;
|
1573
|
-
};
|
1574
|
-
|
1575
|
-
if(options.replaceValidationUI){
|
1576
|
-
webshims.ready('DOM forms', function(){
|
1577
|
-
$(document).on('firstinvalid', function(e){
|
1578
|
-
if(!e.isInvalidUIPrevented()){
|
1579
|
-
e.preventDefault();
|
1580
|
-
$.webshims.validityAlert.showFor( e.target );
|
1581
|
-
}
|
1582
|
-
});
|
1583
|
-
});
|
1584
|
-
}
|
1585
|
-
});
|
1586
|
-
|
1587
|
-
})(jQuery);
|
1588
|
-
jQuery.webshims.register('form-datalist', function($, webshims, window, document, undefined){
|
1589
|
-
"use strict";
|
1590
|
-
var doc = document;
|
1591
|
-
|
1592
|
-
/*
|
1593
|
-
* implement propType "element" currently only used for list-attribute (will be moved to dom-extend, if needed)
|
1594
|
-
*/
|
1595
|
-
webshims.propTypes.element = function(descs){
|
1596
|
-
webshims.createPropDefault(descs, 'attr');
|
1597
|
-
if(descs.prop){return;}
|
1598
|
-
descs.prop = {
|
1599
|
-
get: function(){
|
1600
|
-
var elem = descs.attr.get.call(this);
|
1601
|
-
if(elem){
|
1602
|
-
elem = document.getElementById(elem);
|
1603
|
-
if(elem && descs.propNodeName && !$.nodeName(elem, descs.propNodeName)){
|
1604
|
-
elem = null;
|
1605
|
-
}
|
1606
|
-
}
|
1607
|
-
return elem || null;
|
1608
|
-
},
|
1609
|
-
writeable: false
|
1610
|
-
};
|
1611
|
-
};
|
1612
|
-
|
1613
|
-
|
1614
|
-
/*
|
1615
|
-
* Implements datalist element and list attribute
|
1616
|
-
*/
|
1617
|
-
|
1618
|
-
(function(){
|
1619
|
-
var formsCFG = $.webshims.cfg.forms;
|
1620
|
-
var listSupport = Modernizr.input.list;
|
1621
|
-
if(listSupport && !formsCFG.customDatalist){return;}
|
1622
|
-
|
1623
|
-
var initializeDatalist = function(){
|
1624
|
-
|
1625
|
-
|
1626
|
-
if(!listSupport){
|
1627
|
-
webshims.defineNodeNameProperty('datalist', 'options', {
|
1628
|
-
prop: {
|
1629
|
-
writeable: false,
|
1630
|
-
get: function(){
|
1631
|
-
var elem = this;
|
1632
|
-
var select = $('select', elem);
|
1633
|
-
var options;
|
1634
|
-
if(select[0]){
|
1635
|
-
options = select[0].options;
|
1636
|
-
} else {
|
1637
|
-
options = $('option', elem).get();
|
1638
|
-
if(options.length){
|
1639
|
-
webshims.warn('you should wrap your option-elements for a datalist in a select element to support IE and other old browsers.');
|
1640
|
-
}
|
1641
|
-
}
|
1642
|
-
return options;
|
1643
|
-
}
|
1644
|
-
}
|
1645
|
-
});
|
1646
|
-
}
|
1647
|
-
|
1648
|
-
var inputListProto = {
|
1649
|
-
//override autocomplete
|
1650
|
-
autocomplete: {
|
1651
|
-
attr: {
|
1652
|
-
get: function(){
|
1653
|
-
var elem = this;
|
1654
|
-
var data = $.data(elem, 'datalistWidget');
|
1655
|
-
if(data){
|
1656
|
-
return data._autocomplete;
|
1657
|
-
}
|
1658
|
-
return ('autocomplete' in elem) ? elem.autocomplete : elem.getAttribute('autocomplete');
|
1659
|
-
},
|
1660
|
-
set: function(value){
|
1661
|
-
var elem = this;
|
1662
|
-
var data = $.data(elem, 'datalistWidget');
|
1663
|
-
if(data){
|
1664
|
-
data._autocomplete = value;
|
1665
|
-
if(value == 'off'){
|
1666
|
-
data.hideList();
|
1667
|
-
}
|
1668
|
-
} else {
|
1669
|
-
if('autocomplete' in elem){
|
1670
|
-
elem.autocomplete = value;
|
1671
|
-
} else {
|
1672
|
-
elem.setAttribute('autocomplete', value);
|
1673
|
-
}
|
1674
|
-
}
|
1675
|
-
}
|
1676
|
-
}
|
1677
|
-
}
|
1678
|
-
};
|
1679
|
-
|
1680
|
-
// if(formsCFG.customDatalist && (!listSupport || !('selectedOption') in $('<input />')[0])){
|
1681
|
-
// //currently not supported x-browser (FF4 has not implemented and is not polyfilled )
|
1682
|
-
// inputListProto.selectedOption = {
|
1683
|
-
// prop: {
|
1684
|
-
// writeable: false,
|
1685
|
-
// get: function(){
|
1686
|
-
// var elem = this;
|
1687
|
-
// var list = $.prop(elem, 'list');
|
1688
|
-
// var ret = null;
|
1689
|
-
// var value, options;
|
1690
|
-
// if(!list){return ret;}
|
1691
|
-
// value = $.prop(elem, 'value');
|
1692
|
-
// if(!value){return ret;}
|
1693
|
-
// options = $.prop(list, 'options');
|
1694
|
-
// if(!options.length){return ret;}
|
1695
|
-
// $.each(options, function(i, option){
|
1696
|
-
// if(value == $.prop(option, 'value')){
|
1697
|
-
// ret = option;
|
1698
|
-
// return false;
|
1699
|
-
// }
|
1700
|
-
// });
|
1701
|
-
// return ret;
|
1702
|
-
// }
|
1703
|
-
// }
|
1704
|
-
// };
|
1705
|
-
// }
|
1706
|
-
|
1707
|
-
if(!listSupport){
|
1708
|
-
inputListProto['list'] = {
|
1709
|
-
attr: {
|
1710
|
-
get: function(){
|
1711
|
-
var val = webshims.contentAttr(this, 'list');
|
1712
|
-
return (val == null) ? undefined : val;
|
1713
|
-
},
|
1714
|
-
set: function(value){
|
1715
|
-
var elem = this;
|
1716
|
-
webshims.contentAttr(elem, 'list', value);
|
1717
|
-
webshims.objectCreate(shadowListProto, undefined, {input: elem, id: value, datalist: $.prop(elem, 'list')});
|
1718
|
-
}
|
1719
|
-
},
|
1720
|
-
initAttr: true,
|
1721
|
-
reflect: true,
|
1722
|
-
propType: 'element',
|
1723
|
-
propNodeName: 'datalist'
|
1724
|
-
};
|
1725
|
-
} else {
|
1726
|
-
//options only return options, if option-elements are rooted: but this makes this part of HTML5 less backwards compatible
|
1727
|
-
if(!($('<datalist><select><option></option></select></datalist>').prop('options') || []).length ){
|
1728
|
-
webshims.defineNodeNameProperty('datalist', 'options', {
|
1729
|
-
prop: {
|
1730
|
-
writeable: false,
|
1731
|
-
get: function(){
|
1732
|
-
var options = this.options || [];
|
1733
|
-
if(!options.length){
|
1734
|
-
var elem = this;
|
1735
|
-
var select = $('select', elem);
|
1736
|
-
if(select[0] && select[0].options && select[0].options.length){
|
1737
|
-
options = select[0].options;
|
1738
|
-
}
|
1739
|
-
}
|
1740
|
-
return options;
|
1741
|
-
}
|
1742
|
-
}
|
1743
|
-
});
|
1744
|
-
}
|
1745
|
-
inputListProto['list'] = {
|
1746
|
-
attr: {
|
1747
|
-
get: function(){
|
1748
|
-
var val = webshims.contentAttr(this, 'list');
|
1749
|
-
if(val != null){
|
1750
|
-
this.removeAttribute('list');
|
1751
|
-
} else {
|
1752
|
-
val = $.data(this, 'datalistListAttr');
|
1753
|
-
}
|
1754
|
-
|
1755
|
-
return (val == null) ? undefined : val;
|
1756
|
-
},
|
1757
|
-
set: function(value){
|
1758
|
-
var elem = this;
|
1759
|
-
$.data(elem, 'datalistListAttr', value);
|
1760
|
-
webshims.objectCreate(shadowListProto, undefined, {input: elem, id: value, datalist: $.prop(elem, 'list')});
|
1761
|
-
}
|
1762
|
-
},
|
1763
|
-
initAttr: true,
|
1764
|
-
reflect: true,
|
1765
|
-
propType: 'element',
|
1766
|
-
propNodeName: 'datalist'
|
1767
|
-
};
|
1768
|
-
}
|
1769
|
-
|
1770
|
-
|
1771
|
-
webshims.defineNodeNameProperties('input', inputListProto);
|
1772
|
-
|
1773
|
-
if($.event.customEvent){
|
1774
|
-
$.event.customEvent.updateDatalist = true;
|
1775
|
-
$.event.customEvent.updateInput = true;
|
1776
|
-
$.event.customEvent.datalistselect = true;
|
1777
|
-
}
|
1778
|
-
webshims.addReady(function(context, contextElem){
|
1779
|
-
contextElem
|
1780
|
-
.filter('datalist > select, datalist, datalist > option, datalist > select > option')
|
1781
|
-
.closest('datalist')
|
1782
|
-
.triggerHandler('updateDatalist')
|
1783
|
-
;
|
1784
|
-
|
1785
|
-
});
|
1786
|
-
|
1787
|
-
|
1788
|
-
};
|
1789
|
-
|
1790
|
-
|
1791
|
-
/*
|
1792
|
-
* ShadowList
|
1793
|
-
*/
|
1794
|
-
var listidIndex = 0;
|
1795
|
-
|
1796
|
-
var noDatalistSupport = {
|
1797
|
-
submit: 1,
|
1798
|
-
button: 1,
|
1799
|
-
reset: 1,
|
1800
|
-
hidden: 1,
|
1801
|
-
|
1802
|
-
//ToDo
|
1803
|
-
range: 1,
|
1804
|
-
date: 1
|
1805
|
-
};
|
1806
|
-
var globStoredOptions = {};
|
1807
|
-
var getStoredOptions = function(name){
|
1808
|
-
if(!name){return [];}
|
1809
|
-
if(globStoredOptions[name]){
|
1810
|
-
return globStoredOptions[name];
|
1811
|
-
}
|
1812
|
-
var data;
|
1813
|
-
try {
|
1814
|
-
data = JSON.parse(localStorage.getItem('storedDatalistOptions'+name));
|
1815
|
-
} catch(e){}
|
1816
|
-
globStoredOptions[name] = data || [];
|
1817
|
-
return data || [];
|
1818
|
-
};
|
1819
|
-
var storeOptions = function(name, val){
|
1820
|
-
if(!name){return;}
|
1821
|
-
val = val || [];
|
1822
|
-
try {
|
1823
|
-
localStorage.setItem( 'storedDatalistOptions'+name, JSON.stringify(val) );
|
1824
|
-
} catch(e){}
|
1825
|
-
};
|
1826
|
-
|
1827
|
-
var getText = function(elem){
|
1828
|
-
return (elem.textContent || elem.innerText || $.text([ elem ]) || '');
|
1829
|
-
};
|
1830
|
-
|
1831
|
-
var shadowListProto = {
|
1832
|
-
_create: function(opts){
|
1833
|
-
|
1834
|
-
if(noDatalistSupport[$.prop(opts.input, 'type')]){return;}
|
1835
|
-
var datalist = opts.datalist;
|
1836
|
-
var data = $.data(opts.input, 'datalistWidget');
|
1837
|
-
if(datalist && data && data.datalist !== datalist){
|
1838
|
-
data.datalist = datalist;
|
1839
|
-
data.id = opts.id;
|
1840
|
-
|
1841
|
-
data.shadowList.prop('className', 'datalist-polyfill '+ (data.datalist.className || '') + ' '+ data.datalist.id +'-shadowdom');
|
1842
|
-
if(formsCFG.positionDatalist){
|
1843
|
-
data.shadowList.insertAfter(opts.input);
|
1844
|
-
} else {
|
1845
|
-
data.shadowList.appendTo('body');
|
1846
|
-
}
|
1847
|
-
$(data.datalist)
|
1848
|
-
.off('updateDatalist.datalistWidget')
|
1849
|
-
.on('updateDatalist.datalistWidget', $.proxy(data, '_resetListCached'))
|
1850
|
-
;
|
1851
|
-
data._resetListCached();
|
1852
|
-
return;
|
1853
|
-
} else if(!datalist){
|
1854
|
-
if(data){
|
1855
|
-
data.destroy();
|
1856
|
-
}
|
1857
|
-
return;
|
1858
|
-
} else if(data && data.datalist === datalist){
|
1859
|
-
return;
|
1860
|
-
}
|
1861
|
-
listidIndex++;
|
1862
|
-
var that = this;
|
1863
|
-
this.hideList = $.proxy(that, 'hideList');
|
1864
|
-
this.timedHide = function(){
|
1865
|
-
clearTimeout(that.hideTimer);
|
1866
|
-
that.hideTimer = setTimeout(that.hideList, 9);
|
1867
|
-
};
|
1868
|
-
this.datalist = datalist;
|
1869
|
-
this.id = opts.id;
|
1870
|
-
this.hasViewableData = true;
|
1871
|
-
this._autocomplete = $.attr(opts.input, 'autocomplete');
|
1872
|
-
$.data(opts.input, 'datalistWidget', this);
|
1873
|
-
this.shadowList = $('<div class="datalist-polyfill '+ (this.datalist.className || '') + ' '+ this.datalist.id +'-shadowdom' +'" />');
|
1874
|
-
|
1875
|
-
if(formsCFG.positionDatalist || $(opts.input).hasClass('position-datalist')){
|
1876
|
-
this.shadowList.insertAfter(opts.input);
|
1877
|
-
} else {
|
1878
|
-
this.shadowList.appendTo('body');
|
1879
|
-
}
|
1880
|
-
|
1881
|
-
this.index = -1;
|
1882
|
-
this.input = opts.input;
|
1883
|
-
this.arrayOptions = [];
|
1884
|
-
|
1885
|
-
this.shadowList
|
1886
|
-
.delegate('li', 'mouseenter.datalistWidget mousedown.datalistWidget click.datalistWidget', function(e){
|
1887
|
-
var items = $('li:not(.hidden-item)', that.shadowList);
|
1888
|
-
var select = (e.type == 'mousedown' || e.type == 'click');
|
1889
|
-
that.markItem(items.index(e.currentTarget), select, items);
|
1890
|
-
if(e.type == 'click'){
|
1891
|
-
that.hideList();
|
1892
|
-
if(formsCFG.customDatalist){
|
1893
|
-
$(opts.input).trigger('datalistselect');
|
1894
|
-
}
|
1895
|
-
}
|
1896
|
-
return (e.type != 'mousedown');
|
1897
|
-
})
|
1898
|
-
.on('focusout', this.timedHide)
|
1899
|
-
;
|
1900
|
-
|
1901
|
-
opts.input.setAttribute('autocomplete', 'off');
|
1902
|
-
|
1903
|
-
$(opts.input)
|
1904
|
-
.attr({
|
1905
|
-
//role: 'combobox',
|
1906
|
-
'aria-haspopup': 'true'
|
1907
|
-
})
|
1908
|
-
.on({
|
1909
|
-
'input.datalistWidget': function(){
|
1910
|
-
if(!that.triggeredByDatalist){
|
1911
|
-
that.changedValue = false;
|
1912
|
-
that.showHideOptions();
|
1913
|
-
}
|
1914
|
-
},
|
1915
|
-
'keydown.datalistWidget': function(e){
|
1916
|
-
var keyCode = e.keyCode;
|
1917
|
-
var activeItem;
|
1918
|
-
var items;
|
1919
|
-
if(keyCode == 40 && !that.showList()){
|
1920
|
-
that.markItem(that.index + 1, true);
|
1921
|
-
return false;
|
1922
|
-
}
|
1923
|
-
|
1924
|
-
if(!that.isListVisible){return;}
|
1925
|
-
|
1926
|
-
|
1927
|
-
if(keyCode == 38){
|
1928
|
-
that.markItem(that.index - 1, true);
|
1929
|
-
return false;
|
1930
|
-
}
|
1931
|
-
if(!e.shiftKey && (keyCode == 33 || keyCode == 36)){
|
1932
|
-
that.markItem(0, true);
|
1933
|
-
return false;
|
1934
|
-
}
|
1935
|
-
if(!e.shiftKey && (keyCode == 34 || keyCode == 35)){
|
1936
|
-
items = $('li:not(.hidden-item)', that.shadowList);
|
1937
|
-
that.markItem(items.length - 1, true, items);
|
1938
|
-
return false;
|
1939
|
-
}
|
1940
|
-
if(keyCode == 13 || keyCode == 27){
|
1941
|
-
if (keyCode == 13){
|
1942
|
-
activeItem = $('li.active-item:not(.hidden-item)', that.shadowList);
|
1943
|
-
that.changeValue( $('li.active-item:not(.hidden-item)', that.shadowList) );
|
1944
|
-
}
|
1945
|
-
that.hideList();
|
1946
|
-
if(formsCFG.customDatalist && activeItem && activeItem[0]){
|
1947
|
-
$(opts.input).trigger('datalistselect');
|
1948
|
-
}
|
1949
|
-
return false;
|
1950
|
-
}
|
1951
|
-
},
|
1952
|
-
'focus.datalistWidget': function(){
|
1953
|
-
if($(this).hasClass('list-focus')){
|
1954
|
-
that.showList();
|
1955
|
-
}
|
1956
|
-
},
|
1957
|
-
'mousedown.datalistWidget': function(){
|
1958
|
-
if($(this).is(':focus')){
|
1959
|
-
that.showList();
|
1960
|
-
}
|
1961
|
-
},
|
1962
|
-
'blur.datalistWidget': this.timedHide
|
1963
|
-
})
|
1964
|
-
;
|
1965
|
-
|
1966
|
-
|
1967
|
-
$(this.datalist)
|
1968
|
-
.off('updateDatalist.datalistWidget')
|
1969
|
-
.on('updateDatalist.datalistWidget', $.proxy(this, '_resetListCached'))
|
1970
|
-
;
|
1971
|
-
|
1972
|
-
this._resetListCached();
|
1973
|
-
|
1974
|
-
if(opts.input.form && (opts.input.name || opts.input.id)){
|
1975
|
-
$(opts.input.form).on('submit.datalistWidget'+opts.input.id, function(){
|
1976
|
-
if(!$(opts.input).hasClass('no-datalist-cache') && that._autocomplete != 'off'){
|
1977
|
-
var val = $.prop(opts.input, 'value');
|
1978
|
-
var name = (opts.input.name || opts.input.id) + $.prop(opts.input, 'type');
|
1979
|
-
if(!that.storedOptions){
|
1980
|
-
that.storedOptions = getStoredOptions( name );
|
1981
|
-
}
|
1982
|
-
if(val && that.storedOptions.indexOf(val) == -1){
|
1983
|
-
that.storedOptions.push(val);
|
1984
|
-
storeOptions(name, that.storedOptions );
|
1985
|
-
}
|
1986
|
-
}
|
1987
|
-
});
|
1988
|
-
}
|
1989
|
-
$(window).on('unload.datalist'+this.id+' beforeunload.datalist'+this.id, function(){
|
1990
|
-
that.destroy();
|
1991
|
-
});
|
1992
|
-
},
|
1993
|
-
destroy: function(){
|
1994
|
-
var autocomplete = $.attr(this.input, 'autocomplete');
|
1995
|
-
$(this.input)
|
1996
|
-
.off('.datalistWidget')
|
1997
|
-
.removeData('datalistWidget')
|
1998
|
-
;
|
1999
|
-
this.shadowList.remove();
|
2000
|
-
$(document).off('.datalist'+this.id);
|
2001
|
-
$(window).off('.datalist'+this.id);
|
2002
|
-
if(this.input.form && this.input.id){
|
2003
|
-
$(this.input.form).off('submit.datalistWidget'+this.input.id);
|
2004
|
-
}
|
2005
|
-
this.input.removeAttribute('aria-haspopup');
|
2006
|
-
if(autocomplete === undefined){
|
2007
|
-
this.input.removeAttribute('autocomplete');
|
2008
|
-
} else {
|
2009
|
-
$(this.input).attr('autocomplete', autocomplete);
|
2010
|
-
}
|
2011
|
-
},
|
2012
|
-
_resetListCached: function(e){
|
2013
|
-
var that = this;
|
2014
|
-
var forceShow;
|
2015
|
-
this.needsUpdate = true;
|
2016
|
-
this.lastUpdatedValue = false;
|
2017
|
-
this.lastUnfoundValue = '';
|
2018
|
-
|
2019
|
-
if(!this.updateTimer){
|
2020
|
-
if(window.QUnit || (forceShow = (e && document.activeElement == that.input))){
|
2021
|
-
that.updateListOptions(forceShow);
|
2022
|
-
} else {
|
2023
|
-
webshims.ready('WINDOWLOAD', function(){
|
2024
|
-
that.updateTimer = setTimeout(function(){
|
2025
|
-
that.updateListOptions();
|
2026
|
-
that = null;
|
2027
|
-
listidIndex = 1;
|
2028
|
-
}, 200 + (100 * listidIndex));
|
2029
|
-
});
|
2030
|
-
}
|
2031
|
-
}
|
2032
|
-
},
|
2033
|
-
maskHTML: function(str){
|
2034
|
-
return str.replace(/</g, '<').replace(/>/g, '>');
|
2035
|
-
},
|
2036
|
-
updateListOptions: function(_forceShow){
|
2037
|
-
this.needsUpdate = false;
|
2038
|
-
clearTimeout(this.updateTimer);
|
2039
|
-
this.updateTimer = false;
|
2040
|
-
this.shadowList
|
2041
|
-
.css({
|
2042
|
-
fontSize: $.css(this.input, 'fontSize'),
|
2043
|
-
fontFamily: $.css(this.input, 'fontFamily')
|
2044
|
-
})
|
2045
|
-
;
|
2046
|
-
this.searchStart = formsCFG.customDatalist && $(this.input).hasClass('search-start');
|
2047
|
-
|
2048
|
-
var list = [];
|
2049
|
-
|
2050
|
-
var values = [];
|
2051
|
-
var allOptions = [];
|
2052
|
-
var rElem, rItem, rOptions, rI, rLen, item;
|
2053
|
-
for(rOptions = $.prop(this.datalist, 'options'), rI = 0, rLen = rOptions.length; rI < rLen; rI++){
|
2054
|
-
rElem = rOptions[rI];
|
2055
|
-
if(rElem.disabled){return;}
|
2056
|
-
rItem = {
|
2057
|
-
value: $(rElem).val() || '',
|
2058
|
-
text: $.trim($.attr(rElem, 'label') || getText(rElem)),
|
2059
|
-
className: rElem.className || '',
|
2060
|
-
style: $.attr(rElem, 'style') || ''
|
2061
|
-
};
|
2062
|
-
if(!rItem.text){
|
2063
|
-
rItem.text = rItem.value;
|
2064
|
-
} else if(rItem.text != rItem.value){
|
2065
|
-
rItem.className += ' different-label-value';
|
2066
|
-
}
|
2067
|
-
values[rI] = rItem.value;
|
2068
|
-
allOptions[rI] = rItem;
|
2069
|
-
}
|
2070
|
-
|
2071
|
-
if(!this.storedOptions){
|
2072
|
-
this.storedOptions = ($(this.input).hasClass('no-datalist-cache') || this._autocomplete == 'off') ? [] : getStoredOptions((this.input.name || this.input.id) + $.prop(this.input, 'type'));
|
2073
|
-
}
|
2074
|
-
|
2075
|
-
this.storedOptions.forEach(function(val, i){
|
2076
|
-
if(values.indexOf(val) == -1){
|
2077
|
-
allOptions.push({value: val, text: val, className: 'stored-suggest', style: ''});
|
2078
|
-
}
|
2079
|
-
});
|
2080
|
-
|
2081
|
-
for(rI = 0, rLen = allOptions.length; rI < rLen; rI++){
|
2082
|
-
item = allOptions[rI];
|
2083
|
-
list[rI] = '<li class="'+ item.className +'" style="'+ item.style +'" tabindex="-1" role="listitem"><span class="option-label">'+ this.maskHTML(item.text) +'</span> <span class="option-value">'+ this.maskHTML(item.value) +'</span></li>';
|
2084
|
-
}
|
2085
|
-
|
2086
|
-
this.arrayOptions = allOptions;
|
2087
|
-
this.shadowList.html('<div class="datalist-outer-box"><div class="datalist-box"><ul role="list">'+ list.join("\n") +'</ul></div></div>');
|
2088
|
-
|
2089
|
-
if($.fn.bgIframe){
|
2090
|
-
this.shadowList.bgIframe();
|
2091
|
-
}
|
2092
|
-
|
2093
|
-
if(_forceShow || this.isListVisible){
|
2094
|
-
this.showHideOptions();
|
2095
|
-
}
|
2096
|
-
},
|
2097
|
-
showHideOptions: function(_fromShowList){
|
2098
|
-
var value = $.prop(this.input, 'value').toLowerCase();
|
2099
|
-
//first check prevent infinite loop, second creates simple lazy optimization
|
2100
|
-
if(value === this.lastUpdatedValue || (this.lastUnfoundValue && value.indexOf(this.lastUnfoundValue) === 0)){
|
2101
|
-
return;
|
2102
|
-
}
|
2103
|
-
|
2104
|
-
this.lastUpdatedValue = value;
|
2105
|
-
var found = false;
|
2106
|
-
var startSearch = this.searchStart;
|
2107
|
-
var lis = $('li', this.shadowList);
|
2108
|
-
if(value){
|
2109
|
-
this.arrayOptions.forEach(function(item, i){
|
2110
|
-
var search;
|
2111
|
-
if(!('lowerText' in item)){
|
2112
|
-
if(item.text != item.value){
|
2113
|
-
item.lowerText = item.value.toLowerCase() + item.text.toLowerCase();
|
2114
|
-
} else {
|
2115
|
-
item.lowerText = item.text.toLowerCase();
|
2116
|
-
}
|
2117
|
-
}
|
2118
|
-
search = item.lowerText.indexOf(value);
|
2119
|
-
search = startSearch ? !search : search !== -1;
|
2120
|
-
if(search){
|
2121
|
-
$(lis[i]).removeClass('hidden-item');
|
2122
|
-
found = true;
|
2123
|
-
} else {
|
2124
|
-
$(lis[i]).addClass('hidden-item');
|
2125
|
-
}
|
2126
|
-
});
|
2127
|
-
} else if(lis.length) {
|
2128
|
-
lis.removeClass('hidden-item');
|
2129
|
-
found = true;
|
2130
|
-
}
|
2131
|
-
|
2132
|
-
this.hasViewableData = found;
|
2133
|
-
if(!_fromShowList && found){
|
2134
|
-
this.showList();
|
2135
|
-
}
|
2136
|
-
if(!found){
|
2137
|
-
this.lastUnfoundValue = value;
|
2138
|
-
this.hideList();
|
2139
|
-
}
|
2140
|
-
},
|
2141
|
-
setPos: function(){
|
2142
|
-
this.shadowList.css({marginTop: 0, marginLeft: 0, marginRight: 0, marginBottom: 0});
|
2143
|
-
var css = (formsCFG.positionDatalist) ? $(this.input).position() : webshims.getRelOffset(this.shadowList, this.input);
|
2144
|
-
css.top += $(this.input).outerHeight();
|
2145
|
-
css.width = $(this.input).outerWidth() - (parseInt(this.shadowList.css('borderLeftWidth'), 10) || 0) - (parseInt(this.shadowList.css('borderRightWidth'), 10) || 0);
|
2146
|
-
this.shadowList.css({marginTop: '', marginLeft: '', marginRight: '', marginBottom: ''}).css(css);
|
2147
|
-
return css;
|
2148
|
-
},
|
2149
|
-
showList: function(){
|
2150
|
-
if(this.isListVisible){return false;}
|
2151
|
-
if(this.needsUpdate){
|
2152
|
-
this.updateListOptions();
|
2153
|
-
}
|
2154
|
-
this.showHideOptions(true);
|
2155
|
-
if(!this.hasViewableData){return false;}
|
2156
|
-
this.isListVisible = true;
|
2157
|
-
var that = this;
|
2158
|
-
|
2159
|
-
that.setPos();
|
2160
|
-
that.shadowList.addClass('datalist-visible').find('li.active-item').removeClass('active-item');
|
2161
|
-
|
2162
|
-
$(window).unbind('.datalist'+that.id);
|
2163
|
-
$(document)
|
2164
|
-
.off('.datalist'+that.id)
|
2165
|
-
.on('mousedown.datalist'+that.id +' focusin.datalist'+that.id, function(e){
|
2166
|
-
if(e.target === that.input || that.shadowList[0] === e.target || $.contains( that.shadowList[0], e.target )){
|
2167
|
-
clearTimeout(that.hideTimer);
|
2168
|
-
setTimeout(function(){
|
2169
|
-
clearTimeout(that.hideTimer);
|
2170
|
-
}, 9);
|
2171
|
-
} else {
|
2172
|
-
that.timedHide();
|
2173
|
-
}
|
2174
|
-
})
|
2175
|
-
.on('updateshadowdom.datalist'+that.id, function(){
|
2176
|
-
that.setPos();
|
2177
|
-
})
|
2178
|
-
;
|
2179
|
-
return true;
|
2180
|
-
},
|
2181
|
-
hideList: function(){
|
2182
|
-
if(!this.isListVisible){return false;}
|
2183
|
-
var that = this;
|
2184
|
-
var triggerChange = function(e){
|
2185
|
-
if(that.changedValue){
|
2186
|
-
$(that.input).trigger('change');
|
2187
|
-
}
|
2188
|
-
that.changedValue = false;
|
2189
|
-
};
|
2190
|
-
|
2191
|
-
that.shadowList.removeClass('datalist-visible list-item-active');
|
2192
|
-
that.index = -1;
|
2193
|
-
that.isListVisible = false;
|
2194
|
-
if(that.changedValue){
|
2195
|
-
that.triggeredByDatalist = true;
|
2196
|
-
webshims.triggerInlineForm && webshims.triggerInlineForm(that.input, 'input');
|
2197
|
-
if($(that.input).is(':focus')){
|
2198
|
-
$(that.input).one('blur', triggerChange);
|
2199
|
-
} else {
|
2200
|
-
triggerChange();
|
2201
|
-
}
|
2202
|
-
that.triggeredByDatalist = false;
|
2203
|
-
}
|
2204
|
-
$(document).unbind('.datalist'+that.id);
|
2205
|
-
$(window)
|
2206
|
-
.off('.datalist'+that.id)
|
2207
|
-
.one('resize.datalist'+that.id, function(){
|
2208
|
-
that.shadowList.css({top: 0, left: 0});
|
2209
|
-
})
|
2210
|
-
;
|
2211
|
-
return true;
|
2212
|
-
},
|
2213
|
-
scrollIntoView: function(elem){
|
2214
|
-
var ul = $('ul', this.shadowList);
|
2215
|
-
var div = $('div.datalist-box', this.shadowList);
|
2216
|
-
var elemPos = elem.position();
|
2217
|
-
var containerHeight;
|
2218
|
-
elemPos.top -= (parseInt(ul.css('paddingTop'), 10) || 0) + (parseInt(ul.css('marginTop'), 10) || 0) + (parseInt(ul.css('borderTopWidth'), 10) || 0);
|
2219
|
-
if(elemPos.top < 0){
|
2220
|
-
div.scrollTop( div.scrollTop() + elemPos.top - 2);
|
2221
|
-
return;
|
2222
|
-
}
|
2223
|
-
elemPos.top += elem.outerHeight();
|
2224
|
-
containerHeight = div.height();
|
2225
|
-
if(elemPos.top > containerHeight){
|
2226
|
-
div.scrollTop( div.scrollTop() + (elemPos.top - containerHeight) + 2);
|
2227
|
-
}
|
2228
|
-
},
|
2229
|
-
changeValue: function(activeItem){
|
2230
|
-
if(!activeItem[0]){return;}
|
2231
|
-
var newValue = $('span.option-value', activeItem).text();
|
2232
|
-
var oldValue = $.prop(this.input, 'value');
|
2233
|
-
if(newValue != oldValue){
|
2234
|
-
$(this.input)
|
2235
|
-
.prop('value', newValue)
|
2236
|
-
.triggerHandler('updateInput')
|
2237
|
-
;
|
2238
|
-
this.changedValue = true;
|
2239
|
-
}
|
2240
|
-
},
|
2241
|
-
markItem: function(index, doValue, items){
|
2242
|
-
var activeItem;
|
2243
|
-
var goesUp;
|
2244
|
-
|
2245
|
-
items = items || $('li:not(.hidden-item)', this.shadowList);
|
2246
|
-
if(!items.length){return;}
|
2247
|
-
if(index < 0){
|
2248
|
-
index = items.length - 1;
|
2249
|
-
} else if(index >= items.length){
|
2250
|
-
index = 0;
|
2251
|
-
}
|
2252
|
-
items.removeClass('active-item');
|
2253
|
-
this.shadowList.addClass('list-item-active');
|
2254
|
-
activeItem = items.filter(':eq('+ index +')').addClass('active-item');
|
2255
|
-
|
2256
|
-
if(doValue){
|
2257
|
-
this.changeValue(activeItem);
|
2258
|
-
this.scrollIntoView(activeItem);
|
2259
|
-
}
|
2260
|
-
this.index = index;
|
2261
|
-
}
|
2262
|
-
};
|
2263
|
-
|
2264
|
-
//init datalist update
|
2265
|
-
initializeDatalist();
|
2266
|
-
})();
|
2267
|
-
|
2268
|
-
});
|
2269
|
-
(function($, Modernizr, webshims){
|
2270
|
-
"use strict";
|
2271
|
-
var hasNative = Modernizr.audio && Modernizr.video;
|
2272
|
-
var supportsLoop = false;
|
2273
|
-
var bugs = webshims.bugs;
|
2274
|
-
|
2275
|
-
var loadSwf = function(){
|
2276
|
-
webshims.ready(swfType, function(){
|
2277
|
-
if(!webshims.mediaelement.createSWF){
|
2278
|
-
webshims.mediaelement.loadSwf = true;
|
2279
|
-
webshims.reTest([swfType], hasNative);
|
2280
|
-
}
|
2281
|
-
});
|
2282
|
-
};
|
2283
|
-
var options = webshims.cfg.mediaelement;
|
2284
|
-
var swfType = options && options.player == 'jwplayer' ? 'mediaelement-swf' : 'mediaelement-jaris';
|
2285
|
-
var hasSwf;
|
2286
|
-
if(!options){
|
2287
|
-
webshims.error("mediaelement wasn't implemented but loaded");
|
2288
|
-
return;
|
2289
|
-
}
|
2290
|
-
if(hasNative){
|
2291
|
-
var videoElem = document.createElement('video');
|
2292
|
-
Modernizr.videoBuffered = ('buffered' in videoElem);
|
2293
|
-
supportsLoop = ('loop' in videoElem);
|
2294
|
-
|
2295
|
-
webshims.capturingEvents(['play', 'playing', 'waiting', 'paused', 'ended', 'durationchange', 'loadedmetadata', 'canplay', 'volumechange']);
|
2296
|
-
|
2297
|
-
if(!Modernizr.videoBuffered){
|
2298
|
-
webshims.addPolyfill('mediaelement-native-fix', {
|
2299
|
-
f: 'mediaelement',
|
2300
|
-
test: Modernizr.videoBuffered,
|
2301
|
-
d: ['dom-support']
|
2302
|
-
});
|
2303
|
-
|
2304
|
-
webshims.reTest('mediaelement-native-fix');
|
2305
|
-
}
|
2306
|
-
}
|
2307
|
-
|
2308
|
-
if(hasNative && !options.preferFlash){
|
2309
|
-
var switchOptions = function(e){
|
2310
|
-
var parent = e.target.parentNode;
|
2311
|
-
if(!options.preferFlash && ($(e.target).is('audio, video') || (parent && $('source:last', parent)[0] == e.target)) ){
|
2312
|
-
webshims.ready('DOM mediaelement', function(){
|
2313
|
-
if(hasSwf){
|
2314
|
-
loadSwf();
|
2315
|
-
}
|
2316
|
-
webshims.ready('WINDOWLOAD '+swfType, function(){
|
2317
|
-
setTimeout(function(){
|
2318
|
-
if(hasSwf && !options.preferFlash && webshims.mediaelement.createSWF && !$(e.target).closest('audio, video').is('.nonnative-api-active')){
|
2319
|
-
options.preferFlash = true;
|
2320
|
-
document.removeEventListener('error', switchOptions, true);
|
2321
|
-
$('audio, video').each(function(){
|
2322
|
-
webshims.mediaelement.selectSource(this);
|
2323
|
-
});
|
2324
|
-
webshims.info("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src);
|
2325
|
-
} else if(!hasSwf){
|
2326
|
-
document.removeEventListener('error', switchOptions, true);
|
2327
|
-
}
|
2328
|
-
}, 20);
|
2329
|
-
});
|
2330
|
-
});
|
2331
|
-
}
|
2332
|
-
};
|
2333
|
-
document.addEventListener('error', switchOptions, true);
|
2334
|
-
$('audio, video').each(function(){
|
2335
|
-
if(this.error){
|
2336
|
-
switchOptions({target: this});
|
2337
|
-
}
|
2338
|
-
});
|
2339
|
-
}
|
2340
|
-
|
2341
|
-
|
2342
|
-
if(Modernizr.track && !bugs.track){
|
2343
|
-
(function(){
|
2344
|
-
|
2345
|
-
if(!bugs.track){
|
2346
|
-
bugs.track = typeof $('<track />')[0].readyState != 'number';
|
2347
|
-
}
|
2348
|
-
|
2349
|
-
if(!bugs.track){
|
2350
|
-
try {
|
2351
|
-
new TextTrackCue(2, 3, '');
|
2352
|
-
} catch(e){
|
2353
|
-
bugs.track = true;
|
2354
|
-
}
|
2355
|
-
}
|
2356
|
-
|
2357
|
-
var trackOptions = webshims.cfg.track;
|
2358
|
-
var trackListener = function(e){
|
2359
|
-
$(e.target).filter('track').each(changeApi);
|
2360
|
-
};
|
2361
|
-
var changeApi = function(){
|
2362
|
-
if(bugs.track || (!trackOptions.override && $.prop(this, 'readyState') == 3)){
|
2363
|
-
trackOptions.override = true;
|
2364
|
-
webshims.reTest('track');
|
2365
|
-
document.removeEventListener('error', trackListener, true);
|
2366
|
-
if(this && $.nodeName(this, 'track')){
|
2367
|
-
webshims.error("track support was overwritten. Please check your vtt including your vtt mime-type");
|
2368
|
-
} else {
|
2369
|
-
webshims.info("track support was overwritten. due to bad browser support");
|
2370
|
-
}
|
2371
|
-
}
|
2372
|
-
};
|
2373
|
-
var detectTrackError = function(){
|
2374
|
-
document.addEventListener('error', trackListener, true);
|
2375
|
-
|
2376
|
-
if(bugs.track){
|
2377
|
-
changeApi();
|
2378
|
-
} else {
|
2379
|
-
$('track').each(changeApi);
|
2380
|
-
}
|
2381
|
-
};
|
2382
|
-
if(!trackOptions.override){
|
2383
|
-
if(webshims.isReady('track')){
|
2384
|
-
detectTrackError();
|
2385
|
-
} else {
|
2386
|
-
$(detectTrackError);
|
2387
|
-
}
|
2388
|
-
}
|
2389
|
-
})();
|
2390
|
-
|
2391
|
-
}
|
2392
|
-
|
2393
|
-
webshims.register('mediaelement-core', function($, webshims, window, document, undefined){
|
2394
|
-
hasSwf = swfobject.hasFlashPlayerVersion('9.0.115');
|
2395
|
-
$('html').addClass(hasSwf ? 'swf' : 'no-swf');
|
2396
|
-
var mediaelement = webshims.mediaelement;
|
2397
|
-
mediaelement.parseRtmp = function(data){
|
2398
|
-
var src = data.src.split('://');
|
2399
|
-
var paths = src[1].split('/');
|
2400
|
-
var i, len, found;
|
2401
|
-
data.server = src[0]+'://'+paths[0]+'/';
|
2402
|
-
data.streamId = [];
|
2403
|
-
for(i = 1, len = paths.length; i < len; i++){
|
2404
|
-
if(!found && paths[i].indexOf(':') !== -1){
|
2405
|
-
paths[i] = paths[i].split(':')[1];
|
2406
|
-
found = true;
|
2407
|
-
}
|
2408
|
-
if(!found){
|
2409
|
-
data.server += paths[i]+'/';
|
2410
|
-
} else {
|
2411
|
-
data.streamId.push(paths[i]);
|
2412
|
-
}
|
2413
|
-
}
|
2414
|
-
if(!data.streamId.length){
|
2415
|
-
webshims.error('Could not parse rtmp url');
|
2416
|
-
}
|
2417
|
-
data.streamId = data.streamId.join('/');
|
2418
|
-
};
|
2419
|
-
var getSrcObj = function(elem, nodeName){
|
2420
|
-
elem = $(elem);
|
2421
|
-
var src = {src: elem.attr('src') || '', elem: elem, srcProp: elem.prop('src')};
|
2422
|
-
var tmp;
|
2423
|
-
|
2424
|
-
if(!src.src){return src;}
|
2425
|
-
|
2426
|
-
tmp = elem.attr('data-server');
|
2427
|
-
if(tmp != null){
|
2428
|
-
src.server = tmp;
|
2429
|
-
}
|
2430
|
-
|
2431
|
-
tmp = elem.attr('type');
|
2432
|
-
if(tmp){
|
2433
|
-
src.type = tmp;
|
2434
|
-
src.container = $.trim(tmp.split(';')[0]);
|
2435
|
-
} else {
|
2436
|
-
if(!nodeName){
|
2437
|
-
nodeName = elem[0].nodeName.toLowerCase();
|
2438
|
-
if(nodeName == 'source'){
|
2439
|
-
nodeName = (elem.closest('video, audio')[0] || {nodeName: 'video'}).nodeName.toLowerCase();
|
2440
|
-
}
|
2441
|
-
}
|
2442
|
-
if(src.server){
|
2443
|
-
src.type = nodeName+'/rtmp';
|
2444
|
-
src.container = nodeName+'/rtmp';
|
2445
|
-
} else {
|
2446
|
-
|
2447
|
-
tmp = mediaelement.getTypeForSrc( src.src, nodeName, src );
|
2448
|
-
|
2449
|
-
if(tmp){
|
2450
|
-
src.type = tmp;
|
2451
|
-
src.container = tmp;
|
2452
|
-
}
|
2453
|
-
}
|
2454
|
-
}
|
2455
|
-
tmp = elem.attr('media');
|
2456
|
-
if(tmp){
|
2457
|
-
src.media = tmp;
|
2458
|
-
}
|
2459
|
-
if(src.type == 'audio/rtmp' || src.type == 'video/rtmp'){
|
2460
|
-
if(src.server){
|
2461
|
-
src.streamId = src.src;
|
2462
|
-
} else {
|
2463
|
-
mediaelement.parseRtmp(src);
|
2464
|
-
}
|
2465
|
-
}
|
2466
|
-
return src;
|
2467
|
-
};
|
2468
|
-
|
2469
|
-
|
2470
|
-
|
2471
|
-
var hasYt = !hasSwf && ('postMessage' in window) && hasNative;
|
2472
|
-
|
2473
|
-
var loadTrackUi = function(){
|
2474
|
-
if(loadTrackUi.loaded){return;}
|
2475
|
-
loadTrackUi.loaded = true;
|
2476
|
-
$(function(){
|
2477
|
-
webshims.loader.loadList(['track-ui']);
|
2478
|
-
});
|
2479
|
-
};
|
2480
|
-
var loadYt = (function(){
|
2481
|
-
var loaded;
|
2482
|
-
return function(){
|
2483
|
-
if(loaded || !hasYt){return;}
|
2484
|
-
loaded = true;
|
2485
|
-
webshims.loader.loadScript("https://www.youtube.com/player_api");
|
2486
|
-
$(function(){
|
2487
|
-
webshims.polyfill("mediaelement-yt");
|
2488
|
-
});
|
2489
|
-
};
|
2490
|
-
})();
|
2491
|
-
var loadThird = function(){
|
2492
|
-
if(hasSwf){
|
2493
|
-
loadSwf();
|
2494
|
-
} else {
|
2495
|
-
loadYt();
|
2496
|
-
}
|
2497
|
-
};
|
2498
|
-
|
2499
|
-
webshims.addPolyfill('mediaelement-yt', {
|
2500
|
-
test: !hasYt,
|
2501
|
-
d: ['dom-support']
|
2502
|
-
});
|
2503
|
-
|
2504
|
-
mediaelement.mimeTypes = {
|
2505
|
-
audio: {
|
2506
|
-
//ogm shouldn´t be used!
|
2507
|
-
'audio/ogg': ['ogg','oga', 'ogm'],
|
2508
|
-
'audio/ogg;codecs="opus"': 'opus',
|
2509
|
-
'audio/mpeg': ['mp2','mp3','mpga','mpega'],
|
2510
|
-
'audio/mp4': ['mp4','mpg4', 'm4r', 'm4a', 'm4p', 'm4b', 'aac'],
|
2511
|
-
'audio/wav': ['wav'],
|
2512
|
-
'audio/3gpp': ['3gp','3gpp'],
|
2513
|
-
'audio/webm': ['webm'],
|
2514
|
-
'audio/fla': ['flv', 'f4a', 'fla'],
|
2515
|
-
'application/x-mpegURL': ['m3u8', 'm3u']
|
2516
|
-
},
|
2517
|
-
video: {
|
2518
|
-
//ogm shouldn´t be used!
|
2519
|
-
'video/ogg': ['ogg','ogv', 'ogm'],
|
2520
|
-
'video/mpeg': ['mpg','mpeg','mpe'],
|
2521
|
-
'video/mp4': ['mp4','mpg4', 'm4v'],
|
2522
|
-
'video/quicktime': ['mov','qt'],
|
2523
|
-
'video/x-msvideo': ['avi'],
|
2524
|
-
'video/x-ms-asf': ['asf', 'asx'],
|
2525
|
-
'video/flv': ['flv', 'f4v'],
|
2526
|
-
'video/3gpp': ['3gp','3gpp'],
|
2527
|
-
'video/webm': ['webm'],
|
2528
|
-
'application/x-mpegURL': ['m3u8', 'm3u'],
|
2529
|
-
'video/MP2T': ['ts']
|
2530
|
-
}
|
2531
|
-
}
|
2532
|
-
;
|
2533
|
-
|
2534
|
-
mediaelement.mimeTypes.source = $.extend({}, mediaelement.mimeTypes.audio, mediaelement.mimeTypes.video);
|
2535
|
-
|
2536
|
-
mediaelement.getTypeForSrc = function(src, nodeName, data){
|
2537
|
-
if(src.indexOf('youtube.com/watch?') != -1 || src.indexOf('youtube.com/v/') != -1){
|
2538
|
-
return 'video/youtube';
|
2539
|
-
}
|
2540
|
-
if(src.indexOf('rtmp') === 0){
|
2541
|
-
return nodeName+'/rtmp';
|
2542
|
-
}
|
2543
|
-
src = src.split('?')[0].split('.');
|
2544
|
-
src = src[src.length - 1];
|
2545
|
-
var mt;
|
2546
|
-
|
2547
|
-
$.each(mediaelement.mimeTypes[nodeName], function(mimeType, exts){
|
2548
|
-
if(exts.indexOf(src) !== -1){
|
2549
|
-
mt = mimeType;
|
2550
|
-
return false;
|
2551
|
-
}
|
2552
|
-
});
|
2553
|
-
return mt;
|
2554
|
-
};
|
2555
|
-
|
2556
|
-
|
2557
|
-
mediaelement.srces = function(mediaElem, srces){
|
2558
|
-
mediaElem = $(mediaElem);
|
2559
|
-
if(!srces){
|
2560
|
-
srces = [];
|
2561
|
-
var nodeName = mediaElem[0].nodeName.toLowerCase();
|
2562
|
-
var src = getSrcObj(mediaElem, nodeName);
|
2563
|
-
|
2564
|
-
if(!src.src){
|
2565
|
-
|
2566
|
-
$('source', mediaElem).each(function(){
|
2567
|
-
src = getSrcObj(this, nodeName);
|
2568
|
-
if(src.src){srces.push(src);}
|
2569
|
-
});
|
2570
|
-
} else {
|
2571
|
-
srces.push(src);
|
2572
|
-
}
|
2573
|
-
return srces;
|
2574
|
-
} else {
|
2575
|
-
mediaElem.removeAttr('src').removeAttr('type').find('source').remove();
|
2576
|
-
if(!$.isArray(srces)){
|
2577
|
-
srces = [srces];
|
2578
|
-
}
|
2579
|
-
srces.forEach(function(src){
|
2580
|
-
var source = document.createElement('source');
|
2581
|
-
if(typeof src == 'string'){
|
2582
|
-
src = {src: src};
|
2583
|
-
}
|
2584
|
-
source.setAttribute('src', src.src);
|
2585
|
-
if(src.type){
|
2586
|
-
source.setAttribute('type', src.type);
|
2587
|
-
}
|
2588
|
-
if(src.media){
|
2589
|
-
source.setAttribute('media', src.media);
|
2590
|
-
}
|
2591
|
-
mediaElem.append(source);
|
2592
|
-
});
|
2593
|
-
|
2594
|
-
}
|
2595
|
-
};
|
2596
|
-
|
2597
|
-
|
2598
|
-
$.fn.loadMediaSrc = function(srces, poster){
|
2599
|
-
return this.each(function(){
|
2600
|
-
if(poster !== undefined){
|
2601
|
-
$(this).removeAttr('poster');
|
2602
|
-
if(poster){
|
2603
|
-
$.attr(this, 'poster', poster);
|
2604
|
-
}
|
2605
|
-
}
|
2606
|
-
mediaelement.srces(this, srces);
|
2607
|
-
$(this).mediaLoad();
|
2608
|
-
});
|
2609
|
-
};
|
2610
|
-
|
2611
|
-
mediaelement.swfMimeTypes = ['video/3gpp', 'video/x-msvideo', 'video/quicktime', 'video/x-m4v', 'video/mp4', 'video/m4p', 'video/x-flv', 'video/flv', 'audio/mpeg', 'audio/aac', 'audio/mp4', 'audio/x-m4a', 'audio/m4a', 'audio/mp3', 'audio/x-fla', 'audio/fla', 'youtube/flv', 'jwplayer/jwplayer', 'video/youtube', 'video/rtmp', 'audio/rtmp'];
|
2612
|
-
|
2613
|
-
mediaelement.canThirdPlaySrces = function(mediaElem, srces){
|
2614
|
-
var ret = '';
|
2615
|
-
if(hasSwf || hasYt){
|
2616
|
-
mediaElem = $(mediaElem);
|
2617
|
-
srces = srces || mediaelement.srces(mediaElem);
|
2618
|
-
$.each(srces, function(i, src){
|
2619
|
-
if(src.container && src.src && ((hasSwf && mediaelement.swfMimeTypes.indexOf(src.container) != -1) || (hasYt && src.container == 'video/youtube'))){
|
2620
|
-
ret = src;
|
2621
|
-
return false;
|
2622
|
-
}
|
2623
|
-
});
|
2624
|
-
|
2625
|
-
}
|
2626
|
-
|
2627
|
-
return ret;
|
2628
|
-
};
|
2629
|
-
|
2630
|
-
var nativeCanPlayType = {};
|
2631
|
-
mediaelement.canNativePlaySrces = function(mediaElem, srces){
|
2632
|
-
var ret = '';
|
2633
|
-
if(hasNative){
|
2634
|
-
mediaElem = $(mediaElem);
|
2635
|
-
var nodeName = (mediaElem[0].nodeName || '').toLowerCase();
|
2636
|
-
if(!nativeCanPlayType[nodeName]){return ret;}
|
2637
|
-
srces = srces || mediaelement.srces(mediaElem);
|
2638
|
-
|
2639
|
-
$.each(srces, function(i, src){
|
2640
|
-
if(src.type && nativeCanPlayType[nodeName].prop._supvalue.call(mediaElem[0], src.type) ){
|
2641
|
-
ret = src;
|
2642
|
-
return false;
|
2643
|
-
}
|
2644
|
-
});
|
2645
|
-
}
|
2646
|
-
return ret;
|
2647
|
-
};
|
2648
|
-
|
2649
|
-
mediaelement.setError = function(elem, message){
|
2650
|
-
if(!message){
|
2651
|
-
message = "can't play sources";
|
2652
|
-
}
|
2653
|
-
|
2654
|
-
$(elem).pause().data('mediaerror', message);
|
2655
|
-
webshims.warn('mediaelementError: '+ message);
|
2656
|
-
setTimeout(function(){
|
2657
|
-
if($(elem).data('mediaerror')){
|
2658
|
-
$(elem).trigger('mediaerror');
|
2659
|
-
}
|
2660
|
-
}, 1);
|
2661
|
-
};
|
2662
|
-
|
2663
|
-
var handleThird = (function(){
|
2664
|
-
var requested;
|
2665
|
-
return function( mediaElem, ret, data ){
|
2666
|
-
if(!requested){
|
2667
|
-
loadTrackUi();
|
2668
|
-
}
|
2669
|
-
webshims.ready(hasSwf ? swfType : 'mediaelement-yt', function(){
|
2670
|
-
if(mediaelement.createSWF){
|
2671
|
-
mediaelement.createSWF( mediaElem, ret, data );
|
2672
|
-
} else if(!requested) {
|
2673
|
-
requested = true;
|
2674
|
-
loadThird();
|
2675
|
-
//readd to ready
|
2676
|
-
handleThird( mediaElem, ret, data );
|
2677
|
-
}
|
2678
|
-
});
|
2679
|
-
if(!requested && hasYt && !mediaelement.createSWF){
|
2680
|
-
loadYt();
|
2681
|
-
}
|
2682
|
-
};
|
2683
|
-
})();
|
2684
|
-
|
2685
|
-
var stepSources = function(elem, data, useSwf, _srces, _noLoop){
|
2686
|
-
var ret;
|
2687
|
-
if(useSwf || (useSwf !== false && data && data.isActive == 'third')){
|
2688
|
-
ret = mediaelement.canThirdPlaySrces(elem, _srces);
|
2689
|
-
if(!ret){
|
2690
|
-
if(_noLoop){
|
2691
|
-
mediaelement.setError(elem, false);
|
2692
|
-
} else {
|
2693
|
-
stepSources(elem, data, false, _srces, true);
|
2694
|
-
}
|
2695
|
-
} else {
|
2696
|
-
handleThird(elem, ret, data);
|
2697
|
-
}
|
2698
|
-
} else {
|
2699
|
-
ret = mediaelement.canNativePlaySrces(elem, _srces);
|
2700
|
-
if(!ret){
|
2701
|
-
if(_noLoop){
|
2702
|
-
mediaelement.setError(elem, false);
|
2703
|
-
if(data && data.isActive == 'third') {
|
2704
|
-
mediaelement.setActive(elem, 'html5', data);
|
2705
|
-
}
|
2706
|
-
} else {
|
2707
|
-
stepSources(elem, data, true, _srces, true);
|
2708
|
-
}
|
2709
|
-
} else if(data && data.isActive == 'third') {
|
2710
|
-
mediaelement.setActive(elem, 'html5', data);
|
2711
|
-
}
|
2712
|
-
}
|
2713
|
-
};
|
2714
|
-
var stopParent = /^(?:embed|object|datalist)$/i;
|
2715
|
-
var selectSource = function(elem, data){
|
2716
|
-
var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
|
2717
|
-
var _srces = mediaelement.srces(elem);
|
2718
|
-
var parent = elem.parentNode;
|
2719
|
-
|
2720
|
-
clearTimeout(baseData.loadTimer);
|
2721
|
-
$.data(elem, 'mediaerror', false);
|
2722
|
-
|
2723
|
-
if(!_srces.length || !parent || parent.nodeType != 1 || stopParent.test(parent.nodeName || '')){return;}
|
2724
|
-
data = data || webshims.data(elem, 'mediaelement');
|
2725
|
-
stepSources(elem, data, options.preferFlash || undefined, _srces);
|
2726
|
-
};
|
2727
|
-
mediaelement.selectSource = selectSource;
|
2728
|
-
|
2729
|
-
$(document).on('ended', function(e){
|
2730
|
-
var data = webshims.data(e.target, 'mediaelement');
|
2731
|
-
if( supportsLoop && (!data || data.isActive == 'html5') && !$.prop(e.target, 'loop')){return;}
|
2732
|
-
setTimeout(function(){
|
2733
|
-
if( $.prop(e.target, 'paused') || !$.prop(e.target, 'loop') ){return;}
|
2734
|
-
$(e.target).prop('currentTime', 0).play();
|
2735
|
-
}, 1);
|
2736
|
-
|
2737
|
-
});
|
2738
|
-
if(!supportsLoop){
|
2739
|
-
webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
|
2740
|
-
}
|
2741
|
-
|
2742
|
-
['audio', 'video'].forEach(function(nodeName){
|
2743
|
-
var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
|
2744
|
-
prop: {
|
2745
|
-
value: function(){
|
2746
|
-
var data = webshims.data(this, 'mediaelement');
|
2747
|
-
selectSource(this, data);
|
2748
|
-
if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
|
2749
|
-
supLoad.prop._supvalue.apply(this, arguments);
|
2750
|
-
}
|
2751
|
-
}
|
2752
|
-
}
|
2753
|
-
});
|
2754
|
-
nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
|
2755
|
-
prop: {
|
2756
|
-
value: function(type){
|
2757
|
-
var ret = '';
|
2758
|
-
if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
|
2759
|
-
ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
|
2760
|
-
if(ret == 'no'){
|
2761
|
-
ret = '';
|
2762
|
-
}
|
2763
|
-
}
|
2764
|
-
if(!ret && hasSwf){
|
2765
|
-
type = $.trim((type || '').split(';')[0]);
|
2766
|
-
if(mediaelement.swfMimeTypes.indexOf(type) != -1){
|
2767
|
-
ret = 'maybe';
|
2768
|
-
}
|
2769
|
-
}
|
2770
|
-
return ret;
|
2771
|
-
}
|
2772
|
-
}
|
2773
|
-
});
|
2774
|
-
});
|
2775
|
-
webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
|
2776
|
-
set: function(){
|
2777
|
-
var elem = this;
|
2778
|
-
var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
|
2779
|
-
clearTimeout(baseData.loadTimer);
|
2780
|
-
baseData.loadTimer = setTimeout(function(){
|
2781
|
-
selectSource(elem);
|
2782
|
-
elem = null;
|
2783
|
-
}, 9);
|
2784
|
-
}
|
2785
|
-
});
|
2786
|
-
|
2787
|
-
var initMediaElements = function(){
|
2788
|
-
|
2789
|
-
webshims.addReady(function(context, insertedElement){
|
2790
|
-
var media = $('video, audio', context)
|
2791
|
-
.add(insertedElement.filter('video, audio'))
|
2792
|
-
.each(function(){
|
2793
|
-
var data = webshims.data(this, 'mediaelement');
|
2794
|
-
|
2795
|
-
if(hasNative && $.prop(this, 'paused') && !$.prop(this, 'readyState') && $(this).is('audio[preload="none"][controls]:not([autoplay])') && (!data || data.isActive == 'html5')){
|
2796
|
-
//IE controls not visible bug
|
2797
|
-
$(this).prop('preload', 'metadata').mediaLoad();
|
2798
|
-
} else {
|
2799
|
-
selectSource(this, data);
|
2800
|
-
}
|
2801
|
-
|
2802
|
-
if(hasNative){
|
2803
|
-
|
2804
|
-
//FF progress bug
|
2805
|
-
(function(){
|
2806
|
-
var bufferTimer;
|
2807
|
-
var lastBuffered;
|
2808
|
-
var elem = this;
|
2809
|
-
var getBufferedString = function(){
|
2810
|
-
var buffered = $.prop(elem, 'buffered');
|
2811
|
-
if(!buffered){return;}
|
2812
|
-
var bufferString = "";
|
2813
|
-
for(var i = 0, len = buffered.length; i < len;i++){
|
2814
|
-
bufferString += buffered.end(i);
|
2815
|
-
}
|
2816
|
-
return bufferString;
|
2817
|
-
};
|
2818
|
-
var testBuffer = function(){
|
2819
|
-
var buffered = getBufferedString();
|
2820
|
-
if(buffered != lastBuffered){
|
2821
|
-
lastBuffered = buffered;
|
2822
|
-
$(elem).triggerHandler('progress');
|
2823
|
-
}
|
2824
|
-
};
|
2825
|
-
|
2826
|
-
$(this)
|
2827
|
-
.on({
|
2828
|
-
'play loadstart progress': function(e){
|
2829
|
-
if(e.type == 'progress'){
|
2830
|
-
lastBuffered = getBufferedString();
|
2831
|
-
}
|
2832
|
-
clearTimeout(bufferTimer);
|
2833
|
-
bufferTimer = setTimeout(testBuffer, 999);
|
2834
|
-
},
|
2835
|
-
'emptied stalled mediaerror abort suspend': function(e){
|
2836
|
-
if(e.type == 'emptied'){
|
2837
|
-
lastBuffered = false;
|
2838
|
-
}
|
2839
|
-
clearTimeout(bufferTimer);
|
2840
|
-
}
|
2841
|
-
})
|
2842
|
-
;
|
2843
|
-
})();
|
2844
|
-
}
|
2845
|
-
|
2846
|
-
})
|
2847
|
-
;
|
2848
|
-
if(!loadTrackUi.loaded && $('track', media).length){
|
2849
|
-
loadTrackUi();
|
2850
|
-
}
|
2851
|
-
media = null;
|
2852
|
-
});
|
2853
|
-
};
|
2854
|
-
|
2855
|
-
if(Modernizr.track && !bugs.track){
|
2856
|
-
webshims.defineProperty(TextTrack.prototype, 'shimActiveCues', {
|
2857
|
-
get: function(){
|
2858
|
-
return this._shimActiveCues || this.activeCues;
|
2859
|
-
}
|
2860
|
-
});
|
2861
|
-
}
|
2862
|
-
//set native implementation ready, before swf api is retested
|
2863
|
-
if(hasNative){
|
2864
|
-
webshims.isReady('mediaelement-core', true);
|
2865
|
-
initMediaElements();
|
2866
|
-
webshims.ready('WINDOWLOAD mediaelement', loadThird);
|
2867
|
-
} else {
|
2868
|
-
webshims.ready(swfType, initMediaElements);
|
2869
|
-
}
|
2870
|
-
webshims.ready('WINDOWLOAD mediaelement', loadTrackUi);
|
2871
|
-
});
|
2872
|
-
})(jQuery, Modernizr, jQuery.webshims);
|