Merge pull request #1682 from owncloud/fix-ie8-master

Fix ie8 master
This commit is contained in:
Bart Visscher 2013-02-14 06:10:00 -08:00
commit f4c9d4c067
5 changed files with 50 additions and 13 deletions

View file

@ -3,7 +3,7 @@
var prefix,
property,
// In Opera, `'onfocusin' in document == true`, hence the extra `hasFocus` check to detect IE-like behavior
// In Opera, `'onfocusin' in document == true`, hence the extra `hasFocus` check to detect IE-like behavior
eventName = 'onfocusin' in document && 'hasFocus' in document ? 'focusin focusout' : 'focus blur',
prefixes = ['', 'moz', 'ms', 'o', 'webkit'],
$support = $.support,
@ -19,12 +19,11 @@
$(/blur$/.test(eventName) ? window : document).on(eventName, function (event) {
var type = event.type,
originalEvent = event.originalEvent,
toElement = originalEvent.toElement;
// If its a `{focusin,focusout}` event (IE), `fromElement` and `toElement` should both be `null` or `undefined`;
// else, the page visibility hasnt changed, but the user just clicked somewhere in the doc.
// In IE9, we need to check the `relatedTarget` property instead.
if (!/^focus./.test(type) || (toElement == undefined && originalEvent.fromElement == undefined && originalEvent.relatedTarget == undefined)) {
originalEvent = event.originalEvent;
// If its a `{focusin,focusout}` event (IE), `fromElement` and `toElement` should both be `null` or `undefined`;
// else, the page visibility hasnt changed, but the user just clicked somewhere in the doc.
// In IE9, we need to check the `relatedTarget` property instead.
if (!/^focus./.test(type) || originalEvent == undefined || (originalEvent.toElement == undefined && originalEvent.fromElement == undefined && originalEvent.relatedTarget == undefined)) {
$event.trigger((property && document[property] || /^(?:blur|focusout)$/.test(type) ? 'hide' : 'show') + '.visibility');
}
});

32
core/js/compatibility.js Normal file
View file

@ -0,0 +1,32 @@
//https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== "function") {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function () {},
fBound = function () {
return fToBind.apply(this instanceof fNOP && oThis
? this
: oThis,
aArgs.concat(Array.prototype.slice.call(arguments)));
};
fNOP.prototype = this.prototype;
fBound.prototype = new fNOP();
return fBound;
};
}
//https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim
if(!String.prototype.trim) {
String.prototype.trim = function () {
return this.replace(/^\s+|\s+$/g,'');
};
}

View file

@ -87,8 +87,10 @@ OC.EventSource.prototype={
useFallBack:false,
fallBackCallBack:function(type,data){
if(type){
for(var i=0;i<this.listeners[type].length;i++){
this.listeners[type][i](data);
if (typeof this.listeners['done'] != 'undefined') {
for(var i=0;i<this.listeners[type].length;i++){
this.listeners[type][i](data);
}
}
}else{
for(var i=0;i<this.typelessListeners.length;i++){
@ -117,6 +119,8 @@ OC.EventSource.prototype={
}
},
close:function(){
this.source.close();
if (typeof this.source !='undefined') {
this.source.close();
}
}
}

View file

@ -278,6 +278,7 @@ class OC {
OC_Util::addScript("jquery-showpassword");
OC_Util::addScript("jquery.infieldlabel");
OC_Util::addScript("jquery-tipsy");
OC_Util::addScript("compatibility");
OC_Util::addScript("oc-dialogs");
OC_Util::addScript("js");
OC_Util::addScript("eventsource");

View file

@ -92,11 +92,12 @@ var UserList = {
UserList.applyMultiplySelect(subadminSelect);
}
if (tr.find('td.remove img').length == 0 && OC.currentUser != username) {
var rm_img = $('<img>', {
class: 'svg action',
var rm_img = $('<img class="svg action">').attr({
src: OC.imagePath('core', 'actions/delete')
});
var rm_link = $('<a>', { class: 'action delete', href: '#', 'original-title': t('settings', 'Delete')}).append(rm_img);
var rm_link = $('<a class="action delete">')
.attr({ href: '#', 'original-title': t('settings', 'Delete')})
.append(rm_img);
tr.find('td.remove').append(rm_link);
} else if (OC.currentUser == username) {
tr.find('td.remove a').remove();