Commit e3a0e6b5 authored by hannes's avatar hannes

better solution for #70

parent 7393c063
......@@ -2228,7 +2228,6 @@ function buildQueetHtml(obj, idInStream, extraClasses, requeeted_by, isConversat
// if the reply-to nickname doesn't exist in the notice, we add a class to the reply-to nickname in the header, to make the reply more visible
var mentionedInline = '';
if(obj.statusnet_html.indexOf('>' + replyToScreenName + '<') === -1) {
console.log(obj.statusnet_html);
var mentionedInline = 'not-mentioned-inline';
}
......
......@@ -38,6 +38,37 @@
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
/* ·
·
· Trigger click on <input type="file"> elements
·
· @param inputFile: jQuery element to trigger click on
·
· · · · · · · · · */
function triggerClickOnInputFile(inputFile) {
if(bowser != 'undefined') {
var bowserIntVersion = parseInt(bowser.version,10);
if(bowser.chrome != 'undefined' && bowser.chrome === true && bowserIntVersion < 53
|| bowser.opera != 'undefined' && bowser.opera === true && bowserIntVersion < 39
|| bowser.safari != 'undefined' && bowser.safari === true && bowserIntVersion < 9) {
var evt = document.createEvent("HTMLEvents");
evt.initEvent("click", true, true);
inputFile[0].dispatchEvent(evt);
console.log('triggering click on on input file element with the old trigger hack for older browsers...');
}
else {
inputFile.trigger('click');
console.log('regular click triggered on input file element');
}
}
else {
inputFile.trigger('click');
console.log('no bowser object found: regular click triggered on input file element');
}
console.log(bowser);
}
/* ·
·
......
......@@ -3973,12 +3973,7 @@ $('body').on('click','.upload-cover-photo, .upload-avatar, .upload-background-im
})});
// trigger click
$('#' + inputId).trigger('click');
// chrome, opera and safari now supports above method,
// before we had use the method below for those.
// var evt = document.createEvent("HTMLEvents");
// evt.initEvent("click", true, true);
// $('#' + inputId)[0].dispatchEvent(evt);
triggerClickOnInputFile($('#' + inputId));
});
......@@ -4108,12 +4103,7 @@ $('body').on('click','.upload-image',function () {
});
// trigger click
$('#upload-image-input').trigger('click');
// chrome, opera and safari now supports above method,
// before we had use the method below for those.
// var evt = document.createEvent("HTMLEvents");
// evt.initEvent("click", true, true);
// $('#upload-image-input')[0].dispatchEvent(evt);
triggerClickOnInputFile($('#upload-image-input'));
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment