Skip to content

Commit

Permalink
Initial (working) commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonny007-MKD committed Mar 9, 2019
1 parent ca301b8 commit d1bb32a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions chrome.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
content passworddialogtitle content/
overlay chrome://global/content/commonDialog.xul chrome://passworddialogtitle/content/settitle.xul
19 changes: 19 additions & 0 deletions content/settitle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
window.addEventListener("load", function windowLoader(e) {
this.window.removeEventListener("load", windowLoader, false); // Only need it to run this _one_ time
startup()
}, false);

function startup() {
let displayString = "Enter password: %MAIL%";
let description = document.getElementById("infoBody").innerHTML;
let reMail = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/i;
let mails = reMail.exec(description)
if (mails != null && mails.length == 1) {
let mail = mails[0]
let host = description.substr(description.lastIndexOf(' ')+1, description.length-description.lastIndexOf(' ')-2)
document.title = displayString.replace("%MAIL%", mail).replace("%HOST%", host)
} else {
console.log("password dialog title: Mail RegEx didn't match description: ", description)
}
}

4 changes: 4 additions & 0 deletions content/settitle.xul
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<overlay id="passworddialogtitle-settitle" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://passworddialogtitle/content/settitle.js"/>
</overlay>
19 changes: 19 additions & 0 deletions install.rdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>

<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>passworddialogtitle@jonny007-mkd.de</em:id>
<em:name>Password Dialog Title</em:name>
<em:version>0.13</em:version>
<em:creator>Jonny007-MKD</em:creator>

<em:targetApplication>
<Description>
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
<em:minVersion>60</em:minVersion>
<em:maxVersion>61</em:maxVersion>
</Description>
</em:targetApplication>

</Description>
</RDF>

0 comments on commit d1bb32a

Please sign in to comment.