Bundle update, including new webshims version

This commit is contained in:
echarp 2014-09-03 00:57:03 +02:00
parent 151e4937c4
commit 7da30d42a5
64 changed files with 5622 additions and 5704 deletions

View File

@ -114,7 +114,7 @@ GEM
font-awesome-rails (4.2.0.0)
railties (>= 3.2, < 5.0)
formatador (0.2.5)
formtastic (2.3.0)
formtastic (2.3.1)
actionpack (>= 3.0)
fssm (0.2.10)
geocoder (1.2.4)
@ -160,7 +160,7 @@ GEM
jbuilder (2.1.3)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
jquery-rails (3.1.1)
jquery-rails (3.1.2)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jquery-turbolinks (2.1.0)
@ -282,7 +282,7 @@ GEM
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.1.3)
sprockets-rails (2.1.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
@ -313,7 +313,7 @@ GEM
warden (1.2.3)
rack (>= 1.0)
webrick (1.3.1)
webshims-rails (1.14.6)
webshims-rails (1.15.2)
rails (> 3.1.0)
PLATFORMS

View File

@ -1,511 +0,0 @@
/* Modernizr 2.7.1 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-canvas-audio-video-input-inputtypes-geolocation-shiv-addtest-prefixed-testprop-testallprops-prefixes-domprefixes
*/
;
window.Modernizr = (function( window, document, undefined ) {
var version = '2.7.1',
Modernizr = {},
docElement = document.documentElement,
mod = 'modernizr',
modElem = document.createElement(mod),
mStyle = modElem.style,
inputElem = document.createElement('input') ,
smile = ':)',
toString = {}.toString,
prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
omPrefixes = 'Webkit Moz O ms',
cssomPrefixes = omPrefixes.split(' '),
domPrefixes = omPrefixes.toLowerCase().split(' '),
tests = {},
inputs = {},
attrs = {},
classes = [],
slice = classes.slice,
featureName,
_hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;
if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
hasOwnProp = function (object, property) {
return _hasOwnProperty.call(object, property);
};
}
else {
hasOwnProp = function (object, property) {
return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
};
}
if (!Function.prototype.bind) {
Function.prototype.bind = function bind(that) {
var target = this;
if (typeof target != "function") {
throw new TypeError();
}
var args = slice.call(arguments, 1),
bound = function () {
if (this instanceof bound) {
var F = function(){};
F.prototype = target.prototype;
var self = new F();
var result = target.apply(
self,
args.concat(slice.call(arguments))
);
if (Object(result) === result) {
return result;
}
return self;
} else {
return target.apply(
that,
args.concat(slice.call(arguments))
);
}
};
return bound;
};
}
function setCss( str ) {
mStyle.cssText = str;
}
function setCssAll( str1, str2 ) {
return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
}
function is( obj, type ) {
return typeof obj === type;
}
function contains( str, substr ) {
return !!~('' + str).indexOf(substr);
}
function testProps( props, prefixed ) {
for ( var i in props ) {
var prop = props[i];
if ( !contains(prop, "-") && mStyle[prop] !== undefined ) {
return prefixed == 'pfx' ? prop : true;
}
}
return false;
}
function testDOMProps( props, obj, elem ) {
for ( var i in props ) {
var item = obj[props[i]];
if ( item !== undefined) {
if (elem === false) return props[i];
if (is(item, 'function')){
return item.bind(elem || obj);
}
return item;
}
}
return false;
}
function testPropsAll( prop, prefixed, elem ) {
var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),
props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
if(is(prefixed, "string") || is(prefixed, "undefined")) {
return testProps(props, prefixed);
} else {
props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
return testDOMProps(props, prefixed, elem);
}
}
tests['canvas'] = function() {
var elem = document.createElement('canvas');
return !!(elem.getContext && elem.getContext('2d'));
}; tests['geolocation'] = function() {
return 'geolocation' in navigator;
};
tests['video'] = function() {
var elem = document.createElement('video'),
bool = false;
try {
if ( bool = !!elem.canPlayType ) {
bool = new Boolean(bool);
bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,'');
bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
}
} catch(e) { }
return bool;
};
tests['audio'] = function() {
var elem = document.createElement('audio'),
bool = false;
try {
if ( bool = !!elem.canPlayType ) {
bool = new Boolean(bool);
bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,'');
bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,'');
bool.m4a = ( elem.canPlayType('audio/x-m4a;') ||
elem.canPlayType('audio/aac;')) .replace(/^no$/,'');
}
} catch(e) { }
return bool;
}; function webforms() {
Modernizr['input'] = (function( props ) {
for ( var i = 0, len = props.length; i < len; i++ ) {
attrs[ props[i] ] = !!(props[i] in inputElem);
}
if (attrs.list){
attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);
}
return attrs;
})('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
Modernizr['inputtypes'] = (function(props) {
for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {
inputElem.setAttribute('type', inputElemType = props[i]);
bool = inputElem.type !== 'text';
if ( bool ) {
inputElem.value = smile;
inputElem.style.cssText = 'position:absolute;visibility:hidden;';
if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {
docElement.appendChild(inputElem);
defaultView = document.defaultView;
bool = defaultView.getComputedStyle &&
defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
(inputElem.offsetHeight !== 0);
docElement.removeChild(inputElem);
} else if ( /^(search|tel)$/.test(inputElemType) ){
} else if ( /^(url|email)$/.test(inputElemType) ) {
bool = inputElem.checkValidity && inputElem.checkValidity() === false;
} else {
bool = inputElem.value != smile;
}
}
inputs[ props[i] ] = !!bool;
}
return inputs;
})('search tel url email datetime date month week time datetime-local number range color'.split(' '));
}
for ( var feature in tests ) {
if ( hasOwnProp(tests, feature) ) {
featureName = feature.toLowerCase();
Modernizr[featureName] = tests[feature]();
classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
}
}
Modernizr.input || webforms();
Modernizr.addTest = function ( feature, test ) {
if ( typeof feature == 'object' ) {
for ( var key in feature ) {
if ( hasOwnProp( feature, key ) ) {
Modernizr.addTest( key, feature[ key ] );
}
}
} else {
feature = feature.toLowerCase();
if ( Modernizr[feature] !== undefined ) {
return Modernizr;
}
test = typeof test == 'function' ? test() : test;
if (typeof enableClasses !== "undefined" && enableClasses) {
docElement.className += ' ' + (test ? '' : 'no-') + feature;
}
Modernizr[feature] = test;
}
return Modernizr;
};
setCss('');
modElem = inputElem = null;
;(function(window, document) {
var version = '3.7.0';
var options = window.html5 || {};
var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
var supportsHtml5Styles;
var expando = '_html5shiv';
var expanID = 0;
var expandoData = {};
var supportsUnknownElements;
(function() {
try {
var a = document.createElement('a');
a.innerHTML = '<xyz></xyz>';
supportsHtml5Styles = ('hidden' in a);
supportsUnknownElements = a.childNodes.length == 1 || (function() {
(document.createElement)('a');
var frag = document.createDocumentFragment();
return (
typeof frag.cloneNode == 'undefined' ||
typeof frag.createDocumentFragment == 'undefined' ||
typeof frag.createElement == 'undefined'
);
}());
} catch(e) {
supportsHtml5Styles = true;
supportsUnknownElements = true;
}
}());
function addStyleSheet(ownerDocument, cssText) {
var p = ownerDocument.createElement('p'),
parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
p.innerHTML = 'x<style>' + cssText + '</style>';
return parent.insertBefore(p.lastChild, parent.firstChild);
}
function getElements() {
var elements = html5.elements;
return typeof elements == 'string' ? elements.split(' ') : elements;
}
function getExpandoData(ownerDocument) {
var data = expandoData[ownerDocument[expando]];
if (!data) {
data = {};
expanID++;
ownerDocument[expando] = expanID;
expandoData[expanID] = data;
}
return data;
}
function createElement(nodeName, ownerDocument, data){
if (!ownerDocument) {
ownerDocument = document;
}
if(supportsUnknownElements){
return ownerDocument.createElement(nodeName);
}
if (!data) {
data = getExpandoData(ownerDocument);
}
var node;
if (data.cache[nodeName]) {
node = data.cache[nodeName].cloneNode();
} else if (saveClones.test(nodeName)) {
node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
} else {
node = data.createElem(nodeName);
}
return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
}
function createDocumentFragment(ownerDocument, data){
if (!ownerDocument) {
ownerDocument = document;
}
if(supportsUnknownElements){
return ownerDocument.createDocumentFragment();
}
data = data || getExpandoData(ownerDocument);
var clone = data.frag.cloneNode(),
i = 0,
elems = getElements(),
l = elems.length;
for(;i<l;i++){
clone.createElement(elems[i]);
}
return clone;
}
function shivMethods(ownerDocument, data) {
if (!data.cache) {
data.cache = {};
data.createElem = ownerDocument.createElement;
data.createFrag = ownerDocument.createDocumentFragment;
data.frag = data.createFrag();
}
ownerDocument.createElement = function(nodeName) {
if (!html5.shivMethods) {
return data.createElem(nodeName);
}
return createElement(nodeName, ownerDocument, data);
};
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
'var n=f.cloneNode(),c=n.createElement;' +
'h.shivMethods&&(' +
getElements().join().replace(/[\w\-]+/g, function(nodeName) {
data.createElem(nodeName);
data.frag.createElement(nodeName);
return 'c("' + nodeName + '")';
}) +
');return n}'
)(html5, data.frag);
}
function shivDocument(ownerDocument) {
if (!ownerDocument) {
ownerDocument = document;
}
var data = getExpandoData(ownerDocument);
if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
data.hasCSS = !!addStyleSheet(ownerDocument,
'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
'mark{background:#FF0;color:#000}' +
'template{display:none}'
);
}
if (!supportsUnknownElements) {
shivMethods(ownerDocument, data);
}
return ownerDocument;
}
var html5 = {
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video',
'version': version,
'shivCSS': (options.shivCSS !== false),
'supportsUnknownElements': supportsUnknownElements,
'shivMethods': (options.shivMethods !== false),
'type': 'default',
'shivDocument': shivDocument,
createElement: createElement,
createDocumentFragment: createDocumentFragment
};
window.html5 = html5;
shivDocument(document);
}(this, document));
Modernizr._version = version;
Modernizr._prefixes = prefixes;
Modernizr._domPrefixes = domPrefixes;
Modernizr._cssomPrefixes = cssomPrefixes;
Modernizr.testProp = function(prop){
return testProps([prop]);
};
Modernizr.testAllProps = testPropsAll;
Modernizr.prefixed = function(prop, obj, elem){
if(!obj) {
return testPropsAll(prop, 'pfx');
} else {
return testPropsAll(prop, obj, elem);
}
};
return Modernizr;
})(this, this.document);
;
if(window.console){
console.log('webshim no longer depends on Modernizr. You can still use for feature detection of course.');
}

View File

