Skip to content

Commit

Permalink
initial commit (1.2.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
kzmi committed Dec 30, 2019
0 parents commit d9bf3df
Show file tree
Hide file tree
Showing 12 changed files with 376 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Blinking Alert
--------------

Thunderbird add-on
5 changes: 5 additions & 0 deletions src/chrome.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
content blinkingalert chrome/content/
locale blinkingalert en chrome/locale/en/
locale blinkingalert ja chrome/locale/ja/
overlay chrome://messenger/content/preferences/notifications.xul chrome://blinkingalert/content/preferences/notifications.xul
overlay chrome://messenger/content/newmailalert.xul chrome://blinkingalert/content/messenger/newmailalert.xul
122 changes: 122 additions & 0 deletions src/chrome/content/messenger/newmailalert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/*
* Blinking Alert
*
* Copyright(c) 2007-2014 Iwasa Kazmi
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

(function(window) {

var debug = false;

var consoleService = Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces.nsIConsoleService);
function log(msg) {
if (debug) {
consoleService.logStringMessage("Blinking Alert : " + msg);
}
}

log("addEventListener");

window.addEventListener("load", function() {
log("onload");

// original handlers
var onAlertLoadOrig = window.onAlertLoad;
var fadeOutAlertOrig = window.fadeOutAlert;
var closeAlertOrig = window.closeAlert;

log("onAlertLoadOrig : " + typeof(onAlertLoadOrig));
log("fadeOutAlertOrig : " + typeof(fadeOutAlertOrig));
log("closeAlertOrig : " + typeof(closeAlertOrig));

// settings
var blinkInterval = 0;
var blinkColor = "#ff6600";
var disableAutoHide = false;
var closeOnClick = false;

// original background color
var origBackgroundColor = '';
var hasOrigBackgroundColor = false;

// replace fadeOutAlert()
window.fadeOutAlert = function() {
log("fadeOutAlert called");
if (!disableAutoHide && fadeOutAlertOrig != null) {
log("call original fadeOutAlert");
fadeOutAlertOrig();
fadeOutAlertOrig = null;
}
};

// handle click event
window.addEventListener("click", function() {
log("onclick");
if (closeOnClick && closeAlertOrig != null) {
log("call original closeAlert");
closeAlertOrig();
closeAlertOrig = null;
}
}, false);

// blinking function
var blink2 = null;
var blink1 = function() {
log("blink1");
var elem = document.getElementById("alertBox");
if (elem) {
if (!hasOrigBackgroundColor) {
origBackgroundColor = elem.style.backgroundColor;
hasOrigBackgroundColor = true;
}
elem.style.backgroundColor = blinkColor;
setTimeout(blink2, blinkInterval);
}
};

blink2 = function() {
log("blink2");
var elem = document.getElementById("alertBox");
if (elem) {
elem.style.backgroundColor = origBackgroundColor;
setTimeout(blink1, blinkInterval);
}
};

// read out our initial settings from prefs.
try {
var prefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(null);
disableAutoHide = prefBranch.getBoolPref("extensions.blinkingAlert.disableAutoHide");
blinkInterval = prefBranch.getIntPref ("extensions.blinkingAlert.blinkInterval");
blinkColor = prefBranch.getCharPref("extensions.blinkingAlert.blinkColor");
closeOnClick = prefBranch.getBoolPref("extensions.blinkingAlert.closeOnClick");
} catch (ex) {}

// set time to start blinking
if (blinkInterval > 0) {
log("start blinking");
setTimeout(blink1, 0);
}
}, false);
})(window);

32 changes: 32 additions & 0 deletions src/chrome/content/messenger/newmailalert.xul
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<!--
/*
* Blinking Alert
*
* Copyright(c) 2007-2014 Iwasa Kazmi
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-->
<overlay id="BlinkingMailAlertNotification"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://blinkingalert/content/messenger/newmailalert.js"/>
</overlay>

45 changes: 45 additions & 0 deletions src/chrome/content/options.xul
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0"?>
<!--
/*
* Blinking Alert
*
* Copyright(c) 2007-2014 Iwasa Kazmi
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-->
<?xul-overlay href="chrome://messenger/content/preferences/notifications.xul"?>
<!-- *******************************
The prefwindow in notifications.xul is a "child" dialog.
We need a top-level prefwindow as an option dialog.
*********************************-->
<?xml-stylesheet href="chrome://global/skin/"?>
<?xml-stylesheet href="chrome://messenger/skin/preferences/preferences.css"?>
<?xml-stylesheet href="chrome://mozapps/content/preferences/preferences.css"?>
<!DOCTYPE prefwindow [
<!ENTITY % notificationsDTD SYSTEM "chrome://messenger/locale/preferences/notifications.dtd">
%notificationsDTD;
]>
<prefwindow id="StickAlertOptionsDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
dlgbuttons="accept,cancel"
title="&notificationsDialog2.title;">
<prefpane id="NotificationsDialogPane"/>
</prefwindow>
52 changes: 52 additions & 0 deletions src/chrome/content/preferences/notifications.xul
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0"?>
<!--
/*
* Blinking Alert
*
* Copyright(c) 2007-2014 Iwasa Kazmi
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-->
<!DOCTYPE overlay SYSTEM "chrome://blinkingalert/locale/notifications.dtd">
<overlay id="BlinkingAlertNotificationsDialogPane"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="NotificationsDialogPane">
<preferences>
<preference id="blinkingAlert.disableAutoHide" name="extensions.blinkingAlert.disableAutoHide" type="bool"/>
<preference id="blinkingAlert.blinkInterval" name="extensions.blinkingAlert.blinkInterval" type="int"/>
<preference id="blinkingAlert.blinkColor" name="extensions.blinkingAlert.blinkColor" type="string"/>
<preference id="blinkingAlert.closeOnClick" name="extensions.blinkingAlert.closeOnClick" type="bool"/>
</preferences>

<checkbox id="disableAutoHide" class="indent" label="&disableAutoHide.label;" preference="blinkingAlert.disableAutoHide"/>
<checkbox id="closeOnClick" class="indent" label="&closeOnClick.label;" preference="blinkingAlert.closeOnClick"/>
<hbox class="indent" align="center">
<label id="blinkIntervalLabel" value="&blinkInterval.label;" control="blinkInterval"/>
<textbox id="blinkInterval" type="number" min="0" preference="blinkingAlert.blinkInterval" style="width:5em;"/>
<label id="blinkIntervalUnit" value="&blinkIntervalUnit.label; (0:&noBlink.label;)" control="blinkInterval"/>
</hbox>
<hbox class="indent" align="center">
<label id="blinkColorLabel" value="&blinkColor.label;" control="blinkColor"/>
<colorpicker type="button" id="blinkColor" palettename="standard" preference="blinkingAlert.blinkColor"/>
</hbox>
<separator/>
</prefpane>
</overlay>
1 change: 1 addition & 0 deletions src/chrome/locale/en/common.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extensions.{06f79612-34ef-4f4b-beab-0902b61fcc4b}.description=Adds extra features to the new-mail alert
32 changes: 32 additions & 0 deletions src/chrome/locale/en/notifications.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!--
/*
* Blinking Alert
*
* Copyright(c) 2007-2014 Iwasa Kazmi
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-->
<!ENTITY disableAutoHide.label "Disable Auto-hide">
<!ENTITY blinkInterval.label "Blink Interval">
<!ENTITY blinkIntervalUnit.label "msec">
<!ENTITY noBlink.label "no blink">
<!ENTITY blinkColor.label "Blink Color">
<!ENTITY closeOnClick.label "Close on click">
1 change: 1 addition & 0 deletions src/chrome/locale/ja/common.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extensions.{06f79612-34ef-4f4b-beab-0902b61fcc4b}.description=新着メール通知に付加機能を追加します
32 changes: 32 additions & 0 deletions src/chrome/locale/ja/notifications.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!--
/*
* Blinking Alert
*
* Copyright(c) 2007-2014 Iwasa Kazmi
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-->
<!ENTITY disableAutoHide.label "自動的に閉じない">
<!ENTITY blinkInterval.label "点滅間隔">
<!ENTITY blinkIntervalUnit.label "ミリ秒">
<!ENTITY noBlink.label "点滅なし">
<!ENTITY blinkColor.label "点滅色">
<!ENTITY closeOnClick.label "クリックで閉じる">
29 changes: 29 additions & 0 deletions src/defaults/preferences/blinkingalert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Blinking Alert
*
* Copyright(c) 2007-2014 Iwasa Kazmi
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
pref("extensions.{06f79612-34ef-4f4b-beab-0902b61fcc4b}.description", "chrome://blinkingalert/locale/common.properties");
pref('extensions.blinkingAlert.disableAutoHide', false);
pref('extensions.blinkingAlert.blinkInterval', 0);
pref('extensions.blinkingAlert.blinkColor', '#ff6600');
pref('extensions.blinkingAlert.closeOnClick', false);
21 changes: 21 additions & 0 deletions src/install.rdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>{06f79612-34ef-4f4b-beab-0902b61fcc4b}</em:id>
<em:version>1.2.0</em:version>
<em:type>2</em:type>
<em:targetApplication>
<Description>
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id> <!-- thunderbird -->
<em:minVersion>24.*</em:minVersion>
<em:maxVersion>60.*</em:maxVersion>
</Description>
</em:targetApplication>
<em:name>Blinking Alert</em:name>
<em:description>Adds extra features to the new-mail alert</em:description>
<em:creator>Iwasa Kazmi</em:creator>
<em:homepageURL>http://sites.google.com/site/icantlivewithoutit/</em:homepageURL>
<em:optionsURL>chrome://blinkingalert/content/options.xul</em:optionsURL>
</Description>
</RDF>

0 comments on commit d9bf3df

Please sign in to comment.