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