Skip to content

Instantly share code, notes, and snippets.

@teramako
Forked from anekos/ore-ore-alert-service.js
Created August 22, 2010 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save teramako/543790 to your computer and use it in GitHub Desktop.
Save teramako/543790 to your computer and use it in GitHub Desktop.
XML.ignoreProcessingInstructions = false;
let xml = <>
<?xml-stylesheet type="text/css" href="chrome://browser/skin/"?>
<window id="twitt-popup"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
pack="start"
ondblclick="window.close()">
<box id="dialog" style="padding: 10px; border: 2px solid #7B969C;">
<hbox align="center" pack="center">
<image id="profile-image"/>
</hbox>
<vbox>
<label id="screen-name" style="font-size: 20px; font-weight: bold;"/>
<description id="text" style="font-size: 14px; max-width: 200px !important"/>
</vbox>
</box>
<script type="application/javascript"><![CDATA[
function set (name, attr, value)
document.getElementById(name)[attr] = value;
let opts = window.arguments[0];
set('profile-image', 'src', 'http://snca.net/blogfiles/devcat-face-red-eye-animation-optimized.gif');
set('screen-name', 'textContent', opts.screenName + opts.rand());
set('text', 'textContent', opts.text);
// ちらっと左上に出るのを防止
window.moveTo(-10000, -10000);
let h = setInterval(function() {
let x = screen.availLeft + screen.availWidth - window.outerWidth;
let y = screen.availTop + screen.availHeight - window.outerHeight;
window.moveTo(x, y);
if (window.outerWidth > 100 && window.outerHeight > 100)
clearInterval(h);
}, 0);
]]></script>
</window>
</>;
function rand ()
parseInt(Math.random() * 100, 10);
let uri = 'data:application/vnd.mozilla.xul+xml;base64,' + btoa(xmlst + xml.toString());
setTimeout(
function(){
let win =
window.openDialog(
uri,
null, //'anekos-alert-window', // 指定すれば多重にポップアップしないかも
'chrome,dialog=yes,titlebar=no,popup=yes',
{
screenName: 'anekos',
text: '\u3075\u304A\u304A\u304A!!\n\u304A\u307E\u3048\u3082\u3082\u3082\u3082\u3082\u3082\u3082\u3082\u3082\u3082\u3082\u3082\u3082\u3082\u3082\u3082\u3082\u3082\u3082\u3082\u3082 Vimperator \u4F7F\u3044\u306B\u3057\u3066\u3084\u308D\u3046\u304B\uFF01',
rand: rand
}
);
setTimeout(function() win.close(), 5000);
},
0
);
// chrome://global/content/alerts/alert.js
//view-source:chrome://global/content/alerts/alert.xul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment