update library

This commit is contained in:
SHIMODA Hiroshi 2011-01-17 11:04:43 +09:00
parent eb17d17aba
commit 3effb55cde

View File

@ -6,13 +6,13 @@
// do something // do something
window['piro.sakura.ne.jp'].stopRendering.start(); window['piro.sakura.ne.jp'].stopRendering.start();
license: The MIT License, Copyright (c) 2009-2010 SHIMODA "Piro" Hiroshi license: The MIT License, Copyright (c) 2009-2011 SHIMODA "Piro" Hiroshi
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/license.txt http://github.com/piroor/fxaddonlibs/blob/master/license.txt
original: original:
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/stopRendering.js http://github.com/piroor/fxaddonlibs/blob/master/stopRendering.js
*/ */
(function() { (function() {
const currentRevision = 8; const currentRevision = 9;
if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {}; if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {};
@ -140,6 +140,11 @@
aEvent.stopPropagation(); aEvent.stopPropagation();
aEvent.preventDefault(); aEvent.preventDefault();
return; return;
case 'DOMContentLoaded':
window.removeEventListener('DOMContentLoaded', this, true);
this.initCanvas();
return;
} }
}, },
@ -187,6 +192,8 @@
return comparator.compare(XULAppInfo.version, '4.0b1') > 0; return comparator.compare(XULAppInfo.version, '4.0b1') > 0;
})(), })(),
BASE_ID : 'piro.sakura.ne.jp-fullScreenCanvas',
DRAW_WINDOW_FLAGS : Ci.nsIDOMCanvasRenderingContext2D.DRAWWINDOW_DRAW_VIEW | DRAW_WINDOW_FLAGS : Ci.nsIDOMCanvasRenderingContext2D.DRAWWINDOW_DRAW_VIEW |
Ci.nsIDOMCanvasRenderingContext2D.DRAWWINDOW_DRAW_CARET | Ci.nsIDOMCanvasRenderingContext2D.DRAWWINDOW_DRAW_CARET |
Ci.nsIDOMCanvasRenderingContext2D.DRAWWINDOW_DO_NOT_FLUSH, Ci.nsIDOMCanvasRenderingContext2D.DRAWWINDOW_DO_NOT_FLUSH,
@ -270,51 +277,43 @@
initCanvas : function() initCanvas : function()
{ {
var canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas'); var canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas');
canvas.setAttribute('id', 'fullScreenCanvas-canvas'); canvas.setAttribute('id', this.BASE_ID+'-canvas');
canvas.setAttribute('width', '0'); canvas.setAttribute('width', '0');
canvas.setAttribute('height', '0'); canvas.setAttribute('height', '0');
canvas.setAttribute('style', 'width:0;height:0;'); canvas.setAttribute('style', 'width:0;height:0;');
this.canvas = canvas; this.canvas = canvas;
var style = document.createElementNS('http://www.w3.org/1999/xhtml', 'style'); var style = document.createElementNS('http://www.w3.org/1999/xhtml', 'style');
style.setAttribute('id', 'fullScreenCanvas-style'); style.setAttribute('id', this.BASE_ID+'-style');
style.setAttribute('type', 'text/css'); style.setAttribute('type', 'text/css');
style.appendChild(document.createTextNode([ style.appendChild(document.createTextNode([
':root[fullScreenCanvas-state="shown"] > *:not(#fullScreenCanvas-box) {', ':root[fullScreenCanvas-state="shown"] > *:not(#%BASE_ID%-box) {',
' visibility: hidden !important;', ' visibility: hidden !important;',
'}', '}',
'#fullScreenCanvas-style {', '#%BASE_ID%-style {',
' display: none;', ' display: none;',
'}', '}',
'#fullScreenCanvas-box {', '#%BASE_ID%-box {',
' position: fixed;', ' position: fixed;',
' z-index: 65000;', ' z-index: 65000;',
' top: 0;', ' top: 0;',
' left: 0;', ' left: 0;',
' visibility: collapse;', ' visibility: collapse;',
'}', '}',
':root[fullScreenCanvas-state="shown"] > #fullScreenCanvas-box {', ':root[fullScreenCanvas-state="shown"] > #%BASE_ID%-box {',
' visibility: visible;', ' visibility: visible;',
'}' '}'
].join(''))); ].join('\n').replace(/%BASE_ID%/g, this.BASE_ID.replace(/\./g, '\\.'))));
this.style = style; this.style = style;
var stylePI = document.createProcessingInstruction(
'xml-stylesheet',
'type="text/css" href="#fullScreenCanvas-style"'
);
this.stylePI = stylePI;
var box = document.createElement('box'); var box = document.createElement('box');
box.setAttribute('id', 'fullScreenCanvas-box'); box.setAttribute('id', this.BASE_ID+'-box');
box.setAttribute('onmousedown', 'window["piro.sakura.ne.jp"].stopRendering.handleEvent(event);'); box.setAttribute('onmousedown', 'window["piro.sakura.ne.jp"].stopRendering.handleEvent(event);');
this.box = box; this.box = box;
box.appendChild(canvas); box.appendChild(canvas);
box.appendChild(style); box.appendChild(style);
document.documentElement.appendChild(box); document.documentElement.appendChild(box);
document.insertBefore(stylePI, document.documentElement);
}, },
destroyCanvas : function() destroyCanvas : function()
@ -323,22 +322,9 @@
return; return;
document.documentElement.removeChild(this.box); document.documentElement.removeChild(this.box);
document.removeChild(this.stylePI);
this.box = null; this.box = null;
this.canvas = null; this.canvas = null;
this.style = null; this.style = null;
this.stylePI = null;
},
handleEvent : function(aEvent)
{
switch (aEvent.type)
{
case 'DOMContentLoaded':
window.removeEventListener('DOMContentLoaded', this, true);
this.initCanvas();
return;
}
} }
}; };