From: notmasteryet Date: Sun, 28 Aug 2011 20:10:14 +0000 (-0500) Subject: Fixing font loading hack for IE9.. and some styles X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=5773511d16f82e555813b4a987db91feefd6909e;p=pdf.js.git Fixing font loading hack for IE9.. and some styles --- diff --git a/web/compatibility.js b/web/compatibility.js old mode 100644 new mode 100755 index d286692..878bf53 --- a/web/compatibility.js +++ b/web/compatibility.js @@ -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 binded = function() { + var args = Array.prototype.concat.apply(headArgs, arguments); return fn.apply(obj, args); }; return binded; }; })(); + +// 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 + }); +})(); diff --git a/web/viewer.css b/web/viewer.css old mode 100644 new mode 100755 index bb7da00..a8578eb --- a/web/viewer.css +++ b/web/viewer.css @@ -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; }