vendor/assets/javascripts/webshims/shims/combos/25.js in webshims-rails-1.14.6 vs vendor/assets/javascripts/webshims/shims/combos/25.js in webshims-rails-1.15.2
- old
+ new
@@ -62,17 +62,13 @@
var supportHrefNormalized = !('hrefNormalized' in $.support) || $.support.hrefNormalized;
var has = Object.prototype.hasOwnProperty;
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");
+ 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('debug' in webshims){
- webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
- }
-
if (!webshims.cfg.no$Switch) {
var switch$ = function(){
if (window.jQuery && (!window.$ || window.jQuery == window.$) && !window.jQuery.webshims) {
webshims.error("jQuery was included more than once. Make sure to include it only once or try the $.noConflict(extreme) feature! Webshims and other Plugins might not work properly. Or set webshims.cfg.no$Switch to 'true'.");
if (window.$) {
@@ -679,38 +675,42 @@
} else {
docObserve.runs = 0;
}
},
handler: (function(){
+ var evt;
var trigger = function(){
- $(document).triggerHandler('updateshadowdom');
+ $(document).triggerHandler('updateshadowdom', [evt]);
};
- return function(e){
- clearTimeout(resizeTimer);
- resizeTimer = setTimeout(function(){
- if(e.type == 'resize'){
- var width = $window.width();
- var height = $window.width();
+ 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;
-
- docObserve.height = docObserve.getHeight();
- docObserve.width = docObserve.getWidth();
+ if(height == lastHeight && width == lastWidth){
+ return;
}
+ lastHeight = height;
+ lastWidth = width;
+ }
- if(window.requestAnimationFrame){
- requestAnimationFrame(trigger);
- } else {
- setTimeout(trigger, 0);
- }
-
- }, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
+ 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);
+ evt = e;
+ resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
+ };
})(),
_create: function(){
$.each({ Height: "getHeight", Width: "getWidth" }, function(name, type){
var body = document.body;
var doc = document.documentElement;
@@ -1227,15 +1227,15 @@
}
});
})();
});
-;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']);
};
var _createFilePicker = function(){
var $input, picker, $parent, onReset;
@@ -1343,11 +1343,11 @@
}
}
}
);
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 || '')));
};
var createMoxieTransport = function (options){
@@ -1526,10 +1526,14 @@
return tmpTransport;
}
}
};
+ webshim.loader.addModule('moxie', {
+ src: 'moxie/js/moxie-'+ (hasFlash ? 'swf' : 'html4')
+ });
+
if(!featureOptions.progress){
featureOptions.progress = 'onprogress';
}
if(!featureOptions.uploadprogress){
@@ -1537,13 +1541,10 @@
}
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;
}
@@ -1566,12 +1567,12 @@
webshim.defineNodeNameProperty('input', 'files', {
prop: {
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') || [];
}
}
}
@@ -1589,25 +1590,79 @@
picker.disable(boolVal);
}
});
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;
webshim.ready('moxie', function(){
var wsMimes = 'application/xml,xml';
moxie = window.moxie;
mOxie = window.mOxie;
mOxie.Env.swf_url = featureOptions.swfpath;
- mOxie.Env.xap_url = featureOptions.xappath;
window.FileReader = mOxie.FileReader;
window.FormData = function(form){
var appendData, i, len, files, fileI, fileLen, inputName;
@@ -1642,11 +1697,10 @@
}
}
return moxieData;
};
- FormData = window.FormData;
createFilePicker = _createFilePicker;
transports.moxie = createMoxieTransport;
featureOptions.mimeTypes = (featureOptions.mimeTypes) ? wsMimes+','+featureOptions.mimeTypes : wsMimes;
@@ -1827,16 +1881,17 @@
$(data._elem).triggerHandler('seeked');
}
};
- 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");
} catch(e){}
} else {
@@ -1846,17 +1901,20 @@
data.paused = !playing;
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){
data._lastSeektime = jaris.seekTime;
data.seeking = true;
@@ -2603,15 +2661,15 @@
);
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");
}
$(swfData.ref).css({'minHeight': '2px', 'minWidth': '2px', display: 'block'});
};
@@ -2841,12 +2899,23 @@
if(!_drawImage){
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){
try {
@@ -2860,21 +2929,42 @@
webshims.error('video has to be same origin or a crossdomain.xml has to be provided. Video has to be visible for flash API');
}
}
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;
}
return _drawImage.apply(this, arguments);