@ -16,7 +16,7 @@
factory = function(){return window.webshims;};
}
};
window.webshims = {
setOptions: function(){
@ -37,7 +37,7 @@
window.asyncWebshims.polyfill = features;
},
_curScript: (function(){
var scripts, i, scriptUrl;
var scripts, i, scriptUrl, match, regUrl;
//modern browsers: Chrome 29+, Firefox 4+
var currentScript = document.currentScript;
@ -53,8 +53,17 @@
} catch (e) {
//Safari has sourceURL
scriptUrl = (e.sourceURL || e.stack || '').split('\n');
//extract scriptUrl from stack: this is dangerous! All browsers have different string patterns (pattern can even vary between different browser versions). Help to make it bulletproof!!!
scriptUrl = ((scriptUrl[scriptUrl.length - 1] || scriptUrl[scriptUrl.length - 2] || '').match(/(?:fil|htt|wid|abo|app|res)(.)+/i) || [''])[0].replace(/[\:\s\(]+[\d\:\)\(\s]+$/, '');
regUrl = /(?:fil|htt|wid|abo|app|res)(.)+/i;
for(i = 0; i < scriptUrl.length; i++){
//extract scriptUrl from stack: this is dangerous! All browsers have different string patterns (pattern can even vary between different browser versions). Help to make it bulletproof!!!
if((match = scriptUrl[i].match(regUrl))){
scriptUrl = match[0].replace(/[\:\s\(]+[\d\:\)\(\s]+$/, '');
break;
}
}
}
scripts = document.scripts || document.getElementsByTagName('script');
@ -127,7 +136,7 @@
}
$.extend(webshims, {
version: '1.14.6',
version: '1.15.2',
cfg: {
enhanceAuto: window.Audio && (!window.matchMedia || matchMedia('(min-device-width: 721px)').matches),
@ -139,15 +148,7 @@
wspopover: {appendTo: 'auto', hideOnBlur: true},
ajax: {},
loadScript: function(src, success){
if(!$.ajax || !$.ajaxSettings.xhr){
if(window.yepnope){
yepnope.injectJs(src, success);
} else if(window.require){
require([src], success);
}
} else {
$.ajax($.extend({}, webCFG.ajax, {url: src, success: success, dataType: 'script', cache: true, global: false, dataFilter: addSource}));
}
$.ajax($.extend({}, webCFG.ajax, {url: src, success: success, dataType: 'script', cache: true, global: false, dataFilter: addSource}));
},
basePath: path
},
@ -166,20 +167,6 @@
$.extend(true, webCFG, name);
}
},
getLazyFn: function(fn, modules){
var load = function(){
loadList(modules);
};
onReady('WINDOWLOAD', load);
return function(){
var args = arguments;
var obj = this;
load();
onReady(modules, function(){
obj[fn].apply(obj, args);
});
};
},
_getAutoEnhance: getAutoEnhance,
addPolyfill: function(name, cfg){
cfg = cfg || {};
@ -192,7 +179,7 @@
webshimsFeatures[feature].push(name);
cfg.options = $.extend(webCFG[feature], cfg.options);
addModule(name, cfg);
if (cfg.methodNames) {
$.each(cfg.methodNames, function(i, methodName){
@ -207,11 +194,11 @@
features = webshims.featureList;
WSDEBUG && webshims.warn('loading all features without specifing might be bad for performance');
}
if (typeof features == 'string') {
features = features.split(' ');
}
if(WSDEBUG){
for(var i = 0; i < features.length; i++){
if(loaded[features[i]]){
@ -233,7 +220,7 @@
if(hasFormsExt && $.inArray('forms', features) == -1){
features.push('forms');
if(WSDEBUG){
webshims.error('need to load forms feature to use forms-ext feature.');
webshims.warn('need to load forms feature to use forms-ext feature.');
}
}
if(webCFG.loadStyles){
@ -241,14 +228,14 @@
}
}
if (webCFG.waitReady) {
$.readyWait++;
onReady(features, function(){
$.ready(true);
});
}
$.each(features, function(i, feature){
feature = featureAlias[feature] || feature;
@ -280,7 +267,7 @@
}
});
},
/*
* handle ready modules
*/
@ -294,7 +281,7 @@
delete special[readyName];
}
webshimsFeatures[module.f];
resList.push(name);
}
};
@ -308,13 +295,13 @@
};
})(),
isReady: function(name, _set){
name = name + 'Ready';
if (_set) {
if (special[name] && special[name].add) {
return true;
}
special[name] = $.extend(special[name] || {}, {
add: function(details){
details.handler.call(this, name);
@ -329,7 +316,7 @@
if (typeof events == 'string') {
events = events.split(' ');
}
if (!_created) {
events = $.map($.grep(events, function(evt){
return !isReady(evt);
@ -344,15 +331,15 @@
var readyEv = events.shift(), readyFn = function(){
onReady(events, fn, true);
};
$(document).one(readyEv, readyFn);
},
/*
* basic DOM-/jQuery-Helpers
*/
capturingEvents: function(names, _maybePrevented){
if (!document.addEventListener) {
return;
@ -398,14 +385,14 @@
} else {
ready();
}
},
c: {},
/*
* loader
*/
loader: {
addModule: function(name, ext){
modules[name] = ext;
ext.name = ext.name || name;
@ -420,7 +407,7 @@
});
},
loadList: (function(){
var loadedModules = [];
var loadScript = function(src, names){
if (typeof names == 'string') {
@ -429,7 +416,7 @@
$.merge(loadedModules, names);
loader.loadScript(src, false, names);
};
var noNeedToLoad = function(name, list){
if (isReady(name) || $.inArray(name, loadedModules) != -1) {
return true;
@ -447,7 +434,7 @@
}
return true;
};
var setDependencies = function(module, list){
if (module.d && module.d.length) {
var addDependency = function(i, dependency){
@ -461,7 +448,7 @@
addDependency(i, dependency);
}
}
else
else
if (webshimsFeatures[dependency]) {
$.each(webshimsFeatures[dependency], addDependency);
onReady(webshimsFeatures[dependency], function(){
@ -474,7 +461,7 @@
}
}
};
return function(list){
var module;
var loadCombos = [];
@ -494,7 +481,7 @@
return false;
}
};
//length of list is dynamically
for (i = 0; i < list.length; i++) {
module = modules[list[i]];
@ -507,24 +494,24 @@
if (module.css && webCFG.loadStyles) {
loader.loadCSS(module.css);
}
if (module.loadInit) {
module.loadInit();
}
setDependencies(module, list);
if(!module.loaded){
loadCombos.push(module.name);
}
module.loaded = true;
}
for(i = 0, len = loadCombos.length; i < len; i++){
foundCombo = false;
module = loadCombos[i];
if($.inArray(module, loadedModules) == -1){
if(webCFG.debug != 'noCombo'){
$.each(modules[module].c, loadCombo);
@ -536,12 +523,12 @@
}
};
})(),
makePath: function(src){
if (src.indexOf('//') != -1 || src.indexOf('/') === 0) {
return src;
}
if (src.indexOf('.') == -1) {
src += '.js';
}
@ -550,7 +537,7 @@
}
return webCFG.basePath + src;
},
loadCSS: (function(){
var parent, loadedSrcs = {};
return function(src){
@ -565,7 +552,7 @@
});
};
})(),
loadScript: (function(){
var loadedSrcs = {};
return function(src, callback, name, noShimPath){
@ -574,11 +561,11 @@
}
if (loadedSrcs[src]) {return;}
var complete = function(){
if (callback) {
callback();
}
if (name) {
if (typeof name == 'string') {
name = name.split(' ');
@ -592,22 +579,22 @@
}
isReady(!modules[name].noAutoCallback ? name : name + 'FileLoaded', true);
});
}
};
loadedSrcs[src] = 1;
webCFG.loadScript(src, complete, $.noop);
};
})()
}
});
/*
* shortcuts
*/
var webCFG = webshims.cfg;
var webshimsFeatures = webshims.features;
var isReady = webshims.isReady;
@ -625,7 +612,7 @@
};
var $fn = $.fn;
var video = create('video');
webshims.addMethodName = function(name){
name = name.split(':');
var prop = name[1];
@ -635,7 +622,7 @@
} else {
name = name[0];
}
$fn[name] = function(){
return this.callProp(prop, arguments);
};
@ -644,11 +631,11 @@
$fn.callProp = function(prop, args){
var ret;
if(!args){
args = [];
args = [];
}
this.each(function(){
var fn = $.prop(this, prop);
if (fn && fn.apply) {
ret = fn.apply(this, args);
if (ret !== undefined) {
@ -660,8 +647,8 @@
});
return (ret !== undefined) ? ret : this;
};
webshims.activeLang = (function(){
@ -687,7 +674,7 @@
return curLang;
};
})();
webshims.errorLog = [];
$.each(['log', 'error', 'warn', 'info'], function(i, fn){
webshims[fn] = function(message){
@ -705,21 +692,21 @@
webshims.error('Could not detect currentScript! Use basePath to set script path.');
}
}
/*
* jQuery-plugins for triggering dom updates can be also very usefull in conjunction with non-HTML5 DOM-Changes (AJAX)
* Example:
* $.webshims.addReady(function(context, insertedElement){
* webshim.addReady(function(context, insertedElement){
* $('div.tabs', context).add(insertedElement.filter('div.tabs')).tabs();
* });
*
*
* $.ajax({
* success: function(html){
* $('#main').htmlPolyfill(html);
* }
* });
*/
(function(){
//Overwrite DOM-Ready and implement a new ready-method
$.isDOMReady = $.isReady;
@ -731,10 +718,10 @@
isReady('WINDOWLOAD', true);
}, 9999);
};
firstRun = function(){
if(!firstRun.run){
if(webCFG.debug || (!('crossDomain' in webCFG.ajax) && location.protocol.indexOf('http'))){
webCFG.ajax.crossDomain = true;
}
@ -750,11 +737,11 @@
webshims.error('in a jQuery mobile enviroment: you should change the waitReady to false.')
}
}
if (WSDEBUG && webCFG.waitReady && $.isReady) {
webshims.warn('Call webshims.polyfill before DOM-Ready or set waitReady to false.');
}
if(!$.isDOMReady && webCFG.waitReady){
var $Ready = $.ready;
$.ready = function(unwait){
@ -780,7 +767,7 @@
isReady('WINDOWLOAD', true);
}, 9);
});
var readyFns = [];
var eachTrigger = function(){
if(this.nodeType == 1){
@ -828,11 +815,11 @@
}
return ret;
};
$fn.jProp = function(){
return this.pushStack($($fn.prop.apply(this, arguments) || []));
};
$.each(['after', 'before', 'append', 'prepend', 'replaceWith'], function(i, name){
$fn[name+'Polyfill'] = function(a){
a = $(a);
@ -842,9 +829,9 @@
}
return this;
};
});
$.each(['insertAfter', 'insertBefore', 'appendTo', 'prependTo', 'replaceAll'], function(i, name){
$fn[name.replace(/[A-Z]/, function(c){return "Polyfill"+c;})] = function(){
$fn[name].apply(this, arguments);
@ -854,23 +841,23 @@
return this;
};
});
$fn.updatePolyfill = function(){
if($.isDOMReady){
webshims.triggerDomUpdate(this);
}
return this;
};
$.each(['getNativeElement', 'getShadowElement', 'getShadowFocusElement'], function(i, name){
$fn[name] = function(){
return this.pushStack(this);
};
});
})();
if(WSDEBUG){
webCFG.debug = true;
}
@ -891,18 +878,18 @@
return o;
};
}
/*
* Start Features
* Start Features
*/
/* general modules */
/* change path $.webshims.modules[moduleName].src */
addModule('swfmini', {
test: function(){
if(window.swfobject && !window.swfmini){
@ -913,19 +900,18 @@
c: [16, 7, 2, 8, 1, 12, 23]
});
modules.swfmini.test();
addModule('sizzle', {test: $.expr.filters});
addModule('jajax', {test: $.ajax && $.ajaxSettings.xhr});
/*
* polyfill-Modules
/*
* polyfill-Modules
*/
// webshims lib uses a of http://github.com/kriskowal/es5-shim/ to implement
addPolyfill('es5', {
test: !!(support.ES5 && Function.prototype.bind),
d: ['sizzle']
});
addPolyfill('dom-extend', {
f: DOMSUPPORT,
noAutoCallback: true,
@ -952,15 +938,22 @@
});
//>
//<sticky
addPolyfill('sticky', {
test: (($(create('b')).attr('style', 'position: -webkit-sticky; position: sticky').css('position') || '').indexOf('sticky') != -1),
d: ['es5', 'matchMedia']
});
//>
//<es6
addPolyfill('es6', {
test: !!(Math.imul && Number.MIN_SAFE_INTEGER && Object.is && window.Promise && Promise.all),// && window.Map && Map.prototype && typeof Map.prototype.forEach !== 'function' && window.Set
d: ['es5']
});
//>
//<geolocation
addPolyfill('geolocation', {
test: 'geolocation' in navigator,
options: {
@ -976,17 +969,17 @@
addPolyfill('usermedia-core', {
f: 'usermedia',
test: userMediaTest,
d: [DOMSUPPORT]
test: userMediaTest && window.URL,
d: ['url', DOMSUPPORT]
});
addPolyfill('usermedia-shim', {
f: 'usermedia',
test: !!(userMediaTest || navigator.webkitGetUserMedia || navigator.mozGetUserMedia),
test: !!(userMediaTest || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia),
d: ['url', 'mediaelement', DOMSUPPORT]
});
//>
//<canvas
(function(){
addPolyfill('canvas', {
@ -994,7 +987,7 @@
test: ('getContext' in create('canvas')),
options: {type: 'flash'}, //excanvas | flash | flashpro
noAutoCallback: true,
loadInit: function(){
var type = this.options.type;
if(type && type.indexOf('flash') !== -1 && (!modules.swfmini.test() || swfmini.hasFlashPlayerVersion('9.0.0'))){
@ -1006,8 +999,8 @@
});
})();
//>
//<forms
(function(){
var formExtend, formOptions;
@ -1092,13 +1085,13 @@
webshims.validationMessages = webshims.validityMessages = {
langSrc: 'i18n/formcfg-',
langSrc: 'i18n/formcfg-',
availableLangs: "ar cs el es fa fr he hi hu it ja lt nl pl pt pt-BR pt-PT ru sv zh-CN zh-TW".split(' ')
};
webshims.formcfg = $.extend({}, webshims.validationMessages);
webshims.inputTypes = {};
addPolyfill('form-core', {
f: 'forms',
d: ['es5'],
@ -1124,9 +1117,9 @@
methodNames: ['setCustomValidity', 'checkValidity', 'setSelectionRange'],
c: [16, 7, 2, 8, 1, 15, 30, 3, 31]
});
formOptions = webCFG.forms;
addPolyfill('form-native-extend', {
f: 'forms',
test: function(toLoad){
@ -1136,7 +1129,7 @@
d: ['form-core', DOMSUPPORT, 'form-message'],
c: [6, 5, 14, 29]
});
addPolyfill(fShim, {
f: 'forms',
test: function(){
@ -1146,7 +1139,7 @@
d: ['form-core', DOMSUPPORT, 'sizzle'],
c: [16, 15, 28]
});
addPolyfill(fShim+'2', {
f: 'forms',
test: function(){
@ -1156,7 +1149,7 @@
d: [fShim],
c: [27]
});
addPolyfill('form-message', {
f: 'forms',
test: function(toLoad){
@ -1187,7 +1180,7 @@
d: ['forms', DOMSUPPORT],
c: [6, 5, 17, 14, 28, 29, 33]
});
addModule('range-ui', {
options: {},
noAutoCallback: true,
@ -1197,7 +1190,7 @@
d: ['es5'],
c: [6, 5, 9, 10, 17, 11]
});
addPolyfill('form-number-date-ui', {
f: 'forms-ext',
test: function(){
@ -1219,7 +1212,7 @@
},
c: [6, 5, 9, 10, 17, 11]
});
addPolyfill('form-datalist', {
f: 'forms',
test: function(){
@ -1234,19 +1227,32 @@
});
})();
//>
//<filereader
webshim.loader.addModule('moxie', {
src: 'moxie/js/moxie',
c: [26]
var supportFileReader = 'FileReader' in window && 'FormData' in window;
addPolyfill('filereader-xhr', {
f: 'filereader',
test: supportFileReader,
d: [DOMSUPPORT, 'swfmini'],
c: [25, 27]
});
addPolyfill('filereader', {
test: 'FileReader' in window && 'FormData' in window,
d: [DOMSUPPORT, 'jajax'],
c: [25, 26, 27]
addPolyfill('canvas-blob', {
f: 'filereader',
methodNames: ['toBlob'],
test: !(supportFileReader && !create('canvas').toBlob)
});
//>
/*
//<mediacapture
addPolyfill('mediacapture', {
test: 'capture' in create('input'),
d: ['swfmini', 'usermedia', DOMSUPPORT, 'filereader', 'forms', 'canvas']
});
//>
*/
//<details
addPolyfill('details', {
test: ('open' in create('details')),
@ -1306,7 +1312,7 @@
c: [16, 7, 2, 8, 1, 12, 13, 23]
});
addPolyfill('mediaelement-jaris', {
f: 'mediaelement',
d: ['mediaelement-core', DOMSUPPORT],
@ -1360,18 +1366,18 @@
addModule('track-ui', {
d: ['track', DOMSUPPORT]
});
})();
//>
//>removeCombos<
addPolyfill('feature-dummy', {
test: true,
loaded: true,
c: removeCombos
});
webshims.$ = $;
$.webshims = webshims;
$.webshim = webshim;

View File

@ -0,0 +1,97 @@
/*
* JavaScript Canvas to Blob 2.0.5
* https://github.com/blueimp/JavaScript-Canvas-to-Blob
*
* Copyright 2012, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*
* Based on stackoverflow user Stoive's code snippet:
* http://stackoverflow.com/q/4998908
*/
/*jslint nomen: true, regexp: true */
/*global window, atob, Blob, ArrayBuffer, Uint8Array, define */
(function (window) {
'use strict';
var CanvasPrototype = window.HTMLCanvasElement &&
window.HTMLCanvasElement.prototype,
hasBlobConstructor = window.Blob && (function () {
try {
return Boolean(new Blob());
} catch (e) {
return false;
}
}()),
hasArrayBufferViewSupport = hasBlobConstructor && window.Uint8Array &&
(function () {
try {
return new Blob([new Uint8Array(100)]).size === 100;
} catch (e) {
return false;
}
}()),
BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder ||
window.MozBlobBuilder || window.MSBlobBuilder,
dataURLtoBlob = (hasBlobConstructor || BlobBuilder) && window.atob &&
window.ArrayBuffer && window.Uint8Array && function (dataURI) {
var byteString,
arrayBuffer,
intArray,
i,
mimeString,
bb;
if (dataURI.split(',')[0].indexOf('base64') >= 0) {
// Convert base64 to raw binary data held in a string:
byteString = atob(dataURI.split(',')[1]);
} else {
// Convert base64/URLEncoded data component to raw binary data:
byteString = decodeURIComponent(dataURI.split(',')[1]);
}
// Write the bytes of the string to an ArrayBuffer:
arrayBuffer = new ArrayBuffer(byteString.length);
intArray = new Uint8Array(arrayBuffer);
for (i = 0; i < byteString.length; i += 1) {
intArray[i] = byteString.charCodeAt(i);
}
// Separate out the mime component:
mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
// Write the ArrayBuffer (or ArrayBufferView) to a blob:
if (hasBlobConstructor) {
return new Blob(
[hasArrayBufferViewSupport ? intArray : arrayBuffer],
{type: mimeString}
);
}
bb = new BlobBuilder();
bb.append(arrayBuffer);
return bb.getBlob(mimeString);
};
if (window.HTMLCanvasElement && !CanvasPrototype.toBlob) {
if (CanvasPrototype.mozGetAsFile) {
CanvasPrototype.toBlob = function (callback, type, quality) {
if (quality && CanvasPrototype.toDataURL && dataURLtoBlob) {
callback(dataURLtoBlob(this.toDataURL(type, quality)));
} else {
callback(this.mozGetAsFile('blob', type));
}
};
} else if (CanvasPrototype.toDataURL && dataURLtoBlob) {
CanvasPrototype.toBlob = function (callback, type, quality) {
callback(dataURLtoBlob(this.toDataURL(type, quality)));
};
}
}
if (typeof define === 'function' && define.amd) {
define(function () {
return dataURLtoBlob;
});
} else {
window.dataURLtoBlob = dataURLtoBlob;
}
}(this));
webshim.isReady('canvas-blob', true);

View File

@ -524,20 +524,6 @@ webshims.isReady('swfmini', true);
}
});
$(function(){
var fileReaderReady = ('FileReader' in window && 'FormData' in window);
if(!fileReaderReady){
webshims.addReady(function(context){
if(!fileReaderReady && !modules.filereader.loaded && !modules.moxie.loaded){
if(context.querySelector('input.ws-filereader')){
webshims.reTest(['filereader', 'moxie']);
fileReaderReady = true;
}
}
});
}
});
if(options.addValidators && options.fastValidators){
webshims.reTest(['form-validators', 'form-validation']);
}
@ -606,9 +592,16 @@ webshims.isReady('swfmini', true);
})();
}
if(window.CanvasRenderingContext2D && CanvasRenderingContext2D.prototype){
CanvasRenderingContext2D.prototype.wsImageComplete = function(cb){
cb.call(this, this);
};
}
webshims.register('mediaelement-core', function($, webshims, window, document, undefined, options){
var hasSwf = swfmini.hasFlashPlayerVersion('11.3');
var mediaelement = webshims.mediaelement;
var allowYtLoading = false;
mediaelement.parseRtmp = function(data){
var src = data.src.split('://');
@ -704,7 +697,9 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
return function(){
if(loaded || !hasYt){return;}
loaded = true;
webshims.loader.loadScript("https://www.youtube.com/player_api");
if(allowYtLoading){
webshims.loader.loadScript("https://www.youtube.com/player_api");
}
$(function(){
webshims._polyfill(["mediaelement-yt"]);
});
@ -890,6 +885,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
}
});
if(!requested && hasYt && !mediaelement.createSWF){
allowYtLoading = true;
loadYt();
}
};
@ -1054,6 +1050,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
.add(insertedElement.filter('video, audio'))
.each(function(){
if(!mediaelement.canNativePlaySrces(this)){
allowYtLoading = true;
loadThird();
handleMedia = true;
return false;
@ -1076,6 +1073,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
mediaelement.loadDebugger();
});
}
//set native implementation ready, before swf api is retested
if(hasNative){
webshims.isReady('mediaelement-core', true);

View File

@ -64,11 +64,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.assumeARIA = true;
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
}
if('debug' in webshims){
webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
webshims.error("IE browser modes are busted in IE10+. Make sure to run IE in edge mode (X-UA-Compatible). Please test your HTML/CSS/JS with a real IE version or at least IETester or similar tools. ");
}
if (!webshims.cfg.no$Switch) {
@ -681,33 +677,37 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
},
handler: (function(){
var evt;
var trigger = function(){
$(document).triggerHandler('updateshadowdom');
$(document).triggerHandler('updateshadowdom', [evt]);
};
var timed = function(){
if(evt && evt.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
}
if(evt && evt.type != 'docresize'){
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
};
return function(e){
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if(e.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
}, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
evt = e;
resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
};
})(),
_create: function(){
@ -3045,7 +3045,8 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
(function(){
var picker = {};
var assumeVirtualKeyBoard = (window.Modernizr && (Modernizr.touchevents || Modernizr.touch)) || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase()));
var modern = window.Modernizr;
var assumeVirtualKeyBoard = (modern && (modern.touchevents || modern.touch)) || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase()));
webshims.inlinePopover = {
_create: function(){
this.element = $('<div class="ws-inline-picker"><div class="ws-po-box" /></div>').data('wspopover', this);

View File

@ -1814,7 +1814,8 @@
(function(){
var picker = {};
var assumeVirtualKeyBoard = (window.Modernizr && (Modernizr.touchevents || Modernizr.touch)) || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase()));
var modern = window.Modernizr;
var assumeVirtualKeyBoard = (modern && (modern.touchevents || modern.touch)) || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase()));
webshims.inlinePopover = {
_create: function(){
this.element = $('<div class="ws-inline-picker"><div class="ws-po-box" /></div>').data('wspopover', this);

View File

@ -281,9 +281,16 @@ webshims.isReady('swfmini', true);
})();
}
if(window.CanvasRenderingContext2D && CanvasRenderingContext2D.prototype){
CanvasRenderingContext2D.prototype.wsImageComplete = function(cb){
cb.call(this, this);
};
}
webshims.register('mediaelement-core', function($, webshims, window, document, undefined, options){
var hasSwf = swfmini.hasFlashPlayerVersion('11.3');
var mediaelement = webshims.mediaelement;
var allowYtLoading = false;
mediaelement.parseRtmp = function(data){
var src = data.src.split('://');
@ -379,7 +386,9 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
return function(){
if(loaded || !hasYt){return;}
loaded = true;
webshims.loader.loadScript("https://www.youtube.com/player_api");
if(allowYtLoading){
webshims.loader.loadScript("https://www.youtube.com/player_api");
}
$(function(){
webshims._polyfill(["mediaelement-yt"]);
});
@ -565,6 +574,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
}
});
if(!requested && hasYt && !mediaelement.createSWF){
allowYtLoading = true;
loadYt();
}
};
@ -729,6 +739,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
.add(insertedElement.filter('video, audio'))
.each(function(){
if(!mediaelement.canNativePlaySrces(this)){
allowYtLoading = true;
loadThird();
handleMedia = true;
return false;
@ -751,6 +762,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
mediaelement.loadDebugger();
});
}
//set native implementation ready, before swf api is retested
if(hasNative){
webshims.isReady('mediaelement-core', true);
@ -835,8 +847,12 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
var lastCue = this.cues[this.cues.length-1];
if(lastCue && lastCue.startTime > cue.startTime){
webshims.error("cue startTime higher than previous cue's startTime");
return;
}
}
if(cue.startTime >= cue.endTime ){
webshim.error('startTime >= endTime of cue: '+ cue.text);
}
if(cue.track && cue.track.removeCue){
cue.track.removeCue(cue);
}
@ -928,6 +944,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
for(i = 0, len = added.length; i < len; i++){
$([trackList]).triggerHandler($.Event({type: 'addtrack', track: added[i]}));
}
//todo: remove
if(baseData.scriptedTextTracks || removed.length){
$(this).triggerHandler('updatetrackdisplay');
}
@ -944,7 +961,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
setTimeout(function(){
$(track).closest('audio, video').triggerHandler('updatetrackdisplay');
trackData.isTriggering = false;
}, 1);
}, 9);
}
};
var isDefaultTrack = (function(){
@ -1137,15 +1154,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
error: error
});
};
if($.ajax && $.ajaxSettings.xhr){
if(isDisabled){
setTimeout(createAjax, loadingTracks * 2);
} else {
createAjax();
}
if(isDisabled){
setTimeout(createAjax, loadingTracks * 2);
} else {
webshims.ready('jajax', createAjax);
webshims.loader.loadList(['jajax']);
createAjax();
}
} catch(er){
error();

View File

@ -58,9 +58,16 @@
})();
}
if(window.CanvasRenderingContext2D && CanvasRenderingContext2D.prototype){
CanvasRenderingContext2D.prototype.wsImageComplete = function(cb){
cb.call(this, this);
};
}
webshims.register('mediaelement-core', function($, webshims, window, document, undefined, options){
var hasSwf = swfmini.hasFlashPlayerVersion('11.3');
var mediaelement = webshims.mediaelement;
var allowYtLoading = false;
mediaelement.parseRtmp = function(data){
var src = data.src.split('://');
@ -156,7 +163,9 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
return function(){
if(loaded || !hasYt){return;}
loaded = true;
webshims.loader.loadScript("https://www.youtube.com/player_api");
if(allowYtLoading){
webshims.loader.loadScript("https://www.youtube.com/player_api");
}
$(function(){
webshims._polyfill(["mediaelement-yt"]);
});
@ -342,6 +351,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
}
});
if(!requested && hasYt && !mediaelement.createSWF){
allowYtLoading = true;
loadYt();
}
};
@ -506,6 +516,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
.add(insertedElement.filter('video, audio'))
.each(function(){
if(!mediaelement.canNativePlaySrces(this)){
allowYtLoading = true;
loadThird();
handleMedia = true;
return false;
@ -528,6 +539,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
mediaelement.loadDebugger();
});
}
//set native implementation ready, before swf api is retested
if(hasNative){
webshims.isReady('mediaelement-core', true);
@ -612,8 +624,12 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
var lastCue = this.cues[this.cues.length-1];
if(lastCue && lastCue.startTime > cue.startTime){
webshims.error("cue startTime higher than previous cue's startTime");
return;
}
}
if(cue.startTime >= cue.endTime ){
webshim.error('startTime >= endTime of cue: '+ cue.text);
}
if(cue.track && cue.track.removeCue){
cue.track.removeCue(cue);
}
@ -705,6 +721,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
for(i = 0, len = added.length; i < len; i++){
$([trackList]).triggerHandler($.Event({type: 'addtrack', track: added[i]}));
}
//todo: remove
if(baseData.scriptedTextTracks || removed.length){
$(this).triggerHandler('updatetrackdisplay');
}
@ -721,7 +738,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
setTimeout(function(){
$(track).closest('audio, video').triggerHandler('updatetrackdisplay');
trackData.isTriggering = false;
}, 1);
}, 9);
}
};
var isDefaultTrack = (function(){
@ -914,15 +931,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
error: error
});
};
if($.ajax && $.ajaxSettings.xhr){
if(isDisabled){
setTimeout(createAjax, loadingTracks * 2);
} else {
createAjax();
}
if(isDisabled){
setTimeout(createAjax, loadingTracks * 2);
} else {
webshims.ready('jajax', createAjax);
webshims.loader.loadList(['jajax']);
createAjax();
}
} catch(er){
error();

View File

@ -64,11 +64,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.assumeARIA = true;
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
}
if('debug' in webshims){
webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
webshims.error("IE browser modes are busted in IE10+. Make sure to run IE in edge mode (X-UA-Compatible). Please test your HTML/CSS/JS with a real IE version or at least IETester or similar tools. ");
}
if (!webshims.cfg.no$Switch) {
@ -681,33 +677,37 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
},
handler: (function(){
var evt;
var trigger = function(){
$(document).triggerHandler('updateshadowdom');
$(document).triggerHandler('updateshadowdom', [evt]);
};
var timed = function(){
if(evt && evt.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
}
if(evt && evt.type != 'docresize'){
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
};
return function(e){
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if(e.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
}, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
evt = e;
resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
};
})(),
_create: function(){
@ -1532,20 +1532,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
});
$(function(){
var fileReaderReady = ('FileReader' in window && 'FormData' in window);
if(!fileReaderReady){
webshims.addReady(function(context){
if(!fileReaderReady && !modules.filereader.loaded && !modules.moxie.loaded){
if(context.querySelector('input.ws-filereader')){
webshims.reTest(['filereader', 'moxie']);
fileReaderReady = true;
}
}
});
}
});
if(options.addValidators && options.fastValidators){
webshims.reTest(['form-validators', 'form-validation']);
}
@ -1653,7 +1639,6 @@ var isPlaceholderOptionSelected = function(select){
};
var emptyJ = $([]);
//TODO: cache + perftest
var getGroupElements = function(elem){
elem = $(elem);
var name, form;
@ -1723,7 +1708,7 @@ var validityRules = {
$.each({tooShort: ['minLength', -1], tooLong: ['maxLength', 1]}, function(name, props){
validityRules[name] = function(input, val, cache){
//defaultValue is not the same as dirty flag, but very similiar
if(cache.nodeName == 'select' || input.prop('defaultValue') == val){return false;}
if(!val || cache.nodeName == 'select' || input.prop('defaultValue') == val){return false;}
cacheType(cache, input[0]);

View File

@ -287,11 +287,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.assumeARIA = true;
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
}
if('debug' in webshims){
webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
webshims.error("IE browser modes are busted in IE10+. Make sure to run IE in edge mode (X-UA-Compatible). Please test your HTML/CSS/JS with a real IE version or at least IETester or similar tools. ");
}
if (!webshims.cfg.no$Switch) {
@ -904,33 +900,37 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
},
handler: (function(){
var evt;
var trigger = function(){
$(document).triggerHandler('updateshadowdom');
$(document).triggerHandler('updateshadowdom', [evt]);
};
var timed = function(){
if(evt && evt.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
}
if(evt && evt.type != 'docresize'){
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
};
return function(e){
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if(e.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
}, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
evt = e;
resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
};
})(),
_create: function(){
@ -1755,20 +1755,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
});
$(function(){
var fileReaderReady = ('FileReader' in window && 'FormData' in window);
if(!fileReaderReady){
webshims.addReady(function(context){
if(!fileReaderReady && !modules.filereader.loaded && !modules.moxie.loaded){
if(context.querySelector('input.ws-filereader')){
webshims.reTest(['filereader', 'moxie']);
fileReaderReady = true;
}
}
});
}
});
if(options.addValidators && options.fastValidators){
webshims.reTest(['form-validators', 'form-validation']);
}
@ -1876,7 +1862,6 @@ var isPlaceholderOptionSelected = function(select){
};
var emptyJ = $([]);
//TODO: cache + perftest
var getGroupElements = function(elem){
elem = $(elem);
var name, form;
@ -1946,7 +1931,7 @@ var validityRules = {
$.each({tooShort: ['minLength', -1], tooLong: ['maxLength', 1]}, function(name, props){
validityRules[name] = function(input, val, cache){
//defaultValue is not the same as dirty flag, but very similiar
if(cache.nodeName == 'select' || input.prop('defaultValue') == val){return false;}
if(!val || cache.nodeName == 'select' || input.prop('defaultValue') == val){return false;}
cacheType(cache, input[0]);
@ -3253,9 +3238,16 @@ webshims.defineNodeNamesProperties(['input', 'button'], formSubmitterDescriptors
})();
}
if(window.CanvasRenderingContext2D && CanvasRenderingContext2D.prototype){
CanvasRenderingContext2D.prototype.wsImageComplete = function(cb){
cb.call(this, this);
};
}
webshims.register('mediaelement-core', function($, webshims, window, document, undefined, options){
var hasSwf = swfmini.hasFlashPlayerVersion('11.3');
var mediaelement = webshims.mediaelement;
var allowYtLoading = false;
mediaelement.parseRtmp = function(data){
var src = data.src.split('://');
@ -3351,7 +3343,9 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
return function(){
if(loaded || !hasYt){return;}
loaded = true;
webshims.loader.loadScript("https://www.youtube.com/player_api");
if(allowYtLoading){
webshims.loader.loadScript("https://www.youtube.com/player_api");
}
$(function(){
webshims._polyfill(["mediaelement-yt"]);
});
@ -3537,6 +3531,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
}
});
if(!requested && hasYt && !mediaelement.createSWF){
allowYtLoading = true;
loadYt();
}
};
@ -3701,6 +3696,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
.add(insertedElement.filter('video, audio'))
.each(function(){
if(!mediaelement.canNativePlaySrces(this)){
allowYtLoading = true;
loadThird();
handleMedia = true;
return false;
@ -3723,6 +3719,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
mediaelement.loadDebugger();
});
}
//set native implementation ready, before swf api is retested
if(hasNative){
webshims.isReady('mediaelement-core', true);

View File

@ -2430,7 +2430,8 @@ webshims.register('form-number-date-api', function($, webshims, window, document
(function(){
var picker = {};
var assumeVirtualKeyBoard = (window.Modernizr && (Modernizr.touchevents || Modernizr.touch)) || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase()));
var modern = window.Modernizr;
var assumeVirtualKeyBoard = (modern && (modern.touchevents || modern.touch)) || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase()));
webshims.inlinePopover = {
_create: function(){
this.element = $('<div class="ws-inline-picker"><div class="ws-po-box" /></div>').data('wspopover', this);

View File

@ -287,11 +287,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.assumeARIA = true;
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
}
if('debug' in webshims){
webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
webshims.error("IE browser modes are busted in IE10+. Make sure to run IE in edge mode (X-UA-Compatible). Please test your HTML/CSS/JS with a real IE version or at least IETester or similar tools. ");
}
if (!webshims.cfg.no$Switch) {
@ -904,33 +900,37 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
},
handler: (function(){
var evt;
var trigger = function(){
$(document).triggerHandler('updateshadowdom');
$(document).triggerHandler('updateshadowdom', [evt]);
};
var timed = function(){
if(evt && evt.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
}
if(evt && evt.type != 'docresize'){
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
};
return function(e){
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if(e.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
}, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
evt = e;
resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
};
})(),
_create: function(){
@ -1755,20 +1755,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
});
$(function(){
var fileReaderReady = ('FileReader' in window && 'FormData' in window);
if(!fileReaderReady){
webshims.addReady(function(context){
if(!fileReaderReady && !modules.filereader.loaded && !modules.moxie.loaded){
if(context.querySelector('input.ws-filereader')){
webshims.reTest(['filereader', 'moxie']);
fileReaderReady = true;
}
}
});
}
});
if(options.addValidators && options.fastValidators){
webshims.reTest(['form-validators', 'form-validation']);
}
@ -2134,9 +2120,16 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
})();
}
if(window.CanvasRenderingContext2D && CanvasRenderingContext2D.prototype){
CanvasRenderingContext2D.prototype.wsImageComplete = function(cb){
cb.call(this, this);
};
}
webshims.register('mediaelement-core', function($, webshims, window, document, undefined, options){
var hasSwf = swfmini.hasFlashPlayerVersion('11.3');
var mediaelement = webshims.mediaelement;
var allowYtLoading = false;
mediaelement.parseRtmp = function(data){
var src = data.src.split('://');
@ -2232,7 +2225,9 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
return function(){
if(loaded || !hasYt){return;}
loaded = true;
webshims.loader.loadScript("https://www.youtube.com/player_api");
if(allowYtLoading){
webshims.loader.loadScript("https://www.youtube.com/player_api");
}
$(function(){
webshims._polyfill(["mediaelement-yt"]);
});
@ -2418,6 +2413,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
}
});
if(!requested && hasYt && !mediaelement.createSWF){
allowYtLoading = true;
loadYt();
}
};
@ -2582,6 +2578,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
.add(insertedElement.filter('video, audio'))
.each(function(){
if(!mediaelement.canNativePlaySrces(this)){
allowYtLoading = true;
loadThird();
handleMedia = true;
return false;
@ -2604,6 +2601,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
mediaelement.loadDebugger();
});
}
//set native implementation ready, before swf api is retested
if(hasNative){
webshims.isReady('mediaelement-core', true);

View File

@ -92,52 +92,46 @@
}
return;
}
createAjax = function(){
$.ajax({
url: 'http://freegeoip.net/json/',
dataType: 'jsonp',
cache: true,
jsonp: 'callback',
success: function(data){
locationAPIs--;
if(!data){return;}
pos = pos || {
coords: {
latitude: data.latitude,
longitude: data.longitude,
altitude: null,
accuracy: 43000,
altitudeAccuracy: null,
heading: parseInt('NaN', 10),
velocity: null
},
//extension similiar to FF implementation
address: {
city: data.city,
country: data.country_name,
countryCode: data.country_code,
county: "",
postalCode: data.zipcode,
premises: "",
region: data.region_name,
street: "",
streetNumber: ""
}
};
endCallback();
},
error: function(){
locationAPIs--;
endCallback();
}
});
};
if($.ajax){
createAjax();
} else {
webshims.ready('jajax', createAjax);
webshims.loader.loadList(['jajax']);
}
$.ajax({
url: 'http://freegeoip.net/json/',
dataType: 'jsonp',
cache: true,
jsonp: 'callback',
success: function(data){
locationAPIs--;
if(!data){return;}
pos = pos || {
coords: {
latitude: data.latitude,
longitude: data.longitude,
altitude: null,
accuracy: 43000,
altitudeAccuracy: null,
heading: parseInt('NaN', 10),
velocity: null
},
//extension similiar to FF implementation
address: {
city: data.city,
country: data.country_name,
countryCode: data.country_code,
county: "",
postalCode: data.zipcode,
premises: "",
region: data.region_name,
street: "",
streetNumber: ""
}
};
endCallback();
},
error: function(){
locationAPIs--;
endCallback();
}
});
clearTimeout(googleTimer);
if (!window.google || !window.google.loader) {
googleTimer = setTimeout(function(){
@ -179,10 +173,7 @@
};
return api;
})());
webshims.ready('WINDOWLOAD', function(){
webshims.loader.loadList(['jajax']);
});
webshims.isReady('geolocation', true);
})(webshims.$);
;webshims.register('details', function($, webshims, window, doc, undefined, options){
@ -459,12 +450,13 @@
};
mediaelement.jarisEvent = {};
mediaelement.jarisEvent = mediaelement.jarisEvent || {};
var localConnectionTimer;
var onEvent = {
onPlayPause: function(jaris, data, override){
var playing, type;
var idled = data.paused || data.ended;
if(override == null){
try {
playing = data.api.api_get("isPlaying");
@ -478,12 +470,15 @@
type = data.paused ? 'pause' : 'play';
data._ppFlag = true;
trigger(data._elem, type);
}
if(!data.paused || playing == idled || playing == null){
if(data.readyState < 3){
setReadyState(3, data);
}
if(!data.paused){
trigger(data._elem, 'playing');
}
}
if(!data.paused){
trigger(data._elem, 'playing');
}
},
onSeek: function(jaris, data){
@ -1235,11 +1230,11 @@
options.changeSWF(vars, elem, canPlaySrc, data, 'embed');
clearTimeout(data.flashBlock);
swfmini.embedSWF(playerSwfPath, elemId, "100%", "100%", "9.0.115", false, vars, params, attrs, function(swfData){
swfmini.embedSWF(playerSwfPath, elemId, "100%", "100%", "11.3", false, vars, params, attrs, function(swfData){
if(swfData.success){
var fBlocker = function(){
if((!swfData.ref.parentNode && box[0].parentNode) || swfData.ref.style.display == "none"){
box.addClass('flashblocker-assumed');
if((!swfData.ref.parentNode) || swfData.ref.style.display == "none"){
$(elem).trigger('flashblocker');
webshims.warn("flashblocker assumed");
}
@ -1473,8 +1468,19 @@
webshim.error('canvas.drawImage feature is needed. In IE8 flashvanvas pro can be used');
}
CanvasRenderingContext2D.prototype.wsImageComplete = function(cb){
if(this._wsIsLoading){
if(!this._wsLoadingCbs){
this._wsLoadingCbs = [];
}
this._wsLoadingCbs.push(cb);
} else {
cb.call(this, this);
}
};
CanvasRenderingContext2D.prototype.drawImage = function(elem){
var data, img, args, imgData;
var data, img, args, imgData, hadCachedImg;
var context = this;
if(isVideo[elem.nodeName] && (data = webshims.data(elem, 'mediaelement')) && data.isActive == 'third' && data.api.api_image){
@ -1492,18 +1498,39 @@
}
args = slice.call(arguments, 1);
img = new Image();
if(options.canvasSync && data.canvasImg){
args.unshift(data.canvasImg);
_drawImage.apply(context, args);
args = slice.call(arguments, 1);
hadCachedImg = true;
}
img = document.createElement('img');
//todo find a performant sync way
img.onload = function(){
args.unshift(this);
_drawImage.apply(context, args);
img.onload = null;
if(options.canvasSync){
data.canvasImg = img;
if(hadCachedImg && options.noDoubbleDraw){
return;
}
}
_drawImage.apply(context, args);
context._wsIsLoading = false;
if(context._wsLoadingCbs && context._wsLoadingCbs.length){
while(context._wsLoadingCbs.length){
context._wsLoadingCbs.shift().call(context, context);
}
}
};
img.src = 'data:image/jpeg;base64,'+imgData;
if(img.complete){
this._wsIsLoading = true;
if(img.complete && img.onload){
img.onload();
}
return;
@ -1737,8 +1764,12 @@
var lastCue = this.cues[this.cues.length-1];
if(lastCue && lastCue.startTime > cue.startTime){
webshims.error("cue startTime higher than previous cue's startTime");
return;
}
}
if(cue.startTime >= cue.endTime ){
webshim.error('startTime >= endTime of cue: '+ cue.text);
}
if(cue.track && cue.track.removeCue){
cue.track.removeCue(cue);
}
@ -1830,6 +1861,7 @@
for(i = 0, len = added.length; i < len; i++){
$([trackList]).triggerHandler($.Event({type: 'addtrack', track: added[i]}));
}
//todo: remove
if(baseData.scriptedTextTracks || removed.length){
$(this).triggerHandler('updatetrackdisplay');
}
@ -1846,7 +1878,7 @@
setTimeout(function(){
$(track).closest('audio, video').triggerHandler('updatetrackdisplay');
trackData.isTriggering = false;
}, 1);
}, 9);
}
};
var isDefaultTrack = (function(){
@ -2039,15 +2071,10 @@
error: error
});
};
if($.ajax && $.ajaxSettings.xhr){
if(isDisabled){
setTimeout(createAjax, loadingTracks * 2);
} else {
createAjax();
}
if(isDisabled){
setTimeout(createAjax, loadingTracks * 2);
} else {
webshims.ready('jajax', createAjax);
webshims.loader.loadList(['jajax']);
createAjax();
}
} catch(er){
error();

View File

@ -214,8 +214,12 @@ webshims.register('details', function($, webshims, window, doc, undefined, optio
var lastCue = this.cues[this.cues.length-1];
if(lastCue && lastCue.startTime > cue.startTime){
webshims.error("cue startTime higher than previous cue's startTime");
return;
}
}
if(cue.startTime >= cue.endTime ){
webshim.error('startTime >= endTime of cue: '+ cue.text);
}
if(cue.track && cue.track.removeCue){
cue.track.removeCue(cue);
}
@ -307,6 +311,7 @@ webshims.register('details', function($, webshims, window, doc, undefined, optio
for(i = 0, len = added.length; i < len; i++){
$([trackList]).triggerHandler($.Event({type: 'addtrack', track: added[i]}));
}
//todo: remove
if(baseData.scriptedTextTracks || removed.length){
$(this).triggerHandler('updatetrackdisplay');
}
@ -323,7 +328,7 @@ webshims.register('details', function($, webshims, window, doc, undefined, optio
setTimeout(function(){
$(track).closest('audio, video').triggerHandler('updatetrackdisplay');
trackData.isTriggering = false;
}, 1);
}, 9);
}
};
var isDefaultTrack = (function(){
@ -516,15 +521,10 @@ webshims.register('details', function($, webshims, window, doc, undefined, optio
error: error
});
};
if($.ajax && $.ajaxSettings.xhr){
if(isDisabled){
setTimeout(createAjax, loadingTracks * 2);
} else {
createAjax();
}
if(isDisabled){
setTimeout(createAjax, loadingTracks * 2);
} else {
webshims.ready('jajax', createAjax);
webshims.loader.loadList(['jajax']);
createAjax();
}
} catch(er){
error();

View File

@ -281,9 +281,16 @@ webshims.isReady('swfmini', true);
})();
}
if(window.CanvasRenderingContext2D && CanvasRenderingContext2D.prototype){
CanvasRenderingContext2D.prototype.wsImageComplete = function(cb){
cb.call(this, this);
};
}
webshims.register('mediaelement-core', function($, webshims, window, document, undefined, options){
var hasSwf = swfmini.hasFlashPlayerVersion('11.3');
var mediaelement = webshims.mediaelement;
var allowYtLoading = false;
mediaelement.parseRtmp = function(data){
var src = data.src.split('://');
@ -379,7 +386,9 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
return function(){
if(loaded || !hasYt){return;}
loaded = true;
webshims.loader.loadScript("https://www.youtube.com/player_api");
if(allowYtLoading){
webshims.loader.loadScript("https://www.youtube.com/player_api");
}
$(function(){
webshims._polyfill(["mediaelement-yt"]);
});
@ -565,6 +574,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
}
});
if(!requested && hasYt && !mediaelement.createSWF){
allowYtLoading = true;
loadYt();
}
};
@ -729,6 +739,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
.add(insertedElement.filter('video, audio'))
.each(function(){
if(!mediaelement.canNativePlaySrces(this)){
allowYtLoading = true;
loadThird();
handleMedia = true;
return false;
@ -751,6 +762,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
mediaelement.loadDebugger();
});
}
//set native implementation ready, before swf api is retested
if(hasNative){
webshims.isReady('mediaelement-core', true);

View File

@ -64,11 +64,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.assumeARIA = true;
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
}
if('debug' in webshims){
webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
webshims.error("IE browser modes are busted in IE10+. Make sure to run IE in edge mode (X-UA-Compatible). Please test your HTML/CSS/JS with a real IE version or at least IETester or similar tools. ");
}
if (!webshims.cfg.no$Switch) {
@ -681,33 +677,37 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
},
handler: (function(){
var evt;
var trigger = function(){
$(document).triggerHandler('updateshadowdom');
$(document).triggerHandler('updateshadowdom', [evt]);
};
var timed = function(){
if(evt && evt.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
}
if(evt && evt.type != 'docresize'){
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
};
return function(e){
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if(e.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
}, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
evt = e;
resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
};
})(),
_create: function(){
@ -1229,11 +1229,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
})();
});
;webshim.register('filereader', function($, webshim, window, document, undefined, featureOptions){
;webshim.register('filereader-xhr', function($, webshim, window, document, undefined, featureOptions){
"use strict";
var mOxie, moxie, hasXDomain;
var FormData = $.noop;
var sel = 'input[type="file"].ws-filereader';
var sel = 'input[type="file"].ws-filereader, input[type="file"].ws-capture';
var hasFlash = swfmini.hasFlashPlayerVersion('10.3');
var loadMoxie = function (){
webshim.loader.loadList(['moxie']);
};
@ -1345,7 +1345,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
);
var shimMoxiePath = webshim.cfg.basePath+'moxie/';
var crossXMLMessage = 'You nedd a crossdomain.xml to get all "filereader" / "XHR2" / "CORS" features to work. Or host moxie.swf/moxie.xap on your server an configure filereader options: "swfpath"/"xappath"';
var crossXMLMessage = 'You nedd a crossdomain.xml to get all "filereader" / "XHR2" / "CORS" features to work. Or host moxie.swf on your server an configure filereader options: "swfpath"';
var testMoxie = function(options){
return (options.wsType == 'moxie' || (options.data && options.data instanceof mOxie.FormData) || (options.crossDomain && $.support.cors !== false && hasXDomain != 'no' && !noxhr.test(options.dataType || '')));
};
@ -1528,6 +1528,10 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
};
webshim.loader.addModule('moxie', {
src: 'moxie/js/moxie-'+ (hasFlash ? 'swf' : 'html4')
});
if(!featureOptions.progress){
featureOptions.progress = 'onprogress';
}
@ -1539,9 +1543,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
if(!featureOptions.swfpath){
featureOptions.swfpath = shimMoxiePath+'flash/Moxie.min.swf';
}
if(!featureOptions.xappath){
featureOptions.xappath = shimMoxiePath+'silverlight/Moxie.min.xap';
}
if($.support.cors !== false || !window.XDomainRequest){
delete transports.xdomain;
@ -1568,8 +1569,8 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
writeable: false,
get: function(){
if(this.type != 'file'){return null;}
if(!$(this).hasClass('ws-filereader')){
webshim.info("please add the 'ws-filereader' class to your input[type='file'] to implement files-property");
if(!$(this).is('.ws-filereader, .ws-capture')){
webshim.info("please add the 'ws-filereader'/'ws-capture' class to your input[type='file'] to implement files-property");
}
return webshim.data(this, 'fileList') || [];
}
@ -1591,11 +1592,66 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
});
webshim.onNodeNamesPropertyModify('input', 'value', function(value, boolVal, type){
if(value === '' && this.type == 'file' && $(this).hasClass('ws-filereader')){
if(value === '' && this.type == 'file' && $(this).is('.ws-filereader, .ws-capture')){
webshim.data(this, 'fileList', []);
}
});
if(!document.createElement('canvas').toBlob){
webshim.defineNodeNameProperty('canvas', 'toBlob', {
prop: {
value: function(cb, type, qualitiy){
var dataURL;
var $canvas = $(this);
if(!type){
type = 'image/jpeg';
}
if(type == 'image/jpeg' && !qualitiy){
qualitiy = 0.8;
}
loadMoxie();
setTimeout(function(){
dataURL = $canvas.callProp('getAsDataURL', [type, qualitiy]);
webshim.ready('moxie', function(){
var img = new mOxie.Image();
img.onload = function() {
var blob = img.getAsBlob();
webshim.defineProperty(blob, '_wsDataURL', {
value: dataURL,
enumerable: false
});
cb(blob);
};
img.load(dataURL);
});
}, 9);
}
}
});
webshim.ready('url', function(){
var _nativeCreateObjectURL = URL.createObjectURL;
var _nativeRevokeObjectURL = URL.revokeObjectURL;
URL.createObjectURL = function(obj){
var url = obj;
if(obj._wsimgDataURL) {
url = obj._wsimgDataURL;
} else if(_nativeCreateObjectURL){
return _nativeCreateObjectURL.apply(this, arguments);
}
return url;
};
URL.revokeObjectURL = function(url){
if (_nativeRevokeObjectURL){
return _nativeRevokeObjectURL.apply(this, arguments);
}
};
});
}
window.FileReader = notReadyYet;
window.FormData = notReadyYet;
@ -1605,7 +1661,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
mOxie = window.mOxie;
mOxie.Env.swf_url = featureOptions.swfpath;
mOxie.Env.xap_url = featureOptions.xappath;
window.FileReader = mOxie.FileReader;
@ -1644,7 +1699,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
return moxieData;
};
FormData = window.FormData;
createFilePicker = _createFilePicker;
transports.moxie = createMoxieTransport;
@ -1829,12 +1883,13 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
};
mediaelement.jarisEvent = {};
mediaelement.jarisEvent = mediaelement.jarisEvent || {};
var localConnectionTimer;
var onEvent = {
onPlayPause: function(jaris, data, override){
var playing, type;
var idled = data.paused || data.ended;
if(override == null){
try {
playing = data.api.api_get("isPlaying");
@ -1848,12 +1903,15 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
type = data.paused ? 'pause' : 'play';
data._ppFlag = true;
trigger(data._elem, type);
}
if(!data.paused || playing == idled || playing == null){
if(data.readyState < 3){
setReadyState(3, data);
}
if(!data.paused){
trigger(data._elem, 'playing');
}
}
if(!data.paused){
trigger(data._elem, 'playing');
}
},
onSeek: function(jaris, data){
@ -2605,11 +2663,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
options.changeSWF(vars, elem, canPlaySrc, data, 'embed');
clearTimeout(data.flashBlock);
swfmini.embedSWF(playerSwfPath, elemId, "100%", "100%", "9.0.115", false, vars, params, attrs, function(swfData){
swfmini.embedSWF(playerSwfPath, elemId, "100%", "100%", "11.3", false, vars, params, attrs, function(swfData){
if(swfData.success){
var fBlocker = function(){
if((!swfData.ref.parentNode && box[0].parentNode) || swfData.ref.style.display == "none"){
box.addClass('flashblocker-assumed');
if((!swfData.ref.parentNode) || swfData.ref.style.display == "none"){
$(elem).trigger('flashblocker');
webshims.warn("flashblocker assumed");
}
@ -2843,8 +2901,19 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshim.error('canvas.drawImage feature is needed. In IE8 flashvanvas pro can be used');
}
CanvasRenderingContext2D.prototype.wsImageComplete = function(cb){
if(this._wsIsLoading){
if(!this._wsLoadingCbs){
this._wsLoadingCbs = [];
}
this._wsLoadingCbs.push(cb);
} else {
cb.call(this, this);
}
};
CanvasRenderingContext2D.prototype.drawImage = function(elem){
var data, img, args, imgData;
var data, img, args, imgData, hadCachedImg;
var context = this;
if(isVideo[elem.nodeName] && (data = webshims.data(elem, 'mediaelement')) && data.isActive == 'third' && data.api.api_image){
@ -2862,18 +2931,39 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
args = slice.call(arguments, 1);
img = new Image();
if(options.canvasSync && data.canvasImg){
args.unshift(data.canvasImg);
_drawImage.apply(context, args);
args = slice.call(arguments, 1);
hadCachedImg = true;
}
img = document.createElement('img');
//todo find a performant sync way
img.onload = function(){
args.unshift(this);
_drawImage.apply(context, args);
img.onload = null;
if(options.canvasSync){
data.canvasImg = img;
if(hadCachedImg && options.noDoubbleDraw){
return;
}
}
_drawImage.apply(context, args);
context._wsIsLoading = false;
if(context._wsLoadingCbs && context._wsLoadingCbs.length){
while(context._wsLoadingCbs.length){
context._wsLoadingCbs.shift().call(context, context);
}
}
};
img.src = 'data:image/jpeg;base64,'+imgData;
if(img.complete){
this._wsIsLoading = true;
if(img.complete && img.onload){
img.onload();
}
return;

View File

@ -1250,11 +1250,11 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
});
;webshim.register('filereader', function($, webshim, window, document, undefined, featureOptions){
;webshim.register('filereader-xhr', function($, webshim, window, document, undefined, featureOptions){
"use strict";
var mOxie, moxie, hasXDomain;
var FormData = $.noop;
var sel = 'input[type="file"].ws-filereader';
var sel = 'input[type="file"].ws-filereader, input[type="file"].ws-capture';
var hasFlash = swfmini.hasFlashPlayerVersion('10.3');
var loadMoxie = function (){
webshim.loader.loadList(['moxie']);
};
@ -1366,7 +1366,7 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
}
);
var shimMoxiePath = webshim.cfg.basePath+'moxie/';
var crossXMLMessage = 'You nedd a crossdomain.xml to get all "filereader" / "XHR2" / "CORS" features to work. Or host moxie.swf/moxie.xap on your server an configure filereader options: "swfpath"/"xappath"';
var crossXMLMessage = 'You nedd a crossdomain.xml to get all "filereader" / "XHR2" / "CORS" features to work. Or host moxie.swf on your server an configure filereader options: "swfpath"';
var testMoxie = function(options){
return (options.wsType == 'moxie' || (options.data && options.data instanceof mOxie.FormData) || (options.crossDomain && $.support.cors !== false && hasXDomain != 'no' && !noxhr.test(options.dataType || '')));
};
@ -1549,6 +1549,10 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
}
};
webshim.loader.addModule('moxie', {
src: 'moxie/js/moxie-'+ (hasFlash ? 'swf' : 'html4')
});
if(!featureOptions.progress){
featureOptions.progress = 'onprogress';
}
@ -1560,9 +1564,6 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
if(!featureOptions.swfpath){
featureOptions.swfpath = shimMoxiePath+'flash/Moxie.min.swf';
}
if(!featureOptions.xappath){
featureOptions.xappath = shimMoxiePath+'silverlight/Moxie.min.xap';
}
if($.support.cors !== false || !window.XDomainRequest){
delete transports.xdomain;
@ -1589,8 +1590,8 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
writeable: false,
get: function(){
if(this.type != 'file'){return null;}
if(!$(this).hasClass('ws-filereader')){
webshim.info("please add the 'ws-filereader' class to your input[type='file'] to implement files-property");
if(!$(this).is('.ws-filereader, .ws-capture')){
webshim.info("please add the 'ws-filereader'/'ws-capture' class to your input[type='file'] to implement files-property");
}
return webshim.data(this, 'fileList') || [];
}
@ -1612,11 +1613,66 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
});
webshim.onNodeNamesPropertyModify('input', 'value', function(value, boolVal, type){
if(value === '' && this.type == 'file' && $(this).hasClass('ws-filereader')){
if(value === '' && this.type == 'file' && $(this).is('.ws-filereader, .ws-capture')){
webshim.data(this, 'fileList', []);
}
});
if(!document.createElement('canvas').toBlob){
webshim.defineNodeNameProperty('canvas', 'toBlob', {
prop: {
value: function(cb, type, qualitiy){
var dataURL;
var $canvas = $(this);
if(!type){
type = 'image/jpeg';
}
if(type == 'image/jpeg' && !qualitiy){
qualitiy = 0.8;
}
loadMoxie();
setTimeout(function(){
dataURL = $canvas.callProp('getAsDataURL', [type, qualitiy]);
webshim.ready('moxie', function(){
var img = new mOxie.Image();
img.onload = function() {
var blob = img.getAsBlob();
webshim.defineProperty(blob, '_wsDataURL', {
value: dataURL,
enumerable: false
});
cb(blob);
};
img.load(dataURL);
});
}, 9);
}
}
});
webshim.ready('url', function(){
var _nativeCreateObjectURL = URL.createObjectURL;
var _nativeRevokeObjectURL = URL.revokeObjectURL;
URL.createObjectURL = function(obj){
var url = obj;
if(obj._wsimgDataURL) {
url = obj._wsimgDataURL;
} else if(_nativeCreateObjectURL){
return _nativeCreateObjectURL.apply(this, arguments);
}
return url;
};
URL.revokeObjectURL = function(url){
if (_nativeRevokeObjectURL){
return _nativeRevokeObjectURL.apply(this, arguments);
}
};
});
}
window.FileReader = notReadyYet;
window.FormData = notReadyYet;
@ -1626,7 +1682,6 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
mOxie = window.mOxie;
mOxie.Env.swf_url = featureOptions.swfpath;
mOxie.Env.xap_url = featureOptions.xappath;
window.FileReader = mOxie.FileReader;
@ -1665,7 +1720,6 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
return moxieData;
};
FormData = window.FormData;
createFilePicker = _createFilePicker;
transports.moxie = createMoxieTransport;

View File

@ -97,7 +97,6 @@ var isPlaceholderOptionSelected = function(select){
};
var emptyJ = $([]);
//TODO: cache + perftest
var getGroupElements = function(elem){
elem = $(elem);
var name, form;
@ -167,7 +166,7 @@ var validityRules = {
$.each({tooShort: ['minLength', -1], tooLong: ['maxLength', 1]}, function(name, props){
validityRules[name] = function(input, val, cache){
//defaultValue is not the same as dirty flag, but very similiar
if(cache.nodeName == 'select' || input.prop('defaultValue') == val){return false;}
if(!val || cache.nodeName == 'select' || input.prop('defaultValue') == val){return false;}
cacheType(cache, input[0]);

View File

@ -64,11 +64,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.assumeARIA = true;
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
}
if('debug' in webshims){
webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
webshims.error("IE browser modes are busted in IE10+. Make sure to run IE in edge mode (X-UA-Compatible). Please test your HTML/CSS/JS with a real IE version or at least IETester or similar tools. ");
}
if (!webshims.cfg.no$Switch) {
@ -681,33 +677,37 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
},
handler: (function(){
var evt;
var trigger = function(){
$(document).triggerHandler('updateshadowdom');
$(document).triggerHandler('updateshadowdom', [evt]);
};
var timed = function(){
if(evt && evt.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
}
if(evt && evt.type != 'docresize'){
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
};
return function(e){
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if(e.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
}, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
evt = e;
resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
};
})(),
_create: function(){
@ -1532,20 +1532,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
});
$(function(){
var fileReaderReady = ('FileReader' in window && 'FormData' in window);
if(!fileReaderReady){
webshims.addReady(function(context){
if(!fileReaderReady && !modules.filereader.loaded && !modules.moxie.loaded){
if(context.querySelector('input.ws-filereader')){
webshims.reTest(['filereader', 'moxie']);
fileReaderReady = true;
}
}
});
}
});
if(options.addValidators && options.fastValidators){
webshims.reTest(['form-validators', 'form-validation']);
}

View File

@ -64,11 +64,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.assumeARIA = true;
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
}
if('debug' in webshims){
webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
webshims.error("IE browser modes are busted in IE10+. Make sure to run IE in edge mode (X-UA-Compatible). Please test your HTML/CSS/JS with a real IE version or at least IETester or similar tools. ");
}
if (!webshims.cfg.no$Switch) {
@ -681,33 +677,37 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
},
handler: (function(){
var evt;
var trigger = function(){
$(document).triggerHandler('updateshadowdom');
$(document).triggerHandler('updateshadowdom', [evt]);
};
var timed = function(){
if(evt && evt.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
}
if(evt && evt.type != 'docresize'){
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
};
return function(e){
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if(e.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
}, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
evt = e;
resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
};
})(),
_create: function(){
@ -1532,20 +1532,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
});
$(function(){
var fileReaderReady = ('FileReader' in window && 'FormData' in window);
if(!fileReaderReady){
webshims.addReady(function(context){
if(!fileReaderReady && !modules.filereader.loaded && !modules.moxie.loaded){
if(context.querySelector('input.ws-filereader')){
webshims.reTest(['filereader', 'moxie']);
fileReaderReady = true;
}
}
});
}
});
if(options.addValidators && options.fastValidators){
webshims.reTest(['form-validators', 'form-validation']);
}

View File

@ -64,11 +64,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.assumeARIA = true;
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
}
if('debug' in webshims){
webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
webshims.error("IE browser modes are busted in IE10+. Make sure to run IE in edge mode (X-UA-Compatible). Please test your HTML/CSS/JS with a real IE version or at least IETester or similar tools. ");
}
if (!webshims.cfg.no$Switch) {
@ -681,33 +677,37 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
},
handler: (function(){
var evt;
var trigger = function(){
$(document).triggerHandler('updateshadowdom');
$(document).triggerHandler('updateshadowdom', [evt]);
};
var timed = function(){
if(evt && evt.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
}
if(evt && evt.type != 'docresize'){
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
};
return function(e){
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if(e.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
}, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
evt = e;
resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
};
})(),
_create: function(){
@ -1532,20 +1532,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
});
$(function(){
var fileReaderReady = ('FileReader' in window && 'FormData' in window);
if(!fileReaderReady){
webshims.addReady(function(context){
if(!fileReaderReady && !modules.filereader.loaded && !modules.moxie.loaded){
if(context.querySelector('input.ws-filereader')){
webshims.reTest(['filereader', 'moxie']);
fileReaderReady = true;
}
}
});
}
});
if(options.addValidators && options.fastValidators){
webshims.reTest(['form-validators', 'form-validation']);
}

View File

@ -64,11 +64,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.assumeARIA = true;
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
}
if('debug' in webshims){
webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
webshims.error("IE browser modes are busted in IE10+. Make sure to run IE in edge mode (X-UA-Compatible). Please test your HTML/CSS/JS with a real IE version or at least IETester or similar tools. ");
}
if (!webshims.cfg.no$Switch) {
@ -681,33 +677,37 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
},
handler: (function(){
var evt;
var trigger = function(){
$(document).triggerHandler('updateshadowdom');
$(document).triggerHandler('updateshadowdom', [evt]);
};
var timed = function(){
if(evt && evt.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
}
if(evt && evt.type != 'docresize'){
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
};
return function(e){
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if(e.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
}, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
evt = e;
resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
};
})(),
_create: function(){
@ -1297,8 +1297,12 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
var lastCue = this.cues[this.cues.length-1];
if(lastCue && lastCue.startTime > cue.startTime){
webshims.error("cue startTime higher than previous cue's startTime");
return;
}
}
if(cue.startTime >= cue.endTime ){
webshim.error('startTime >= endTime of cue: '+ cue.text);
}
if(cue.track && cue.track.removeCue){
cue.track.removeCue(cue);
}
@ -1390,6 +1394,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
for(i = 0, len = added.length; i < len; i++){
$([trackList]).triggerHandler($.Event({type: 'addtrack', track: added[i]}));
}
//todo: remove
if(baseData.scriptedTextTracks || removed.length){
$(this).triggerHandler('updatetrackdisplay');
}
@ -1406,7 +1411,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
setTimeout(function(){
$(track).closest('audio, video').triggerHandler('updatetrackdisplay');
trackData.isTriggering = false;
}, 1);
}, 9);
}
};
var isDefaultTrack = (function(){
@ -1599,15 +1604,10 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
error: error
});
};
if($.ajax && $.ajaxSettings.xhr){
if(isDisabled){
setTimeout(createAjax, loadingTracks * 2);
} else {
createAjax();
}
if(isDisabled){
setTimeout(createAjax, loadingTracks * 2);
} else {
webshims.ready('jajax', createAjax);
webshims.loader.loadList(['jajax']);
createAjax();
}
} catch(er){
error();

View File

@ -64,11 +64,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.assumeARIA = true;
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
}
if('debug' in webshims){
webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
webshims.error("IE browser modes are busted in IE10+. Make sure to run IE in edge mode (X-UA-Compatible). Please test your HTML/CSS/JS with a real IE version or at least IETester or similar tools. ");
}
if (!webshims.cfg.no$Switch) {
@ -681,33 +677,37 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
},
handler: (function(){
var evt;
var trigger = function(){
$(document).triggerHandler('updateshadowdom');
$(document).triggerHandler('updateshadowdom', [evt]);
};
var timed = function(){
if(evt && evt.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
}
if(evt && evt.type != 'docresize'){
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
};
return function(e){
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if(e.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
}, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
evt = e;
resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
};
})(),
_create: function(){

View File

@ -2641,7 +2641,8 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
(function(){
var picker = {};
var assumeVirtualKeyBoard = (window.Modernizr && (Modernizr.touchevents || Modernizr.touch)) || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase()));
var modern = window.Modernizr;
var assumeVirtualKeyBoard = (modern && (modern.touchevents || modern.touch)) || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase()));
webshims.inlinePopover = {
_create: function(){
this.element = $('<div class="ws-inline-picker"><div class="ws-po-box" /></div>').data('wspopover', this);

View File

@ -2641,7 +2641,8 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
(function(){
var picker = {};
var assumeVirtualKeyBoard = (window.Modernizr && (Modernizr.touchevents || Modernizr.touch)) || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase()));
var modern = window.Modernizr;
var assumeVirtualKeyBoard = (modern && (modern.touchevents || modern.touch)) || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase()));
webshims.inlinePopover = {
_create: function(){
this.element = $('<div class="ws-inline-picker"><div class="ws-po-box" /></div>').data('wspopover', this);

View File

@ -287,11 +287,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.assumeARIA = true;
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
}
if('debug' in webshims){
webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
webshims.error("IE browser modes are busted in IE10+. Make sure to run IE in edge mode (X-UA-Compatible). Please test your HTML/CSS/JS with a real IE version or at least IETester or similar tools. ");
}
if (!webshims.cfg.no$Switch) {
@ -904,33 +900,37 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
},
handler: (function(){
var evt;
var trigger = function(){
$(document).triggerHandler('updateshadowdom');
$(document).triggerHandler('updateshadowdom', [evt]);
};
var timed = function(){
if(evt && evt.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
}
if(evt && evt.type != 'docresize'){
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
};
return function(e){
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if(e.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
}, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
evt = e;
resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
};
})(),
_create: function(){
@ -1755,20 +1755,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
});
$(function(){
var fileReaderReady = ('FileReader' in window && 'FormData' in window);
if(!fileReaderReady){
webshims.addReady(function(context){
if(!fileReaderReady && !modules.filereader.loaded && !modules.moxie.loaded){
if(context.querySelector('input.ws-filereader')){
webshims.reTest(['filereader', 'moxie']);
fileReaderReady = true;
}
}
});
}
});
if(options.addValidators && options.fastValidators){
webshims.reTest(['form-validators', 'form-validation']);
}
@ -2446,9 +2432,16 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
})();
}
if(window.CanvasRenderingContext2D && CanvasRenderingContext2D.prototype){
CanvasRenderingContext2D.prototype.wsImageComplete = function(cb){
cb.call(this, this);
};
}
webshims.register('mediaelement-core', function($, webshims, window, document, undefined, options){
var hasSwf = swfmini.hasFlashPlayerVersion('11.3');
var mediaelement = webshims.mediaelement;
var allowYtLoading = false;
mediaelement.parseRtmp = function(data){
var src = data.src.split('://');
@ -2544,7 +2537,9 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
return function(){
if(loaded || !hasYt){return;}
loaded = true;
webshims.loader.loadScript("https://www.youtube.com/player_api");
if(allowYtLoading){
webshims.loader.loadScript("https://www.youtube.com/player_api");
}
$(function(){
webshims._polyfill(["mediaelement-yt"]);
});
@ -2730,6 +2725,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
}
});
if(!requested && hasYt && !mediaelement.createSWF){
allowYtLoading = true;
loadYt();
}
};
@ -2894,6 +2890,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
.add(insertedElement.filter('video, audio'))
.each(function(){
if(!mediaelement.canNativePlaySrces(this)){
allowYtLoading = true;
loadThird();
handleMedia = true;
return false;
@ -2916,6 +2913,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
mediaelement.loadDebugger();
});
}
//set native implementation ready, before swf api is retested
if(hasNative){
webshims.isReady('mediaelement-core', true);

View File

@ -287,11 +287,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.assumeARIA = true;
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
}
if('debug' in webshims){
webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
webshims.error("IE browser modes are busted in IE10+. Make sure to run IE in edge mode (X-UA-Compatible). Please test your HTML/CSS/JS with a real IE version or at least IETester or similar tools. ");
}
if (!webshims.cfg.no$Switch) {
@ -904,33 +900,37 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
},
handler: (function(){
var evt;
var trigger = function(){
$(document).triggerHandler('updateshadowdom');
$(document).triggerHandler('updateshadowdom', [evt]);
};
var timed = function(){
if(evt && evt.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
}
if(evt && evt.type != 'docresize'){
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
};
return function(e){
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if(e.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
}, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
evt = e;
resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
};
})(),
_create: function(){
@ -1755,20 +1755,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
});
$(function(){
var fileReaderReady = ('FileReader' in window && 'FormData' in window);
if(!fileReaderReady){
webshims.addReady(function(context){
if(!fileReaderReady && !modules.filereader.loaded && !modules.moxie.loaded){
if(context.querySelector('input.ws-filereader')){
webshims.reTest(['filereader', 'moxie']);
fileReaderReady = true;
}
}
});
}
});
if(options.addValidators && options.fastValidators){
webshims.reTest(['form-validators', 'form-validation']);
}
@ -2149,9 +2135,16 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
})();
}
if(window.CanvasRenderingContext2D && CanvasRenderingContext2D.prototype){
CanvasRenderingContext2D.prototype.wsImageComplete = function(cb){
cb.call(this, this);
};
}
webshims.register('mediaelement-core', function($, webshims, window, document, undefined, options){
var hasSwf = swfmini.hasFlashPlayerVersion('11.3');
var mediaelement = webshims.mediaelement;
var allowYtLoading = false;
mediaelement.parseRtmp = function(data){
var src = data.src.split('://');
@ -2247,7 +2240,9 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
return function(){
if(loaded || !hasYt){return;}
loaded = true;
webshims.loader.loadScript("https://www.youtube.com/player_api");
if(allowYtLoading){
webshims.loader.loadScript("https://www.youtube.com/player_api");
}
$(function(){
webshims._polyfill(["mediaelement-yt"]);
});
@ -2433,6 +2428,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
}
});
if(!requested && hasYt && !mediaelement.createSWF){
allowYtLoading = true;
loadYt();
}
};
@ -2597,6 +2593,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
.add(insertedElement.filter('video, audio'))
.each(function(){
if(!mediaelement.canNativePlaySrces(this)){
allowYtLoading = true;
loadThird();
handleMedia = true;
return false;
@ -2619,6 +2616,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
mediaelement.loadDebugger();
});
}
//set native implementation ready, before swf api is retested
if(hasNative){
webshims.isReady('mediaelement-core', true);

View File

@ -64,11 +64,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.assumeARIA = true;
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
}
if('debug' in webshims){
webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
webshims.error("IE browser modes are busted in IE10+. Make sure to run IE in edge mode (X-UA-Compatible). Please test your HTML/CSS/JS with a real IE version or at least IETester or similar tools. ");
}
if (!webshims.cfg.no$Switch) {
@ -681,33 +677,37 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
},
handler: (function(){
var evt;
var trigger = function(){
$(document).triggerHandler('updateshadowdom');
$(document).triggerHandler('updateshadowdom', [evt]);
};
var timed = function(){
if(evt && evt.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
}
if(evt && evt.type != 'docresize'){
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
};
return function(e){
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if(e.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
}, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
evt = e;
resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
};
})(),
_create: function(){
@ -3045,7 +3045,8 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
(function(){
var picker = {};
var assumeVirtualKeyBoard = (window.Modernizr && (Modernizr.touchevents || Modernizr.touch)) || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase()));
var modern = window.Modernizr;
var assumeVirtualKeyBoard = (modern && (modern.touchevents || modern.touch)) || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase()));
webshims.inlinePopover = {
_create: function(){
this.element = $('<div class="ws-inline-picker"><div class="ws-po-box" /></div>').data('wspopover', this);

View File

@ -475,7 +475,8 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
})();
var ios = /iP(hone|od|ad)/i.test(navigator.platform);
var ios6 = ios && parseInt(((navigator.appVersion).match(/OS (\d+)_\d+/) || ['','8'])[1], 10) < 7;
var hasYtBug = (!window.Modernizr || !Modernizr.videoautoplay) && (ios || /android/i.test(navigator.userAgent));
var modern = window.Modernizr;
var hasYtBug = (!modern || !modern.videoautoplay) && (ios || /android/i.test(navigator.userAgent));
var loadLazy = function(){
if(!loadLazy.loaded){
loadLazy.loaded = true;
@ -596,7 +597,8 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
if(!e){
e.type = 'playing';
}
if(isInitial && (!isYt || !hasYtBug || e.type == 'playing' || data.media.prop('readyState') > 1)){
if(isInitial && (!isYt || !hasYtBug || e.type == 'playing' || data.media.prop('readyState') || data.media.prop('networkState'))){
isInitial = false;
data.player.removeClass('initial-state');
}

View File

@ -475,7 +475,8 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
})();
var ios = /iP(hone|od|ad)/i.test(navigator.platform);
var ios6 = ios && parseInt(((navigator.appVersion).match(/OS (\d+)_\d+/) || ['','8'])[1], 10) < 7;
var hasYtBug = (!window.Modernizr || !Modernizr.videoautoplay) && (ios || /android/i.test(navigator.userAgent));
var modern = window.Modernizr;
var hasYtBug = (!modern || !modern.videoautoplay) && (ios || /android/i.test(navigator.userAgent));
var loadLazy = function(){
if(!loadLazy.loaded){
loadLazy.loaded = true;
@ -596,7 +597,8 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
if(!e){
e.type = 'playing';
}
if(isInitial && (!isYt || !hasYtBug || e.type == 'playing' || data.media.prop('readyState') > 1)){
if(isInitial && (!isYt || !hasYtBug || e.type == 'playing' || data.media.prop('readyState') || data.media.prop('networkState'))){
isInitial = false;
data.player.removeClass('initial-state');
}

View File

@ -64,11 +64,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.assumeARIA = true;
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
}
if('debug' in webshims){
webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
webshims.error("IE browser modes are busted in IE10+. Make sure to run IE in edge mode (X-UA-Compatible). Please test your HTML/CSS/JS with a real IE version or at least IETester or similar tools. ");
}
if (!webshims.cfg.no$Switch) {
@ -681,33 +677,37 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
},
handler: (function(){
var evt;
var trigger = function(){
$(document).triggerHandler('updateshadowdom');
$(document).triggerHandler('updateshadowdom', [evt]);
};
var timed = function(){
if(evt && evt.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
}
if(evt && evt.type != 'docresize'){
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
};
return function(e){
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if(e.type == 'resize'){
var width = $window.width();
var height = $window.width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
if(window.requestAnimationFrame){
requestAnimationFrame(trigger);
} else {
setTimeout(trigger, 0);
}
}, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
evt = e;
resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
};
})(),
_create: function(){

View File

@ -1,11 +1,13 @@
// ES6-shim 0.8.0 (c) 2013 Paul Miller (paulmillr.com)
// ES6-shim 0.15.0 (c) 2013-2014 Paul Miller (http://paulmillr.com)
// ES6-shim may be freely distributed under the MIT license.
// For more details and documentation:
// https://github.com/paulmillr/es6-shim/
webshim.register('es6', function($, webshim, window, document, undefined){
'use strict';
var isCallableWithoutNew = function(func) {
try { func(); }
catch (e) { return false; }
@ -99,7 +101,7 @@ webshim.register('es6', function($, webshim, window, document, undefined){
// work properly with each other, even though we don't have full Iterator
// support. That is, `Array.from(map.keys())` will work, but we don't
// pretend to export a "real" Iterator interface.
var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) ||
var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||
'_es6shim_iterator_';
// Firefox ships a partial implementation using the name @@iterator.
// https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14
@ -328,8 +330,8 @@ webshim.register('es6', function($, webshim, window, document, undefined){
// Bits to bytes
bytes = [];
while (str.length) {
bytes.push(parseInt(str.substring(0, 8), 2));
str = str.substring(8);
bytes.push(parseInt(str.slice(0, 8), 2));
str = str.slice(8);
}
return bytes;
}
@ -351,9 +353,9 @@ webshim.register('es6', function($, webshim, window, document, undefined){
// Unpack sign, exponent, fraction
bias = (1 << (ebits - 1)) - 1;
s = parseInt(str.substring(0, 1), 2) ? -1 : 1;
e = parseInt(str.substring(1, 1 + ebits), 2);
f = parseInt(str.substring(1 + ebits), 2);
s = parseInt(str.slice(0, 1), 2) ? -1 : 1;
e = parseInt(str.slice(1, 1 + ebits), 2);
f = parseInt(str.slice(1 + ebits), 2);
// Produce number
if (e === (1 << ebits) - 1) {
@ -388,7 +390,7 @@ webshim.register('es6', function($, webshim, window, document, undefined){
}());
defineProperties(String, {
fromCodePoint: function() {
fromCodePoint: function(_) { // length = 1
var points = _slice.call(arguments, 0, arguments.length);
var result = [];
var next;
@ -677,15 +679,17 @@ webshim.register('es6', function($, webshim, window, document, undefined){
},
fill: function(value) {
var start = arguments[1], end = arguments[2]; // fill.length===1
var start = arguments.length > 1 ? arguments[1] : undefined;
var end = arguments.length > 2 ? arguments[2] : undefined;
var O = ES.ToObject(this);
var len = ES.ToLength(O.length);
start = ES.ToInteger(start===undefined ? 0 : start);
end = ES.ToInteger(end===undefined ? len : end);
start = ES.ToInteger(start === undefined ? 0 : start);
end = ES.ToInteger(end === undefined ? len : end);
var relativeStart = start < 0 ? Math.max(len + start, 0) : Math.min(start, len);
var relativeEnd = end < 0 ? len + end : end;
for (var i = relativeStart; i < len && i < end; ++i) {
for (var i = relativeStart; i < len && i < relativeEnd; ++i) {
O[i] = value;
}
return O;
@ -755,9 +759,7 @@ webshim.register('es6', function($, webshim, window, document, undefined){
},
isInteger: function(value) {
return typeof value === 'number' &&
!Number.isNaN(value) &&
Number.isFinite(value) &&
return Number.isFinite(value) &&
ES.ToInteger(value) === value;
},
@ -813,20 +815,13 @@ webshim.register('es6', function($, webshim, window, document, undefined){
throw new TypeError('target must be an object');
}
return Array.prototype.reduce.call(arguments, function(target, source) {
if (!ES.TypeIsObject(source)) {
throw new TypeError('source must be an object');
}
return Object.keys(source).reduce(function(target, key) {
return Object.keys(Object(source)).reduce(function(target, key) {
target[key] = source[key];
return target;
}, target);
});
},
getOwnPropertyKeys: function(subject) {
return Object.keys(subject);
},
is: function(a, b) {
return ES.SameValue(a, b);
},
@ -955,7 +950,6 @@ webshim.register('es6', function($, webshim, window, document, undefined){
clz32: function(value) {
// See https://bugs.ecmascript.org/show_bug.cgi?id=2465
value = Number(value);
if (Number.isNaN(value)) return NaN;
var number = ES.ToUint32(value);
if (number === 0) {
return 32;
@ -1064,6 +1058,8 @@ webshim.register('es6', function($, webshim, window, document, undefined){
imul: function(x, y) {
// taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul
x = ES.ToUint32(x);
y = ES.ToUint32(y);
var ah = (x >>> 16) & 0xffff;
var al = x & 0xffff;
var bh = (y >>> 16) & 0xffff;
@ -1523,7 +1519,7 @@ webshim.register('es6', function($, webshim, window, document, undefined){
};
addIterator(MapIterator.prototype);
function Map() {
function Map(iterable) {
var map = this;
map = emulateES6construct(map);
if (!map._es6map) {
@ -1541,7 +1537,6 @@ webshim.register('es6', function($, webshim, window, document, undefined){
});
// Optionally initialize map from iterable
var iterable = arguments[0];
if (iterable !== undefined && iterable !== null) {
var it = ES.GetIterator(iterable);
var adder = map.set;
@ -1709,7 +1704,7 @@ webshim.register('es6', function($, webshim, window, document, undefined){
// Sets containing only string or numeric keys, we use an object
// as backing storage and lazily create a full Map only when
// required.
var SetShim = function Set() {
var SetShim = function Set(iterable) {
var set = this;
set = emulateES6construct(set);
if (!set._es6set) {
@ -1722,7 +1717,6 @@ webshim.register('es6', function($, webshim, window, document, undefined){
});
// Optionally initialize map from iterable
var iterable = arguments[0];
if (iterable !== undefined && iterable !== null) {
var it = ES.GetIterator(iterable);
var adder = set.add;
@ -1754,7 +1748,7 @@ webshim.register('es6', function($, webshim, window, document, undefined){
Object.keys(set._storage).forEach(function(k) {
// fast check for leading '$'
if (k.charCodeAt(0) === 36) {
k = k.substring(1);
k = k.slice(1);
} else {
k = +k;
}

View File

@ -1,8 +1,8 @@
webshim.register('filereader', function($, webshim, window, document, undefined, featureOptions){
webshim.register('filereader-xhr', function($, webshim, window, document, undefined, featureOptions){
"use strict";
var mOxie, moxie, hasXDomain;
var FormData = $.noop;
var sel = 'input[type="file"].ws-filereader';
var sel = 'input[type="file"].ws-filereader, input[type="file"].ws-capture';
var hasFlash = swfmini.hasFlashPlayerVersion('10.3');
var loadMoxie = function (){
webshim.loader.loadList(['moxie']);
};
@ -114,7 +114,7 @@ webshim.register('filereader', function($, webshim, window, document, undefined,
}
);
var shimMoxiePath = webshim.cfg.basePath+'moxie/';
var crossXMLMessage = 'You nedd a crossdomain.xml to get all "filereader" / "XHR2" / "CORS" features to work. Or host moxie.swf/moxie.xap on your server an configure filereader options: "swfpath"/"xappath"';
var crossXMLMessage = 'You nedd a crossdomain.xml to get all "filereader" / "XHR2" / "CORS" features to work. Or host moxie.swf on your server an configure filereader options: "swfpath"';
var testMoxie = function(options){
return (options.wsType == 'moxie' || (options.data && options.data instanceof mOxie.FormData) || (options.crossDomain && $.support.cors !== false && hasXDomain != 'no' && !noxhr.test(options.dataType || '')));
};
@ -297,6 +297,10 @@ webshim.register('filereader', function($, webshim, window, document, undefined,
}
};
webshim.loader.addModule('moxie', {
src: 'moxie/js/moxie-'+ (hasFlash ? 'swf' : 'html4')
});
if(!featureOptions.progress){
featureOptions.progress = 'onprogress';
}
@ -308,9 +312,6 @@ webshim.register('filereader', function($, webshim, window, document, undefined,
if(!featureOptions.swfpath){
featureOptions.swfpath = shimMoxiePath+'flash/Moxie.min.swf';
}
if(!featureOptions.xappath){
featureOptions.xappath = shimMoxiePath+'silverlight/Moxie.min.xap';
}
if($.support.cors !== false || !window.XDomainRequest){
delete transports.xdomain;
@ -337,8 +338,8 @@ webshim.register('filereader', function($, webshim, window, document, undefined,
writeable: false,
get: function(){
if(this.type != 'file'){return null;}
if(!$(this).hasClass('ws-filereader')){
webshim.info("please add the 'ws-filereader' class to your input[type='file'] to implement files-property");
if(!$(this).is('.ws-filereader, .ws-capture')){
webshim.info("please add the 'ws-filereader'/'ws-capture' class to your input[type='file'] to implement files-property");
}
return webshim.data(this, 'fileList') || [];
}
@ -360,11 +361,66 @@ webshim.register('filereader', function($, webshim, window, document, undefined,
});
webshim.onNodeNamesPropertyModify('input', 'value', function(value, boolVal, type){
if(value === '' && this.type == 'file' && $(this).hasClass('ws-filereader')){
if(value === '' && this.type == 'file' && $(this).is('.ws-filereader, .ws-capture')){
webshim.data(this, 'fileList', []);
}
});
if(!document.createElement('canvas').toBlob){
webshim.defineNodeNameProperty('canvas', 'toBlob', {
prop: {
value: function(cb, type, qualitiy){
var dataURL;
var $canvas = $(this);
if(!type){
type = 'image/jpeg';
}
if(type == 'image/jpeg' && !qualitiy){
qualitiy = 0.8;
}
loadMoxie();
setTimeout(function(){
dataURL = $canvas.callProp('getAsDataURL', [type, qualitiy]);
webshim.ready('moxie', function(){
var img = new mOxie.Image();
img.onload = function() {
var blob = img.getAsBlob();
webshim.defineProperty(blob, '_wsDataURL', {
value: dataURL,
enumerable: false
});
cb(blob);
};
img.load(dataURL);
});
}, 9);
}
}
});
webshim.ready('url', function(){
var _nativeCreateObjectURL = URL.createObjectURL;
var _nativeRevokeObjectURL = URL.revokeObjectURL;
URL.createObjectURL = function(obj){
var url = obj;
if(obj._wsimgDataURL) {
url = obj._wsimgDataURL;
} else if(_nativeCreateObjectURL){
return _nativeCreateObjectURL.apply(this, arguments);
}
return url;
};
URL.revokeObjectURL = function(url){
if (_nativeRevokeObjectURL){
return _nativeRevokeObjectURL.apply(this, arguments);
}
};
});
}
window.FileReader = notReadyYet;
window.FormData = notReadyYet;
@ -374,7 +430,6 @@ webshim.register('filereader', function($, webshim, window, document, undefined,
mOxie = window.mOxie;
mOxie.Env.swf_url = featureOptions.swfpath;
mOxie.Env.xap_url = featureOptions.xappath;
window.FileReader = mOxie.FileReader;
@ -413,7 +468,6 @@ webshim.register('filereader', function($, webshim, window, document, undefined,
return moxieData;
};
FormData = window.FormData;
createFilePicker = _createFilePicker;
transports.moxie = createMoxieTransport;

View File

@ -301,20 +301,6 @@ webshims.register('form-core', function($, webshims, window, document, undefined
}
});
$(function(){
var fileReaderReady = ('FileReader' in window && 'FormData' in window);
if(!fileReaderReady){
webshims.addReady(function(context){
if(!fileReaderReady && !modules.filereader.loaded && !modules.moxie.loaded){
if(context.querySelector('input.ws-filereader')){
webshims.reTest(['filereader', 'moxie']);
fileReaderReady = true;
}
}
});
}
});
if(options.addValidators && options.fastValidators){
webshims.reTest(['form-validators', 'form-validation']);
}

View File

@ -1194,7 +1194,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
(function(){
var picker = {};
var assumeVirtualKeyBoard = (window.Modernizr && (Modernizr.touchevents || Modernizr.touch)) || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase()));
var modern = window.Modernizr;
var assumeVirtualKeyBoard = (modern && (modern.touchevents || modern.touch)) || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase()));
webshims.inlinePopover = {
_create: function(){
this.element = $('<div class="ws-inline-picker"><div class="ws-po-box" /></div>').data('wspopover', this);

View File

@ -97,7 +97,6 @@ var isPlaceholderOptionSelected = function(select){
};
var emptyJ = $([]);
//TODO: cache + perftest
var getGroupElements = function(elem){
elem = $(elem);
var name, form;
@ -167,7 +166,7 @@ var validityRules = {
$.each({tooShort: ['minLength', -1], tooLong: ['maxLength', 1]}, function(name, props){
validityRules[name] = function(input, val, cache){
//defaultValue is not the same as dirty flag, but very similiar
if(cache.nodeName == 'select' || input.prop('defaultValue') == val){return false;}
if(!val || cache.nodeName == 'select' || input.prop('defaultValue') == val){return false;}
cacheType(cache, input[0]);

View File

@ -32,7 +32,8 @@ webshims.register('form-validation', function($, webshims, window, document, und
var nonFormFilter = function(){
return !$.prop(this, 'form');
};
var getGroupElements = webshims.modules["form-core"].getGroupElements || function(elem){
var modules = webshims.modules;
var getGroupElements = modules["form-core"].getGroupElements || function(elem){
elem = $(elem);
var name;
var form;
@ -207,8 +208,8 @@ webshims.register('form-validation', function($, webshims, window, document, und
iVal.fieldWrapper = ':not(span):not(label):not(em):not(strong):not(p):not(.ws-custom-file)';
}
if(!webshims.modules["form-core"].getGroupElements){
webshims.modules["form-core"].getGroupElements = getGroupElements;
if(!modules["form-core"].getGroupElements){
modules["form-core"].getGroupElements = getGroupElements;
}
$(document.body || 'html')
@ -364,7 +365,7 @@ webshims.register('form-validation', function($, webshims, window, document, und
this._shadowAdded = true;
}
element = $(element || this.options.prepareFor).getNativeElement() ;
element = $(element || this.options.prepareFor).getNativeElement();
var that = this;
var closeOnOutSide = function(e){
@ -971,7 +972,7 @@ webshims.register('form-validation', function($, webshims, window, document, und
$.data(this, 'wsCustomFile', {showSelected: showSelected});
$('button', $module).attr('tabindex', '-1');
$('button:not(.ws-capture-button)', $module).attr('tabindex', '-1');
$file
.on('change.webshim', showSelected)
@ -993,6 +994,18 @@ webshims.register('form-validation', function($, webshims, window, document, und
}
$(function(){
var fileReaderReady = ('FileReader' in window && 'FormData' in window);
if(!fileReaderReady){
webshims.addReady(function(context){
if(!fileReaderReady && !modules.filereader.loaded && context.querySelector('input.ws-filereader')){
webshims.reTest(['filereader']);
fileReaderReady = true;
}
});
}
});
webshims.addReady(function(context, contextElem){
$(context.querySelectorAll('.ws-custom-file')).add($(contextElem).filter('.ws-custom-file')).each(customFile);
});

View File

@ -261,8 +261,8 @@ webshims.ready('form-validation', function(){
if(!val || !pattern){return;}
return !(new RegExp('(' + pattern + ')', 'i').test(val));
}, 'This format is not allowed here.');
if(!('tooShort' in ($('<input />').prop('validity') || {}))){
if($('<input />').prop('minLength') === undefined || !('tooShort' in ($('<input />').prop('validity') || {}))){
addCustomValidityRule('tooShort', function(elem, val){
var minlength;
if(!val || val == elem.defaultValue || !(minlength = elem.getAttribute('minlength'))){return;}
@ -281,9 +281,12 @@ webshims.ready('form-validation', function(){
data.grouprequired.checkboxes
.off('click.groupRequired')
.on('click.groupRequired', function(){
webshims.refreshCustomValidityRules(elem);
if((data.customMismatchedRule == 'grouprequired') == this.checked){
$(elem).trigger('updatevalidation.webshims');
}
})
;
data.grouprequired.checkboxes.not(elem).removeData('grouprequired');
}
@ -332,14 +335,14 @@ webshims.ready('form-validation', function(){
addCustomValidityRule('dependent', function(elem, val, data){
data = data.dependentValidation;
if( !data ){return;}
var specialVal;
var depFn = function(e){
var val = $.prop(data.masterElement, data["from-prop"]);
if(specialVal){
val = $.inArray(val, specialVal) !== -1;
}
if(data.toggle){
if(data.specialVal){
val = $.inArray(val, data.specialVal) !== -1;
} if(data.toggle){
val = !val;
} else {
val = !!val;
}
$.prop( elem, data.prop, val);
if(iValClasses && e){
@ -370,14 +373,13 @@ webshims.ready('form-validation', function(){
}
if(data["from-prop"].indexOf('value:') === 0){
specialVal = data["from-prop"].replace('value:', '').split('||');
data.specialVal = data["from-prop"].replace('value:', '').split('||');
data["from-prop"] = 'value';
}
data = $.data(elem, 'dependentValidation', $.extend({_init: true}, dependentDefaults, data));
if(data.prop !== "value" || specialVal){
if(data.prop !== "value" || data.specialVal){
$(data.masterElement.type === 'radio' && getGroupElements(data.masterElement) || data.masterElement).on('change', depFn);
} else {
$(data.masterElement).on('change', function(){
@ -393,7 +395,7 @@ webshims.ready('form-validation', function(){
}
}
if(data.prop == "value" && !specialVal){
if(data.prop == "value" && !data.specialVal){
return ($.prop(data.masterElement, 'value') != val);
} else {
depFn();
@ -412,7 +414,6 @@ webshims.ready('form-validation', function(){
if(!val || !data.ajaxvalidate){return;}
var opts;
if(!data.remoteValidate){
webshims.loader.loadList(['jajax']);
if(typeof data.ajaxvalidate == 'string'){
data.ajaxvalidate = {url: data.ajaxvalidate, depends: $([])};
} else {

View File

@ -92,52 +92,46 @@
}
return;
}
createAjax = function(){
$.ajax({
url: 'http://freegeoip.net/json/',
dataType: 'jsonp',
cache: true,
jsonp: 'callback',
success: function(data){
locationAPIs--;
if(!data){return;}
pos = pos || {
coords: {
latitude: data.latitude,
longitude: data.longitude,
altitude: null,
accuracy: 43000,
altitudeAccuracy: null,
heading: parseInt('NaN', 10),
velocity: null
},
//extension similiar to FF implementation
address: {
city: data.city,
country: data.country_name,
countryCode: data.country_code,
county: "",
postalCode: data.zipcode,
premises: "",
region: data.region_name,
street: "",
streetNumber: ""
}
};
endCallback();
},
error: function(){
locationAPIs--;
endCallback();
}
});
};
if($.ajax){
createAjax();
} else {
webshims.ready('jajax', createAjax);
webshims.loader.loadList(['jajax']);
}
$.ajax({
url: 'http://freegeoip.net/json/',
dataType: 'jsonp',
cache: true,
jsonp: 'callback',
success: function(data){
locationAPIs--;
if(!data){return;}
pos = pos || {
coords: {
latitude: data.latitude,
longitude: data.longitude,
altitude: null,
accuracy: 43000,
altitudeAccuracy: null,
heading: parseInt('NaN', 10),
velocity: null
},
//extension similiar to FF implementation
address: {
city: data.city,
country: data.country_name,
countryCode: data.country_code,
county: "",
postalCode: data.zipcode,
premises: "",
region: data.region_name,
street: "",
streetNumber: ""
}
};
endCallback();
},
error: function(){
locationAPIs--;
endCallback();
}
});
clearTimeout(googleTimer);
if (!window.google || !window.google.loader) {
googleTimer = setTimeout(function(){
@ -179,9 +173,6 @@
};
return api;
})());
webshims.ready('WINDOWLOAD', function(){
webshims.loader.loadList(['jajax']);
});
webshims.isReady('geolocation', true);
})(webshims.$);

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* thx to http://icomoon.io */
.mediaplayer[data-state="waiting"] > .jme-media-overlay, .mediaplayer .fullscreen, .mediaplayer .fullscreen.state-exitfullscreen, .mediaplayer .mediaconfigmenu, .mediaplayer.initial-state > .jme-media-overlay, .mediaplayer button.play-pause, .mediaplayer button.play-pause.state-playing, .mediaplayer .mute-unmute, .mediaplayer[data-volume="medium"] .mute-unmute, .mediaplayer[data-volume="low"] .mute-unmute, .mediaplayer[data-volume="no"] .mute-unmute, .mediaplayer .state-unmute.mute-unmute, .mediaplayer .captions, .mediaplayer .subtitle-menu button[aria-checked="true"], .mediaplayer .subtitle-menu button, .mediaplayer .playlist-next, .mediaplayer .playlist-prev, .mediaplayer .chapters, .mediaplayer.ended-state > .jme-media-overlay {
.mediaplayer[data-state="waiting"] > div.jme-media-overlay, .mediaplayer .fullscreen, .mediaplayer .fullscreen.state-exitfullscreen, .mediaplayer .mediaconfigmenu, .mediaplayer.initial-state > .jme-media-overlay, .mediaplayer button.play-pause, .mediaplayer button.play-pause.state-playing, .mediaplayer .mute-unmute, .mediaplayer[data-volume="medium"] .mute-unmute, .mediaplayer[data-volume="low"] .mute-unmute, .mediaplayer[data-volume="no"] .mute-unmute, .mediaplayer .state-unmute.mute-unmute, .mediaplayer .captions, .mediaplayer .subtitle-menu button[aria-checked="true"], .mediaplayer .subtitle-menu button, .mediaplayer .playlist-next, .mediaplayer .playlist-prev, .mediaplayer .chapters, .mediaplayer.ended-state > .jme-media-overlay {
font-family: 'jme';
speak: none;
font-style: normal;
@ -13,7 +13,7 @@
-moz-osx-font-smoothing: grayscale;
}
.mediaplayer[data-state="waiting"] > .jme-media-overlay:before {
.mediaplayer[data-state="waiting"] > div.jme-media-overlay:before {
content: "\e612";
}
@ -300,10 +300,10 @@
.mediaplayer[data-state="waiting"] {
cursor: default;
}
.mediaplayer[data-state="waiting"] > .jme-media-overlay {
.mediaplayer[data-state="waiting"] > div.jme-media-overlay {
background-position: 4px 4px;
}
.mediaplayer[data-state="waiting"] > .jme-media-overlay:before {
.mediaplayer[data-state="waiting"] > div.jme-media-overlay:before {
-webkit-animation-name: jmespin;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 1100ms;

File diff suppressed because one or more lines are too long

View File

@ -52,7 +52,8 @@ webshims.register('mediacontrols', function($, webshims, window){
})();
var ios = /iP(hone|od|ad)/i.test(navigator.platform);
var ios6 = ios && parseInt(((navigator.appVersion).match(/OS (\d+)_\d+/) || ['','8'])[1], 10) < 7;
var hasYtBug = (!window.Modernizr || !Modernizr.videoautoplay) && (ios || /android/i.test(navigator.userAgent));
var modern = window.Modernizr;
var hasYtBug = (!modern || !modern.videoautoplay) && (ios || /android/i.test(navigator.userAgent));
var loadLazy = function(){
if(!loadLazy.loaded){
loadLazy.loaded = true;
@ -173,7 +174,8 @@ webshims.register('mediacontrols', function($, webshims, window){
if(!e){
e.type = 'playing';
}
if(isInitial && (!isYt || !hasYtBug || e.type == 'playing' || data.media.prop('readyState') > 1)){
if(isInitial && (!isYt || !hasYtBug || e.type == 'playing' || data.media.prop('readyState') || data.media.prop('networkState'))){
isInitial = false;
data.player.removeClass('initial-state');
}

View File

@ -0,0 +1,42 @@
webshim.register('mediacapture-picker', function($, webshim, window, document, undefined, featureOptions){
"use strict";
function PhotoShooter($dom){
this.$dom = $dom;
this._createDom();
this.requestMedia();
}
PhotoShooter.prototype = {
_createDom: function(){
this.$dom.html('<div class="ws-videocapture-view">' +
'<video class="ws-usermedia ws-inlineusermedia" autoplay=""></video>' +
'<div class="ws-video-overlay"></div>' +
'</div>' +
'<div class="button-row"><button type="button" class="ws-capture-button">take</button>' +
'</div>')
;
},
requestMedia: function(){
var that = this;
navigator.getUserMedia(
{video: {minWidth: 200, audio: false}},
function(stream){
that.stream = stream;
$('video', that.$dom).prop('src', URL.createObjectURL(stream));
},
function(){
}
);
$('video', that.$dom).removeClass('ws-usermedia');
}
};
webshim.mediacapture.showContent = function($fileinput, $button, popover){
var stream = new PhotoShooter(popover.contentElement);
};
});

View File

@ -0,0 +1,159 @@
webshim.register('mediacapture', function($, webshim, window, document, undefined, featureOptions){
"use strict";
var hasCamera = -1;
var checkCameras = $.noop;
var sel = 'input[type="file"].ws-filereader, input[type="file"].ws-capture';
var cameraListPromise = $.Deferred();
//
(function(){
var tmp;
var hasNativeUserMedia = !!(navigator.getUserMedia && !navigator.wsGetUserMedia);
var hasFlash = swfmini.hasFlashPlayerVersion('11.3');
var writeToStorage = function(){
try{
sessionStorage.setItem('wsCameras', JSON.stringify(hasCamera));
} catch (e){}
};
var reject = function(){
hasCamera = 0;
writeToStorage();
cameraListPromise.reject(hasCamera);
};
var resolve = function(){
writeToStorage();
cameraListPromise.resolve(hasCamera);
};
try {
tmp = JSON.parse(sessionStorage.getItem('wsCameras'));
if(tmp == null){
hasCamera = -1;
}
} catch(e){}
if(hasCamera === 0 || (hasCamera == -1 && !hasNativeUserMedia && !hasFlash)){
reject();
} else if(hasFlash){
checkCameras = function(){
var mediaOptions = webshim.cfg.mediaelement;
var playerSwfPath = mediaOptions.playerPath || (webshim.cfg.basePath + "swf/" + (mediaOptions.playerName || 'JarisFLVPlayer.swf'));
var id = 'wscameralistdetection';
var vars = {
controltype: '1',
jsapi: '1',
source: '',
id: id,
evtId: id
};
var attrs = {
id: id,
name: id
};
var params = {
allowscriptaccess: 'always',
allowNetworking: 'all'
};
var $dom = $('<div><div id="'+ id +'"></div></div>')
.css({position: 'absolute', left: -999, width: 5, height: 5, overflow: 'hidden'})
.appendTo('body')
;
webshim.mediaelement.jarisEvent = webshim.mediaelement.jarisEvent || {};
webshim.mediaelement.jarisEvent[id] = function(jaris){
hasCamera = jaris.cameras;
$dom.remove();
if(hasCamera){
resolve();
} else {
reject();
}
};
checkCameras = $.noop;
swfmini.embedSWF(playerSwfPath, id, "100%", "100%", "11.3", false, vars, params, attrs);
};
} else {
hasCamera = -1;
resolve();
}
})();
var loadPicker = function(){
webshim.ready('WINDOWLOAD', function(){
webshim.loader.loadList(['mediacapture-picker']);
});
loadPicker = $.noop;
};
var _createPhotoPicker = function(){
if($(this).is('[capture].ws-filereader, .ws-capture') && webshim.implement(this, 'capture')){
var $wrapper, $customFile;
var $fileinput = $(this);
var $button = $('<button type="button" class="ws-capture-button">photo</button>');
var popover = webshim.objectCreate(webshim.wsPopover, {}, $.extend({prepareFor: $button}));
popover.element.addClass('capture-popover input-picker');
if($fileinput.is('.ws-custom-file > *')){
$customFile = $fileinput.closest('.ws-custom-file');
$wrapper = $('<div class="ws-capture-file" />').insertAfter($customFile);
$wrapper.append($button).append($customFile);
} else {
$fileinput.before($button);
}
popover.element.insertAfter($button);
$button.on('click', function(){
webshim.mediacapture.showContent($fileinput, $button, popover);
popover.show();
});
loadPicker();
}
};
var createPhotoPicker = function (){
var elem = this;
checkCameras();
cameraListPromise.done(function(){
_createPhotoPicker.call(elem);
});
};
webshim.mediacapture = {
showContent: function($fileinput, $button, popover){
webshim.loader.loadList(['mediacapture-picker']);
webshim.ready('mediacapture-picker', function(){
webshim.mediacapture.showContent($fileinput, $button, popover);
});
}
};
webshim.defineNodeNamesBooleanProperty('input', 'capture');
if(hasCamera){
cameraListPromise.done(function(){
createPhotoPicker = _createPhotoPicker;
webshim.loader.addModule('mediacapture-picker', {
noAutoCallback: true,
css: 'styles/forms-picker.css',
options: featureOptions
});
});
webshim.addReady(function(context, insertedElement){
$(sel, context).add(insertedElement.filter(sel))
.filter('[accept*="image"], :not([accept]), [accept=""]')
.each(createPhotoPicker)
;
});
webshim.ready('WINDOWLOAD', checkCameras);
}
if(document.readyState == 'complete'){
webshim.isReady('WINDOWLOAD', true);
}
});

View File

@ -58,9 +58,16 @@
})();
}
if(window.CanvasRenderingContext2D && CanvasRenderingContext2D.prototype){
CanvasRenderingContext2D.prototype.wsImageComplete = function(cb){
cb.call(this, this);
};
}
webshims.register('mediaelement-core', function($, webshims, window, document, undefined, options){
var hasSwf = swfmini.hasFlashPlayerVersion('11.3');
var mediaelement = webshims.mediaelement;
var allowYtLoading = false;
mediaelement.parseRtmp = function(data){
var src = data.src.split('://');
@ -156,7 +163,9 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
return function(){
if(loaded || !hasYt){return;}
loaded = true;
webshims.loader.loadScript("https://www.youtube.com/player_api");
if(allowYtLoading){
webshims.loader.loadScript("https://www.youtube.com/player_api");
}
$(function(){
webshims._polyfill(["mediaelement-yt"]);
});
@ -342,6 +351,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
}
});
if(!requested && hasYt && !mediaelement.createSWF){
allowYtLoading = true;
loadYt();
}
};
@ -506,6 +516,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
.add(insertedElement.filter('video, audio'))
.each(function(){
if(!mediaelement.canNativePlaySrces(this)){
allowYtLoading = true;
loadThird();
handleMedia = true;
return false;
@ -528,6 +539,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
mediaelement.loadDebugger();
});
}
//set native implementation ready, before swf api is retested
if(hasNative){
webshims.isReady('mediaelement-core', true);

View File

@ -124,12 +124,13 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
};
mediaelement.jarisEvent = {};
mediaelement.jarisEvent = mediaelement.jarisEvent || {};
var localConnectionTimer;
var onEvent = {
onPlayPause: function(jaris, data, override){
var playing, type;
var idled = data.paused || data.ended;
if(override == null){
try {
playing = data.api.api_get("isPlaying");
@ -143,12 +144,15 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
type = data.paused ? 'pause' : 'play';
data._ppFlag = true;
trigger(data._elem, type);
}
if(!data.paused || playing == idled || playing == null){
if(data.readyState < 3){
setReadyState(3, data);
}
if(!data.paused){
trigger(data._elem, 'playing');
}
}
if(!data.paused){
trigger(data._elem, 'playing');
}
},
onSeek: function(jaris, data){
@ -900,11 +904,11 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
options.changeSWF(vars, elem, canPlaySrc, data, 'embed');
clearTimeout(data.flashBlock);
swfmini.embedSWF(playerSwfPath, elemId, "100%", "100%", "9.0.115", false, vars, params, attrs, function(swfData){
swfmini.embedSWF(playerSwfPath, elemId, "100%", "100%", "11.3", false, vars, params, attrs, function(swfData){
if(swfData.success){
var fBlocker = function(){
if((!swfData.ref.parentNode && box[0].parentNode) || swfData.ref.style.display == "none"){
box.addClass('flashblocker-assumed');
if((!swfData.ref.parentNode) || swfData.ref.style.display == "none"){
$(elem).trigger('flashblocker');
webshims.warn("flashblocker assumed");
}
@ -1138,8 +1142,19 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
webshim.error('canvas.drawImage feature is needed. In IE8 flashvanvas pro can be used');
}
CanvasRenderingContext2D.prototype.wsImageComplete = function(cb){
if(this._wsIsLoading){
if(!this._wsLoadingCbs){
this._wsLoadingCbs = [];
}
this._wsLoadingCbs.push(cb);
} else {
cb.call(this, this);
}
};
CanvasRenderingContext2D.prototype.drawImage = function(elem){
var data, img, args, imgData;
var data, img, args, imgData, hadCachedImg;
var context = this;
if(isVideo[elem.nodeName] && (data = webshims.data(elem, 'mediaelement')) && data.isActive == 'third' && data.api.api_image){
@ -1157,18 +1172,39 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
}
args = slice.call(arguments, 1);
img = new Image();
if(options.canvasSync && data.canvasImg){
args.unshift(data.canvasImg);
_drawImage.apply(context, args);
args = slice.call(arguments, 1);
hadCachedImg = true;
}
img = document.createElement('img');
//todo find a performant sync way
img.onload = function(){
args.unshift(this);
_drawImage.apply(context, args);
img.onload = null;
if(options.canvasSync){
data.canvasImg = img;
if(hadCachedImg && options.noDoubbleDraw){
return;
}
}
_drawImage.apply(context, args);
context._wsIsLoading = false;
if(context._wsLoadingCbs && context._wsLoadingCbs.length){
while(context._wsLoadingCbs.length){
context._wsLoadingCbs.shift().call(context, context);
}
}
};
img.src = 'data:image/jpeg;base64,'+imgData;
if(img.complete){
this._wsIsLoading = true;
if(img.complete && img.onload){
img.onload();
}
return;

View File

@ -2,13 +2,21 @@ webshims.register('mediaelement-yt', function($, webshims, window, document, und
"use strict";
var mediaelement = webshims.mediaelement;
var ytAPI = $.Deferred();
var loadYTAPI = function(){
if(!window.YT){
webshims.loader.loadScript("https://www.youtube.com/player_api");
}
loadYTAPI = $.noop;
};
var modern = window.Modernizr;
var assumeYTBug = (!modern || !modern.videoautoplay) && /iP(hone|od|ad)|android/i.test(navigator.userAgent);
window.onYouTubePlayerAPIReady = function() {
ytAPI.resolve();
loadYTAPI = $.noop;
};
if(window.YT && YT.Player){
window.onYouTubePlayerAPIReady();
}
var getProps = {
paused: true,
ended: false,
@ -45,7 +53,6 @@ var getSetProps = {
volume: 1,
muted: false
};
var getSetPropKeys = Object.keys(getSetProps);
var playerStateObj = $.extend({
isActive: 'html5',
@ -193,7 +200,6 @@ var getComputedDimension = (function(){
var setElementDimension = function(data){
var dims;
var elem = data._elem;
var box = data.shadowElem;
if(data.isActive == 'third'){
if(data && data._ytAPI && data._ytAPI.getPlaybackQuality){
@ -439,9 +445,9 @@ var addYtAPI = function(mediaElm, elemId, data, ytParams){
var currentTime = data._ytAPI.getCurrentTime();
if(data.currentTime != currentTime){
data.currentTime = currentTime;
$(mediaElm).trigger('timeupdate');
$.event.trigger('timeupdate', null, mediaElm, true);
}
}, 350);
}, 270);
};
data._metatrys = 0;
@ -569,7 +575,9 @@ mediaelement.createSWF = function(mediaElem, src, data){
var ytParams = getYtParams(src.src);
var hasControls = $.prop(mediaElem, 'controls');
var attrStyle = {};
loadYTAPI();
if((attrStyle.height = $.attr(mediaElem, 'height') || '') || (attrStyle.width = $.attr(mediaElem, 'width') || '')){
$(mediaElem).css(attrStyle);
webshims.warn("width or height content attributes used. Webshims prefers the usage of CSS (computed styles or inline styles) to detect size of a video/audio. It's really more powerfull.");
@ -739,8 +747,12 @@ mediaelement.createSWF = function(mediaElem, src, data){
var data = getYtDataFromElem(this);
if(data){
if(data._ytAPI && data._ytAPI[ytName]){
data._ytAPI[ytName]();
handlePlayPauseState(name, data);
if(assumeYTBug && !data.readyState && !data.networkState && data._ppFlag === undefined){
webshims.warn('youtube video play needs to be directly activated by user, if you use a video overlay set pointer-events to none.');
} else {
data._ytAPI[ytName]();
handlePlayPauseState(name, data);
}
}
} else {
return mediaSup[name].prop._supvalue.apply(this, arguments);

View File

@ -0,0 +1,585 @@
webshim.register('sticky', function($, webshim, window, document, undefined, featureOptions){
"use strict";
var uid = 0;
var stickys = 0;
var $window = $(window);
function getCssValue(property, value, noPrefixes) {
var prop = property + ':',
el = document.createElement('test'),
mStyle = el.style;
if (!noPrefixes) {
mStyle.cssText = prop + [ '-webkit-', '-moz-', '-ms-', '-o-', '' ].join(value + ';' + prop) + value + ';';
} else {
mStyle.cssText = prop + value;
}
return mStyle[ property ];
}
function getPos() {
return {
top: $.css(this, 'top'),
bottom: $.css(this, 'bottom')
};
}
var getWinScroll = (function () {
var docElem;
var prop = 'pageYOffset';
return (prop in window) ?
function () {
return window[ prop ];
} :
((docElem = document.documentElement), function () {
return docElem.scrollTop;
})
;
})();
var isTouch = 'ontouchstart' in window || window.matchMedia('(max-device-width: 721px)').matches;
var support = {
fixed: getCssValue('position', 'fixed', true),
sticky: getCssValue('position', 'sticky')
};
var stickyMixin = {
getPosition: function () {
if(!this.isSticky){
this.position = {
top: this.$el.css('top'),
bottom: this.$el.css('bottom')
};
if (((
(this.position.top != 'auto' && this.position.bottom != 'auto') ||
this.position.top == 'auto' && this.position.bottom == 'auto')) && this.$el.css('position') == 'static') {
this.position = $.swap(this.$el[0], {position: 'absolute'}, getPos);
}
if (this.position.top !== 'auto') {
this.ankered = 'top';
} else if (this.position.bottom !== 'auto') {
this.ankered = 'bottom';
}
if(this.ankered == 'top'){
this.position.top = parseFloat(this.position.top, 10) || 0;
} else if(this.ankered == 'bottom'){
this.position.bottom = parseFloat(this.position.bottom, 10) || 0;
}
}
},
update: function (full) {
if (!this.disabled && this.$el[0].offsetWidth) {
if (full) {
if(this.isSticky){
this.removeSticky();
}
this.getPosition();
}
this.updateDimension();
}
},
setTdWidth: function(){
if(this.isTable){
this.$el.find('td, th').each(this._setInlineWidth);
}
},
_setInlineWidth: function(){
$.data(this, 'inlineWidth', this.style.width);
$(this).innerWidth($(this).innerWidth());
},
_restoreInlineWidth: function(){
this.style.width = $.data(this, 'inlineWidth') || '';
$.removeData(this, 'inlineWidth');
},
removeSticky: function(){
this.$el.removeClass('ws-sticky-on');
this.$el.css(this.stickyData.inline);
this.$placeholder.detach();
this.isSticky = false;
if(this.isTable){
this.$el.find('td, th').each(this._restoreInlineWidth);
}
},
commonAddEvents: function(){
var enableDisable;
var that = this;
var update = function() {
that.update();
};
var stickyMedia = this.$el.data('stickymedia');
var media = window.matchMedia && stickyMedia ? matchMedia(stickyMedia) : false;
$window.one('load', update);
$(document).on('updateshadowdom' + this.evtid, update);
this.$el.on('updatesticky'+ this.evtid, function(e){
that.update(true);
e.stopPropagation();
});
this.$el.on('disablesticky'+ this.evtid, function(e){
that.disable(true);
e.stopPropagation();
});
this.$el.on('enablesticky'+ this.evtid, function(e){
that.disable(false);
e.stopPropagation();
});
this.$el.on('remove'+ this.evtid+' destroysticky'+ this.evtid, function(e) {
$window.off(that.evtid);
$(document).off(that.evtid);
that.$el.off(that.evtid);
that.$parent.off(that.evtid);
that.$el.removeData('wsSticky').removeClass('ws-sticky');
if (that.$placeholder) {
that.$el.removeClass('ws-sticky-on');
that.$placeholder.remove();
}
stickys--;
e.stopPropagation();
});
if(media && media.addListener){
enableDisable = function(){
that.disable(!media.matches);
};
media.addListener(enableDisable);
enableDisable();
}
},
disable: function(disable){
if(!arguments.length){
return this.disabled;
}
if(this.disabled != disable){
this.disabled = !!disable;
if(this.disabled){
if(this.isSticky){
this.removeSticky();
}
} else {
this.update(true);
}
}
},
setSticky: function(){
if (!this.$placeholder) {
this.$placeholder = this.isTable ? $(this.$el[0].cloneNode(true)) : $(document.createElement(this.$el[0].nodeName || 'div'));
this.$placeholder.addClass('ws-fixedsticky-placeholder').removeClass('ws-sticky');
}
this.setTdWidth();
this.$placeholder
.insertAfter(this.$el)
.outerHeight(this.stickyData.outerHeight, true)
.outerWidth(this.stickyData.outerWidth)
;
this.isSticky = true;
this.$el.addClass('ws-sticky-on');
if(!this.isTable){
if( this.stickyData.width != this.$el.width()){
this.$el.width(this.stickyData.width);
}
}
},
getCommonStickyData: function(){
var marginTop = (parseFloat(this.$el.css('marginTop'), 10) || 0);
this.stickyData.scrollTop = this.stickyData.top - marginTop;
this.stickyData.outerHeight = this.$el.outerHeight(true);
this.stickyData.bottom = this.stickyData.top + this.stickyData.outerHeight - marginTop;
this.stickyData.width = this.$el.width();
this.stickyData.outerWidth = this.$el.outerWidth();
this.stickyData.marginLeft = parseFloat(this.$el.css('marginLeft'), 10) || 0;
this.stickyData.offsetLeft = this.$el[0].offsetLeft;
this.stickyData.inline.width = this.elStyle.width;
this.stickyData.inline.marginLeft = this.elStyle.marginLeft;
if(this.ankered == 'top'){
this.stickyData.inline.top = this.elStyle.top;
} else if(this.ankered == 'bottom'){
this.stickyData.inline.bottom = this.elStyle.bottom;
}
},
getCommonParentData: function(){
this.parentData.paddingTop = (parseFloat(this.$parent.css('paddingTop'), 10) || 0);
this.parentData.offsetTop = this.$parent.offset().top;
this.parentData.top = this.parentData.offsetTop + (parseFloat(this.$parent.css('borderTopWidth'), 10) || 0) + this.parentData.paddingTop;
this.parentData.height = this.$parent.height();
this.parentData.bottom = this.parentData.top + this.parentData.height;
}
};
if(isTouch && featureOptions.touchStrategy == 'disable'){return;}
function Sticky(dom) {
uid++;
stickys++;
this.evtid = '.wsstickyid' + uid;
this.$el = $(dom).data('wsSticky', this);
this.isTable = this.$el.is('thead, tbody, tfoot');
this.$parent = this.$el.parent();
this.elStyle = dom.style;
this.ankered = '';
this.isSticky = false;
this.$placeholder = null;
this.stickyData = {inline: {}};
this.parentData = {};
this.getParentData = this.getCommonParentData;
this.addEvents();
this.update(true);
}
$.extend(Sticky.prototype, stickyMixin, {
addEvents: function () {
var that = this;
this.commonAddEvents();
$window
.on('scroll' + this.evtid, function () {
if (!that.disabled && that.ankered && that.$el[0].offsetWidth) {
that.updatePos();
}
})
;
},
getStickyData: function(){
this.stickyData.top = this.$el.offset().top;
this.getCommonStickyData();
},
updateDimension: function(fromPos){
if(this.isSticky){
this.removeSticky();
}
this.getParentData();
this.getStickyData();
if (this.ankered == 'bottom') {
this.viewportBottomAnker = $window.height() - this.position.bottom;
}
if(!fromPos && this.ankered){
this.updatePos(true);
}
},
updatePos: function(fromDimension){
var offset, shouldSticky, shouldMoveWith;
var scroll = getWinScroll();
if (this.ankered == 'top') {
offset = scroll + this.position.top;
if(this.stickyData.scrollTop < offset && scroll - 9 <= this.parentData.bottom){
shouldMoveWith = ((offset + this.stickyData.outerHeight) - this.parentData.bottom) * -1;
shouldSticky = true;
}
} else if (this.ankered == 'bottom') {
offset = scroll + this.viewportBottomAnker;
if(this.stickyData.bottom > offset &&
offset + 9 >= this.parentData.top){
shouldSticky = true;
shouldMoveWith = offset - this.parentData.top - this.stickyData.outerHeight;
}
}
if (shouldSticky) {
if (!this.isSticky) {
//updateDimension before layout trashing
if(!fromDimension){
this.updateDimension(true);
}
this.setSticky();
}
if(shouldMoveWith < 0){
if(this.ankered == 'top'){
this.elStyle.top = this.position.top + shouldMoveWith +'px';
} else if(this.ankered == 'bottom'){
this.elStyle.bottom = this.position.bottom + shouldMoveWith +'px';
}
}
} else if (this.isSticky) {
this.removeSticky();
}
}
});
function StickyParent(dom) {
uid++;
stickys++;
this.evtid = '.wsstickyid' + uid;
this.$el = $(dom).data('wsSticky', this);
this.isTable = this.$el.is('thead, tbody, tfoot');
this.$parent = this.$el.parent();
this.elStyle = dom.style;
this.ankered = '';
this.isSticky = false;
this.$placeholder = null;
this.stickyData = {inline: {}};
this.parentData = {};
if(this.$parent.css('position') == 'static'){
this.$parent.css('position', 'relative');
}
this.updatePos2 = this.updatePos2.bind(this);
this.addEvents();
this.update(true);
}
$.extend(StickyParent.prototype, stickyMixin, {
addEvents: function () {
var that = this;
this.commonAddEvents();
this.$parent
.on('scroll' + this.evtid, function () {
if (that.ankered && that.$el[0].offsetWidth) {
that.updatePos();
}
})
;
},
getStickyData: function(){
this.stickyData.top = this.$el[0].offsetTop;
this.getCommonStickyData();
},
getParentData: function(){
this.getCommonParentData();
this.parentData.offsetBottom = this.parentData.top + this.$parent.outerHeight();
},
updateDimension: function(fromPos){
var add;
if(this.isSticky){
this.removeSticky();
}
this.getParentData();
this.getStickyData();
this.viewport = $window.height();
if(this.ankered == 'top'){
add = Math.abs(this.position.top) + 9;
} else if(this.ankered == 'bottom') {
add = Math.abs(this.position.bottom) + 9;
this.viewportBottomAnker = this.viewport - this.parentData.bottom;
this.compareBottom = this.stickyData.bottom + this.position.bottom;
this.addBottom = (this.parentData.bottom - this.parentData.paddingTop) - this.viewport;
}
this.viewPortMax = this.parentData.offsetBottom + add + 10;
this.viewPortMin = this.parentData.offsetTop - add - this.viewport;
if(!fromPos){
this.updatePos(true);
}
},
updatePos: function(fromDimension){
var offset, shouldSticky;
var scroll = this.$parent[0].scrollTop;
if (this.ankered == 'top') {
offset = scroll + this.position.top ;
if(this.stickyData.scrollTop - this.parentData.paddingTop < offset){
shouldSticky = true;
}
} else if (this.ankered == 'bottom') {
if(scroll + this.parentData.height < this.compareBottom){
shouldSticky = true;
}
}
if (shouldSticky) {
if (!this.isSticky) {
//updateDimension before layout trashing
if(!fromDimension){
this.updateDimension(true);
}
this.setSticky();
$window
.off('scroll' + this.evtid, this.updatePos2)
.on('scroll' + this.evtid, this.updatePos2)
;
this.updatePos2(true);
}
} else if (this.isSticky) {
this.removeSticky();
$window.off('scroll' + this.evtid, this.updatePos2);
}
},
updatePos2: function(init){
var scrollTop = getWinScroll();
if(init === true || (this.viewPortMax > scrollTop && scrollTop > this.viewPortMin)){
if(this.ankered == 'top'){
if(init === true || (this.viewPortMax > scrollTop && scrollTop > this.viewPortMin)){
this.elStyle.top = this.position.top + this.parentData.top - scrollTop +'px';
}
} else if(this.ankered == 'bottom'){
this.elStyle.bottom = this.position.bottom + (scrollTop - this.addBottom) +'px';
}
}
}
});
var loadDomSupport = function(){
loadDomSupport = $.noop;
webshim.ready('WINDOWLOAD', function(){
webshim.loader.loadList(['dom-extend']);
webshim.ready('dom-extend', function(){
webshim.addShadowDom();
});
});
};
var addSticky = function(){
var stickyData = $.data(this, 'wsSticky');
if(!stickyData){
var $parent = $(this).parent();
$(this).addClass('ws-sticky');
if(($parent.css('overflowY') || $parent.css('overflow') || 'visible') == 'visible'){
new Sticky(this);
} else {
//webshim.warn('currently not supported');
new StickyParent(this);
}
loadDomSupport();
} else if(stickyData.disable) {
stickyData.disable(false);
}
};
if (!support.sticky && support.fixed) {
var selectors = {};
var createUpdateDomSearch = function(media, sels){
var i, created, elems;
var updated = [];
if(!selectors[media]){
selectors[media] = {sels: {}, string: '',
fn: function(context, insertedElement){
var elems = $(selectors[media].string, context).add(insertedElement.filter(selectors[media].string));
if(media){
elems.data('stickymedia', media);
}
elems.each(addSticky);
}
};
created = true;
}
for(i = 0; i < sels.length; i++){
if(!selectors[media].sels[sels[i]]){
selectors[media].sels[sels[i]] = true;
updated.push(sels[i]);
}
}
if(!created && !updated.length){return;}
selectors[media].string = Object.keys(selectors[media].sels).join(', ');
if(created){
$(function(){
webshim.addReady(selectors[media].fn);
});
} else if($.isReady){
elems = $(updated.join(', '));
if(media){
elems.data('stickymedia', media);
}
elems.each(addSticky);
}
};
createUpdateDomSearch('', ['.ws-sticky']);
$(function(){
$(document).on('wssticky', function(e){
addSticky.call(e.target);
});
});
if(featureOptions.parseCSS){
if(window.Polyfill && Polyfill.prototype && Polyfill.prototype.doMatched){
var onEnableRule = function(rule){
var curSelectors = rule.getSelectors().split(/\,\s*/g);
var media = (!rule._rule.media || !rule._rule.media.length) ? '' : rule.getMedia();
createUpdateDomSearch(media || '', curSelectors);
};
Polyfill({declarations:["position:sticky"]})
.doMatched(function(rules){
rules.each(onEnableRule);
})
;
} else {
webshim.warn('Polyfill for CSS polyfilling made easy has to be included');
}
}
}
if(document.readyState == 'complete'){
webshim.isReady('WINDOWLOAD', true);
}
});

View File

@ -439,3 +439,23 @@ SASS:
}
/* helper classes to hide show/hide specific picker features */
.capture-popover .ws-po-box {
padding-left: 0.30769em;
padding-right: 0.30769em;
}
.ws-videocapture-view {
position: relative;
height: 0;
width: 100%;
padding-bottom: 70%;
}
.ws-videocapture-view .ws-video-overlay,
.ws-videocapture-view video,
.ws-videocapture-view .polyfill-video {
position: absolute !important;
top: 0;
left: 0;
width: 100% !important;
height: 100% !important;
}

View File

@ -474,3 +474,26 @@ $button-bgcolor: #f5f5f5;
@extend %#{$class};
}
}
.capture-popover .ws-po-box {
padding-left: em(4);
padding-right: em(4);
}
.ws-videocapture-view {
position: relative;
height: 0;
width: 100%;
padding-bottom: 70%;
.ws-video-overlay,
video,
.polyfill-video {
position: absolute !important;
top: 0;
left: 0;
width: 100% !important;
height: 100% !important;
}
}

View File

@ -602,7 +602,8 @@ summary.summary-has-focus {
outline-offset: -1px;
}
.ws-custom-file {
.ws-custom-file,
.ws-capture-file {
position: relative;
overflow: hidden;
@ -632,7 +633,9 @@ summary.summary-has-focus {
margin-right: 0.4em;
float: left;
}
}
.ws-custom-file {
.ws-file-value {
display: block;
overflow: hidden;
@ -640,39 +643,6 @@ summary.summary-has-focus {
text-overflow: ellipsis;
}
&:hover > button,
&.ws-mouseenter > button,
> input[type="file"]:focus ~ button {
background: #fff;
border-color: #999;
background: #eee linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1));
}
&:hover > .ws-file-value,
&.ws-mouseenter > .ws-file-value,
> input[type="file"]:focus ~ .ws-file-value {
border-color: #999;
}
&.ws-active > button,
> input[type="file"]:active ~ button {
border-color: #000;
}
&.ws-active > .ws-file-value,
> input[type="file"]:active ~ .ws-file-value {
border-color: #000;
}
> input[type="file"][disabled] ~ .ws-file-value,
> input[type="file"][disabled] ~ button {
border-color: #bbb;
background: #eee;
color: #999;
}
> input[type="file"],
.ws-coverfile {
position: absolute;
@ -717,4 +687,74 @@ summary.summary-has-focus {
> .moxie-shim {
z-index: 20;
}
&:hover > button,
&.ws-mouseenter > button,
> input[type="file"]:focus ~ button {
background: #fff;
border-color: #999;
background: #eee linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1));
}
&:hover > .ws-file-value,
&.ws-mouseenter > .ws-file-value,
> input[type="file"]:focus ~ .ws-file-value {
border-color: #999;
}
&.ws-active > button,
> input[type="file"]:active ~ button {
border-color: #000;
}
&.ws-active > .ws-file-value,
> input[type="file"]:active ~ .ws-file-value {
border-color: #000;
}
> input[type="file"][disabled] ~ .ws-file-value,
> input[type="file"][disabled] ~ button {
border-color: #bbb;
background: #eee;
color: #999;
}
}
.ws-sticky {
top: auto;
left: auto !important;
right: auto !important;
bottom: auto;
position: static;
position: -webkit-sticky;
position: -moz-sticky;
position: -ms-sticky;
position: -o-sticky;
position: sticky;
float: none !important;
margin-left: 0;
margin-right: 0;
}
thead.ws-sticky,
tbody.ws-sticky,
tfoot.ws-sticky {
margin-left: -0.8px;
margin-right: -1px;
}
.ws-sticky.ws-sticky-on {
position: fixed !important;
}
.ws-fixedsticky-placeholder {
position: static !important;
visibility: hidden !important;
padding: 0;
border: none;
margin: 0;
left: -999px;
zoom: 1;
}

View File

@ -5,7 +5,8 @@
top: -999999px;
}
.ws-po-box button, .ws-custom-file > button {
.ws-po-box button, .ws-custom-file > button,
.ws-capture-file > button {
display: inline-block;
overflow: visible;
position: relative;
@ -21,11 +22,13 @@
line-height: inherit;
touch-action: none;
}
.ws-po-box button::-moz-focus-inner, .ws-custom-file > button::-moz-focus-inner {
.ws-po-box button::-moz-focus-inner, .ws-custom-file > button::-moz-focus-inner,
.ws-capture-file > button::-moz-focus-inner {
border: 0;
padding: 0;
}
.ws-po-box button[disabled], .ws-custom-file > button[disabled] {
.ws-po-box button[disabled], .ws-custom-file > button[disabled],
.ws-capture-file > button[disabled] {
cursor: default;
color: #888;
}
@ -587,17 +590,22 @@ summary.summary-has-focus {
outline-offset: -1px;
}
.ws-custom-file {
.ws-custom-file,
.ws-capture-file {
position: relative;
overflow: hidden;
}
.ws-custom-file > button,
.ws-custom-file > input {
.ws-custom-file > input,
.ws-capture-file > button,
.ws-capture-file > input {
box-sizing: border-box;
cursor: pointer;
}
.ws-custom-file > button,
.ws-custom-file > .ws-file-value {
.ws-custom-file > .ws-file-value,
.ws-capture-file > button,
.ws-capture-file > .ws-file-value {
position: relative;
z-index: 0;
display: inline-block;
@ -607,40 +615,18 @@ summary.summary-has-focus {
color: #333;
transition: 400ms all;
}
.ws-custom-file > button {
.ws-custom-file > button,
.ws-capture-file > button {
margin-right: 0.4em;
float: left;
}
.ws-custom-file .ws-file-value {
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.ws-custom-file:hover > button, .ws-custom-file.ws-mouseenter > button,
.ws-custom-file > input[type="file"]:focus ~ button {
background: #fff;
border-color: #999;
background: #eeeeee linear-gradient(transparent, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1));
}
.ws-custom-file:hover > .ws-file-value, .ws-custom-file.ws-mouseenter > .ws-file-value,
.ws-custom-file > input[type="file"]:focus ~ .ws-file-value {
border-color: #999;
}
.ws-custom-file.ws-active > button,
.ws-custom-file > input[type="file"]:active ~ button {
border-color: #000;
}
.ws-custom-file.ws-active > .ws-file-value,
.ws-custom-file > input[type="file"]:active ~ .ws-file-value {
border-color: #000;
}
.ws-custom-file > input[type="file"][disabled] ~ .ws-file-value,
.ws-custom-file > input[type="file"][disabled] ~ button {
border-color: #bbb;
background: #eee;
color: #999;
}
.ws-custom-file > input[type="file"],
.ws-custom-file .ws-coverfile {
position: absolute;
@ -680,6 +666,67 @@ summary.summary-has-focus {
.ws-custom-file > .moxie-shim {
z-index: 20;
}
.ws-custom-file:hover > button, .ws-custom-file.ws-mouseenter > button,
.ws-custom-file > input[type="file"]:focus ~ button {
background: #fff;
border-color: #999;
background: #eeeeee linear-gradient(transparent, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1));
}
.ws-custom-file:hover > .ws-file-value, .ws-custom-file.ws-mouseenter > .ws-file-value,
.ws-custom-file > input[type="file"]:focus ~ .ws-file-value {
border-color: #999;
}
.ws-custom-file.ws-active > button,
.ws-custom-file > input[type="file"]:active ~ button {
border-color: #000;
}
.ws-custom-file.ws-active > .ws-file-value,
.ws-custom-file > input[type="file"]:active ~ .ws-file-value {
border-color: #000;
}
.ws-custom-file > input[type="file"][disabled] ~ .ws-file-value,
.ws-custom-file > input[type="file"][disabled] ~ button {
border-color: #bbb;
background: #eee;
color: #999;
}
.ws-sticky {
top: auto;
left: auto !important;
right: auto !important;
bottom: auto;
position: static;
position: -webkit-sticky;
position: -moz-sticky;
position: -ms-sticky;
position: -o-sticky;
position: sticky;
float: none !important;
margin-left: 0;
margin-right: 0;
}
thead.ws-sticky,
tbody.ws-sticky,
tfoot.ws-sticky {
margin-left: -0.8px;
margin-right: -1px;
}
.ws-sticky.ws-sticky-on {
position: fixed !important;
}
.ws-fixedsticky-placeholder {
position: static !important;
visibility: hidden !important;
padding: 0;
border: none;
margin: 0;
left: -999px;
zoom: 1;
}
/* style picker api */
/* how to use:

View File

@ -5,7 +5,8 @@
top: -999999px;
}
.ws-po-box button, .ws-custom-file > button {
.ws-po-box button, .ws-custom-file > button,
.ws-capture-file > button {
display: inline-block;
overflow: visible;
position: relative;
@ -21,11 +22,13 @@
line-height: inherit;
touch-action: none;
}
.ws-po-box button::-moz-focus-inner, .ws-custom-file > button::-moz-focus-inner {
.ws-po-box button::-moz-focus-inner, .ws-custom-file > button::-moz-focus-inner,
.ws-capture-file > button::-moz-focus-inner {
border: 0;
padding: 0;
}
.ws-po-box button[disabled], .ws-custom-file > button[disabled] {
.ws-po-box button[disabled], .ws-custom-file > button[disabled],
.ws-capture-file > button[disabled] {
cursor: default;
color: #888;
}
@ -587,17 +590,22 @@ summary.summary-has-focus {
outline-offset: -1px;
}
.ws-custom-file {
.ws-custom-file,
.ws-capture-file {
position: relative;
overflow: hidden;
}
.ws-custom-file > button,
.ws-custom-file > input {
.ws-custom-file > input,
.ws-capture-file > button,
.ws-capture-file > input {
box-sizing: border-box;
cursor: pointer;
}
.ws-custom-file > button,
.ws-custom-file > .ws-file-value {
.ws-custom-file > .ws-file-value,
.ws-capture-file > button,
.ws-capture-file > .ws-file-value {
position: relative;
z-index: 0;
display: inline-block;
@ -607,40 +615,18 @@ summary.summary-has-focus {
color: #333;
transition: 400ms all;
}
.ws-custom-file > button {
.ws-custom-file > button,
.ws-capture-file > button {
margin-right: 0.4em;
float: left;
}
.ws-custom-file .ws-file-value {
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.ws-custom-file:hover > button, .ws-custom-file.ws-mouseenter > button,
.ws-custom-file > input[type="file"]:focus ~ button {
background: #fff;
border-color: #999;
background: #eeeeee linear-gradient(transparent, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1));
}
.ws-custom-file:hover > .ws-file-value, .ws-custom-file.ws-mouseenter > .ws-file-value,
.ws-custom-file > input[type="file"]:focus ~ .ws-file-value {
border-color: #999;
}
.ws-custom-file.ws-active > button,
.ws-custom-file > input[type="file"]:active ~ button {
border-color: #000;
}
.ws-custom-file.ws-active > .ws-file-value,
.ws-custom-file > input[type="file"]:active ~ .ws-file-value {
border-color: #000;
}
.ws-custom-file > input[type="file"][disabled] ~ .ws-file-value,
.ws-custom-file > input[type="file"][disabled] ~ button {
border-color: #bbb;
background: #eee;
color: #999;
}
.ws-custom-file > input[type="file"],
.ws-custom-file .ws-coverfile {
position: absolute;
@ -680,3 +666,64 @@ summary.summary-has-focus {
.ws-custom-file > .moxie-shim {
z-index: 20;
}
.ws-custom-file:hover > button, .ws-custom-file.ws-mouseenter > button,
.ws-custom-file > input[type="file"]:focus ~ button {
background: #fff;
border-color: #999;
background: #eeeeee linear-gradient(transparent, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1));
}
.ws-custom-file:hover > .ws-file-value, .ws-custom-file.ws-mouseenter > .ws-file-value,
.ws-custom-file > input[type="file"]:focus ~ .ws-file-value {
border-color: #999;
}
.ws-custom-file.ws-active > button,
.ws-custom-file > input[type="file"]:active ~ button {
border-color: #000;
}
.ws-custom-file.ws-active > .ws-file-value,
.ws-custom-file > input[type="file"]:active ~ .ws-file-value {
border-color: #000;
}
.ws-custom-file > input[type="file"][disabled] ~ .ws-file-value,
.ws-custom-file > input[type="file"][disabled] ~ button {
border-color: #bbb;
background: #eee;
color: #999;
}
.ws-sticky {
top: auto;
left: auto !important;
right: auto !important;
bottom: auto;
position: static;
position: -webkit-sticky;
position: -moz-sticky;
position: -ms-sticky;
position: -o-sticky;
position: sticky;
float: none !important;
margin-left: 0;
margin-right: 0;
}
thead.ws-sticky,
tbody.ws-sticky,
tfoot.ws-sticky {
margin-left: -0.8px;
margin-right: -1px;
}
.ws-sticky.ws-sticky-on {
position: fixed !important;
}
.ws-fixedsticky-placeholder {
position: static !important;
visibility: hidden !important;
padding: 0;
border: none;
margin: 0;
left: -999px;
zoom: 1;
}

View File

@ -48,7 +48,10 @@ webshims.register('track-ui', function($, webshims, window, document, undefined)
var usesNativeTrack = function(){
return !options.override && support.texttrackapi;
};
var requestAnimationFrame = window.cancelAnimationFrame && window.requestAnimationFrame || function(fn){
setTimeout(fn, 17);
};
var cancelAnimationFrame = window.cancelAnimationFrame || window.clearTimeout;
var trackDisplay = {
update: function(baseData, media){
if(!baseData.activeCues.length){
@ -169,20 +172,42 @@ webshims.register('track-ui', function($, webshims, window, document, undefined)
return $.extend([], cueListProto);
};
}
function triggerCueEvent(cue, type, baseData, media, trackIndex){
var trackElem, compareTrack;
var cueChange = $.Event('cuechange');
if(!baseData.trackElements){
baseData.trackElements = media[0].getElementsByTagName('track');
}
trackElem = baseData.trackElements[trackIndex];
if(trackElem){
compareTrack = (webshims.data(trackElem, 'trackData') || {track: $.prop(trackElem, 'track')}).track;
if(compareTrack != cue.track){
trackElem = null;
}
}
$.event.trigger(cueChange, null, cue.track, true);
if(trackElem){
$.event.trigger(cueChange, null, trackElem, true);
}
$.event.trigger(type, null, cue, true);
}
mediaelement.getActiveCue = function(track, media, time, baseData){
mediaelement.getActiveCue = function(track, media, time, baseData, trackIndex){
if(!track._lastFoundCue){
track._lastFoundCue = {index: 0, time: 0};
}
if(support.texttrackapi && !options.override && !track._shimActiveCues){
if(!track._shimActiveCues && support.texttrackapi && !options.override){
track._shimActiveCues = mediaelement.createCueList();
}
var i = 0;
var len;
var cue;
var len, cue, delay;
for(; i < track.shimActiveCues.length; i++){
cue = track.shimActiveCues[i];
if(cue.startTime > time || cue.endTime < time){
@ -191,10 +216,20 @@ webshims.register('track-ui', function($, webshims, window, document, undefined)
if(cue.pauseOnExit){
$(media).pause();
}
$(track).triggerHandler('cuechange');
$(cue).triggerHandler('exit');
} else if(track.mode == 'showing' && showTracks[track.kind] && $.inArray(cue, baseData.activeCues) == -1){
baseData.activeCues.push(cue);
triggerCueEvent(cue, 'exit', baseData, media, trackIndex);
} else {
delay = cue.endTime - time;
if(baseData.nextUpdateDelay > delay){
baseData.nextUpdateDelay = delay;
baseData.nextEvent = cue.endTime;
}
if(track.mode == 'showing' && showTracks[track.kind] && $.inArray(cue, baseData.activeCues) == -1){
baseData.activeCues.push(cue);
}
}
}
@ -210,20 +245,182 @@ webshims.register('track-ui', function($, webshims, window, document, undefined)
if(track.mode == 'showing' && showTracks[track.kind]){
baseData.activeCues.push(cue);
}
$(track).triggerHandler('cuechange');
$(cue).triggerHandler('enter');
triggerCueEvent(cue, 'enter', baseData, media, trackIndex);
track._lastFoundCue.time = time;
track._lastFoundCue.index = i;
delay = cue.endTime - time;
if(baseData.nextUpdateDelay > delay){
baseData.nextUpdateDelay = delay;
baseData.nextEvent = cue.endTime;
}
}
if(cue.startTime > time){
delay = cue.startTime - time;
if(baseData.nextUpdateDelay > delay){
baseData.nextUpdateDelay = delay;
baseData.nextEvent = cue.startTime;
}
break;
}
}
};
var filterTrackImplementation = function(){
return webshims.implement(this, 'trackui');
};
var implementTrackUi = function(){
var baseData, trackList, updateTimer, updateTimer2, lastDelay, lastTime, invalidTracksTimer;
var treshHold = 0.27;
var elem = $(this);
var recheckI = 0;
var recheckId;
var reCheck = function(){
recheckI++;
//if recheckI is over 5 video might be paused, stalled or waiting,
//in this case abort and wait for the next play, playing or timeupdate event
if(recheckI < 9){
if(elem.prop('currentTime') > baseData.nextEvent){
recheckI = undefined;
getDisplayCues();
} else {
recheckId = requestAnimationFrame(reCheck);
}
} else {
recheckI = undefined;
}
};
var getDisplayCues = function(e){
var track, time;
if(!trackList || !baseData){
trackList = elem.prop('textTracks');
baseData = webshims.data(elem[0], 'mediaelementBase') || webshims.data(elem[0], 'mediaelementBase', {});
if(!baseData.displayedActiveCues){
baseData.displayedActiveCues = [];
}
}
if (!trackList){return;}
time = elem.prop('currentTime');
if(!time && time !== 0){return;}
if(baseData.nextEvent && e && e.type == 'timeupdate' && time >= lastTime && baseData.nextEvent - time > treshHold && time - lastTime < 9){
return;
}
lastTime = time;
lastDelay = baseData.nextUpdateDelay;
baseData.nextUpdateDelay = Number.MAX_VALUE;
baseData.activeCues = [];
for(var i = 0, len = trackList.length; i < len; i++){
track = trackList[i];
if(track.mode != 'disabled' && track.cues && track.cues.length){
mediaelement.getActiveCue(track, elem, time, baseData, i);
}
}
trackDisplay.update(baseData, elem);
clearTimeout(updateTimer);
if(baseData.nextUpdateDelay <= treshHold && (e || lastDelay != baseData.nextUpdateDelay) && baseData.nextUpdateDelay > 0){
lastDelay = baseData.nextUpdateDelay;
clearTimeout(updateTimer2);
if(recheckId){
cancelAnimationFrame(recheckId);
}
recheckI = 0;
updateTimer2 = setTimeout(reCheck, (baseData.nextUpdateDelay * 1000) + 9);
} else if(baseData.nextUpdateDelay >= Number.MAX_VALUE){
baseData.nextEvent = time + 2;
}
};
var invalidateTrackElems = function(){
if(baseData && baseData.trackElements){
delete baseData.trackElements;
}
};
var onUpdatCues = function(e){
if(baseData && e && (e.type == 'addtrack' || e.type == 'removetrack')){
clearTimeout(invalidTracksTimer);
invalidTracksTimer = setTimeout(invalidateTrackElems, 39);
}
clearTimeout(updateTimer);
updateTimer = setTimeout(getDisplayCues, 40);
};
var addTrackView = function(){
if(!trackList) {
if(baseData && 'blockTrackListUpdate' in baseData){
baseData.blockTrackListUpdate = true;
}
trackList = elem.prop('textTracks');
if(baseData && baseData.blockTrackListUpdate){
baseData.blockTrackListUpdate = false;
}
}
//as soon as change on trackList is implemented in all browsers we do not need to have 'updatetrackdisplay' anymore
$( [trackList] )
.off('.trackview')
.on('change.trackview addtrack.trackview removetrack.trackview', onUpdatCues)
;
elem
.off('.trackview')
.on('emptied.trackview', invalidateTrackElems)
.on('play.trackview playing.trackview updatetrackdisplay.trackview seeked.trackview', onUpdatCues)
.on('timeupdate.trackview', getDisplayCues)
;
};
elem.on('remove', function(e){
if(!e.originalEvent && baseData && baseData.trackDisplay){
setTimeout(function(){
baseData.trackDisplay.remove();
}, 4);
}
});
if(!usesNativeTrack()){
addTrackView();
} else {
if(elem.hasClass('nonnative-api-active')){
addTrackView();
}
elem
.on('mediaelementapichange trackapichange', function(){
if(!usesNativeTrack() || elem.hasClass('nonnative-api-active')){
addTrackView();
} else {
clearTimeout(updateTimer);
clearTimeout(updateTimer2);
if(recheckId){
cancelAnimationFrame(recheckId);
}
trackList = elem.prop('textTracks');
baseData = webshims.data(elem[0], 'mediaelementBase') || webshims.data(elem[0], 'mediaelementBase', {});
$.each(trackList, function(i, track){
if(track._shimActiveCues){
delete track._shimActiveCues;
}
});
$( [trackList] ).off('.trackview');
trackDisplay.hide(baseData);
elem.off('.trackview');
}
})
;
}
};
if(usesNativeTrack()){
(function(){
var block;
@ -265,102 +462,8 @@ webshims.register('track-ui', function($, webshims, window, document, undefined)
webshims.addReady(function(context, insertedElement){
$('video, audio', context)
.add(insertedElement.filter('video, audio'))
.filter(function(){
return webshims.implement(this, 'trackui');
})
.each(function(){
var baseData, trackList, updateTimer, updateTimer2;
var elem = $(this);
var getDisplayCues = function(e){
var track;
var time;
if(!trackList || !baseData){
trackList = elem.prop('textTracks');
baseData = webshims.data(elem[0], 'mediaelementBase') || webshims.data(elem[0], 'mediaelementBase', {});
if(!baseData.displayedActiveCues){
baseData.displayedActiveCues = [];
}
}
if (!trackList){return;}
time = elem.prop('currentTime');
if(!time && time !== 0){return;}
baseData.activeCues = [];
for(var i = 0, len = trackList.length; i < len; i++){
track = trackList[i];
if(track.mode != 'disabled' && track.cues && track.cues.length){
mediaelement.getActiveCue(track, elem, time, baseData);
}
}
trackDisplay.update(baseData, elem);
};
var onUpdate = function(e){
clearTimeout(updateTimer);
if(e){
if(e.type == 'timeupdate'){
getDisplayCues();
}
updateTimer2 = setTimeout(onUpdate, 90);
} else {
updateTimer = setTimeout(getDisplayCues, 9);
}
};
var addTrackView = function(){
if(!trackList) {
trackList = elem.prop('textTracks');
}
//as soon as change on trackList is implemented in all browsers we do not need to have 'updatetrackdisplay' anymore
$( [trackList] ).on('change', onUpdate);
elem
.off('.trackview')
.on('play.trackview timeupdate.trackview updatetrackdisplay.trackview', onUpdate)
;
};
elem.on('remove', function(e){
if(!e.originalEvent && baseData && baseData.trackDisplay){
setTimeout(function(){
baseData.trackDisplay.remove();
}, 4);
}
});
if(!usesNativeTrack()){
addTrackView();
} else {
if(elem.hasClass('nonnative-api-active')){
addTrackView();
}
elem
.on('mediaelementapichange trackapichange', function(){
if(!usesNativeTrack() || elem.hasClass('nonnative-api-active')){
addTrackView();
} else {
clearTimeout(updateTimer);
clearTimeout(updateTimer2);
trackList = elem.prop('textTracks');
baseData = webshims.data(elem[0], 'mediaelementBase') || webshims.data(elem[0], 'mediaelementBase', {});
$.each(trackList, function(i, track){
if(track._shimActiveCues){
delete track._shimActiveCues;
}
});
trackDisplay.hide(baseData);
elem.off('.trackview');
}
})
;
}
})
.filter(filterTrackImplementation)
.each(implementTrackUi)
;
});
});

View File

@ -66,8 +66,12 @@ webshims.register('track', function($, webshims, window, document, undefined){
var lastCue = this.cues[this.cues.length-1];
if(lastCue && lastCue.startTime > cue.startTime){
webshims.error("cue startTime higher than previous cue's startTime");
return;
}
}
if(cue.startTime >= cue.endTime ){
webshim.error('startTime >= endTime of cue: '+ cue.text);
}
if(cue.track && cue.track.removeCue){
cue.track.removeCue(cue);
}
@ -159,6 +163,7 @@ webshims.register('track', function($, webshims, window, document, undefined){
for(i = 0, len = added.length; i < len; i++){
$([trackList]).triggerHandler($.Event({type: 'addtrack', track: added[i]}));
}
//todo: remove
if(baseData.scriptedTextTracks || removed.length){
$(this).triggerHandler('updatetrackdisplay');
}
@ -175,7 +180,7 @@ webshims.register('track', function($, webshims, window, document, undefined){
setTimeout(function(){
$(track).closest('audio, video').triggerHandler('updatetrackdisplay');
trackData.isTriggering = false;
}, 1);
}, 9);
}
};
var isDefaultTrack = (function(){
@ -368,15 +373,10 @@ webshims.register('track', function($, webshims, window, document, undefined){
error: error
});
};
if($.ajax && $.ajaxSettings.xhr){
if(isDisabled){
setTimeout(createAjax, loadingTracks * 2);
} else {
createAjax();
}
if(isDisabled){
setTimeout(createAjax, loadingTracks * 2);
} else {
webshims.ready('jajax', createAjax);
webshims.loader.loadList(['jajax']);
createAjax();
}
} catch(er){
error();

View File

@ -5,6 +5,7 @@ webshim.register('usermedia-core', function($, webshim, window, document, undefi
var addUnPrefixed = function(){
navigator.getUserMedia = navigator[webshim.prefixed('getUserMedia', navigator)];
};
if(srcObjectName != 'srcObject'){
var hasURL = !!(window.URL && URL.createObjectURL);
webshim.defineNodeNamesProperty(['audio', 'video'], 'srcObject', {
@ -23,6 +24,32 @@ webshim.register('usermedia-core', function($, webshim, window, document, undefi
});
}
(function(){
var streams = {};
var _nativeCreateObjectURL = URL.createObjectURL;
var _nativeRevokeObjectURL = URL.revokeObjectURL;
URL.createObjectURL = function(stream){
var url = stream;
if(_nativeCreateObjectURL && !stream._wsStreamId){
url = _nativeCreateObjectURL.apply(this, arguments);
} else if(stream._wsStreamId) {
url = stream._wsStreamId;
streams[url] = stream;
}
return url;
};
URL.revokeObjectURL = function(url){
if(streams[url]){
delete streams[url];
} else if (_nativeRevokeObjectURL){
return _nativeRevokeObjectURL.apply(this, arguments);
}
};
})();
webshim.ready(webshim.modules["usermedia-shim"].loaded ? 'usermedia-api' : 'usermedia-shim', addUnPrefixed);
});

View File

@ -1,18 +1,15 @@
webshim.register('usermedia-shim', function($, webshim, window, document, undefined, options){
"use strict";
var addMediaAPI;
var streamUrlPrefix = 'webshimstream';
var id = 0;
var streams = {};
var streamCb = {};
var hasSwf = swfmini.hasFlashPlayerVersion('11.3');
var mediaOptions = webshim.cfg.mediaelement;
var mediaelement = webshim.mediaelement;
var flashEvents = {
NOT_SUPPORTED_ERROR: 1,
PERMISSION_DENIED: 1,
NotSupportedError: 1,
PermissionDeniedError: 1,
//not implemented yet
MANDATORY_UNSATISFIED_ERROR: 1,
ConstraintNotSatisfiedError: 1,
onUserSuccess: 1
};
var noSource = function(){
@ -51,6 +48,13 @@ webshim.register('usermedia-shim', function($, webshim, window, document, undefi
};
addMediaAPI();
/*
{ width: 650 },
{ width: { min: 650 }},
{ frameRate: 60 },
{ width: { max: 800 }},
{ facingMode: "user" }
*/
mediaelement.createSWF(media, {srcProp: src, streamrequest: true, type: 'jarisplayer/stream'});
}
@ -73,6 +77,8 @@ webshim.register('usermedia-shim', function($, webshim, window, document, undefi
function LocalMediaStream(data, api, id){
data._cTNow = Date.now();
data._cTID = false;
webshim.defineProperties(this, {
_swf: {
value: api,
@ -92,20 +98,34 @@ webshim.register('usermedia-shim', function($, webshim, window, document, undefi
LocalMediaStream.prototype = {
currentTime: 0,
stop: function(){
if(this._data._cTID){
clearInterval(this._data._cTID);
}
mediaelement.queueSwfMethod(this._data._elem, 'api_detach', [], this._data);
},
getAudioTracks: $.noop,
getVideoTracks: $.noop
this._data.ended = true;
$(this._data._elem).trigger('ended');
}
};
webshim.usermedia = {
attach: function(elem, canPlaySrc, data){
var $media;
if(data._usermedia == canPlaySrc.srcProp){
mediaelement.queueSwfMethod(data._elem, 'api_attach', [], data);
$(data._elem).trigger('loadstart');
$media = $(data._elem).trigger('loadstart');
data._cTID = setInterval(function(){
if(data.ended){
clearInterval(data._cTID);
} else if(!data.paused){
data.currentTime = (Date.now() - data._cTNow) / 1000;
$media.triggerHandler('timeupdate');
}
}, 250);
if(!data.paused){
mediaelement.queueSwfMethod(data._elem, 'api_play', [], data);
}
} else {
webshim.error('something went wrong');
}
@ -120,30 +140,7 @@ webshim.register('usermedia-shim', function($, webshim, window, document, undefi
}
};
URL._nativeCreateObjectURL = URL.createObjectURL;
URL._nativeRevokeObjectURL = URL.revokeObjectURL;
URL.createObjectURL = function(stream){
var url = '';
if(URL._nativeCreateObjectURL && !stream._wsStreamId){
url = URL._nativeCreateObjectURL(stream);
} else if(stream._wsStreamId) {
url = stream._wsStreamId;
streams[url] = stream;
}
return url;
};
URL.revokeObjectURL = function(url){
if(streams[url]){
delete streams[url];
}
if(URL._nativeRevokeObjectURL){
return URL._nativeRevokeObjectURL(url);
}
};
webshim.usermediastreams = streams;
addMediaAPI = function(){
if(!webshim.mediaelement.createSWF){return;}
@ -161,10 +158,10 @@ webshim.register('usermedia-shim', function($, webshim, window, document, undefi
streamCb[data._usermedia].fail({name: jaris.type});
};
$.extend(mediaelement.onEvent, {
NOT_SUPPORTED_ERROR: fail,
PERMISSION_DENIED: fail,
NotSupportedError: fail,
PermissionDeniedError: fail,
//not implemented yet
MANDATORY_UNSATISFIED_ERROR: fail,
ConstraintNotSatisfiedError: fail,
onUserSuccess: function(jaris, data){
revert(data);
streamCb[data._usermedia].success(new LocalMediaStream(data, data.api, data._usermedia));