better solution for #70

This commit is contained in:
Hannes Mannerheim 2016-09-07 14:55:21 +02:00
parent 7393c06302
commit e3a0e6b5c8
3 changed files with 33 additions and 13 deletions

View File

@ -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';
}

View File

@ -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);
}
/* ·
·

View File

@ -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'));
});