Merge pull request #398 from notmasteryet/hacks-2

Fixing font loading hack for IE9.. and some styles
This commit is contained in:
Andreas Gal 2011-08-28 13:31:54 -07:00
commit 5771d0b827
2 changed files with 42 additions and 3 deletions

35
web/compatibility.js Normal file → Executable file
View File

@ -148,10 +148,39 @@
Function.prototype.bind = function(obj) {
var fn = this, headArgs = Array.prototype.slice.call(arguments, 1);
var binded = function(tailArgs) {
var args = headArgs.concat(tailArgs);
var bound = function() {
var args = Array.prototype.concat.apply(headArgs, arguments);
return fn.apply(obj, args);
};
return binded;
return bound;
};
})();
// IE9 text/html data URI
(function() {
if (document.documentMode !== 9)
return;
// overriding the src property
var originalSrcDescriptor = Object.getOwnPropertyDescriptor(
HTMLIFrameElement.prototype, 'src');
Object.defineProperty(HTMLIFrameElement.prototype, 'src', {
get: function() { return this.$src; },
set: function(src) {
this.$src = src;
if (src.substr(0, 14) != 'data:text/html') {
originalSrcDescriptor.set.call(this, src);
return;
}
// for text/html, using blank document and then
// document's open, write, and close operations
originalSrcDescriptor.set.call(this, 'about:blank');
setTimeout((function() {
var doc = this.contentDocument;
doc.open('text/html');
doc.write(src.substr(src.indexOf(',') + 1));
doc.close();
}).bind(this), 0);
},
enumerable: true
});
})();

10
web/viewer.css Normal file → Executable file
View File

@ -36,6 +36,11 @@ body {
line-height: 32px;
}
#controls > button > img {
width: 32px;
height: 32px;
}
#controls > button[disabled] > img {
opacity: 0.5;
}
@ -159,6 +164,11 @@ span#info {
-webkit-box-shadow: 0px 4px 10px #000;
}
#sidebarControls > button > img {
width: 32px;
height: 32px;
}
#sidebarControls > button[disabled] > img {
opacity: 0.5;
}