-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mathijs Lagerberg
committed
Jun 15, 2012
1 parent
013873f
commit ecd4228
Showing
15 changed files
with
520 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
overlay chrome://findthatfont/content/main.xul chrome://previewbox/content/previewbox.xul | ||
|
||
content previewbox jar:chrome/previewbox.jar!/content/ | ||
|
||
skin previewbox classic/1.0 jar:chrome/previewbox.jar!/skin/ | ||
|
||
locale previewbox en jar:chrome/previewbox.jar!/locale/en-US/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!-- | ||
- This file is part of FindThatFont! | ||
- | ||
- FindThatFont! is free software: you can redistribute it and/or modify | ||
- it under the terms of the GNU General Public License as published by | ||
- the Free Software Foundation, either version 3 of the License, or | ||
- (at your option) any later version. | ||
- | ||
- FindThatFont! is distributed in the hope that it will be useful, | ||
- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
- GNU General Public License for more details. | ||
- | ||
- You should have received a copy of the GNU General Public License | ||
- along with FindThatFont!. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
<?xml version="1.0"?> | ||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> | ||
|
||
<RDF:Description about="urn:mozilla:package:previewbox" | ||
chrome:name="previewbox" | ||
chrome:extension="true"/> | ||
|
||
<RDF:Seq about="urn:mozilla:overlays"> | ||
<RDF:li resource="chrome://content/main.xul"/> | ||
</RDF:Seq> | ||
|
||
<RDF:Seq about="chrome://content/main.xul"> | ||
<RDF:li>chrome://previewbox/content/previewbox.xul</RDF:li> | ||
</RDF:Seq> | ||
|
||
</RDF:RDF> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/* | ||
* This file is part of FindThatFont! | ||
* | ||
* FindThatFont! is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* FindThatFont! is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with FindThatFont!. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
// Add an event listener to make sure the extension is | ||
// initialized when FtF loads | ||
window.addEventListener("load", function(e) { PreviewBox.init(); }, false); | ||
|
||
// Bundle all functions in an object, for convenience and avoiding conflicts | ||
var PreviewBox = { | ||
|
||
// Called when FindThatFont! loads | ||
init: function() { | ||
var rlb = document.getElementById("font-list"); | ||
rlb.setAttribute("onselect", "PreviewBox.updateSampleBox();"); | ||
this.loadChars(); | ||
}, | ||
|
||
loadChars: function() { | ||
try { | ||
var box = document.getElementById("prevb-chars-container"); | ||
var str = ""; | ||
|
||
// Most common characters | ||
for(var i=33; i<255; i++) { | ||
if(i<127 || i>160) | ||
str += this.createCharacterCode(i); | ||
} | ||
// Greek | ||
var extraChars = new Array(402,915,916,920,923,926,928,931,933,934,936,937,945,946,947); | ||
for(var i=0; i<extraChars.length; i++) | ||
str += this.createCharacterCode(extraChars[i]); | ||
// More greek | ||
for(var j=949; j<977; j++) | ||
str += this.createCharacterCode(j); | ||
// Euro sign | ||
str += this.createCharacterCode(8364); | ||
// Some symbols | ||
for(var i=9785; i<9831; i++) | ||
str += this.createCharacterCode(i); | ||
|
||
// To be able to use the .innerHTML property, | ||
// box is defined using an HTML tag rather than XUL | ||
box.innerHTML = str; | ||
} catch(e) { | ||
handleError("PreviewBox.loadChars: " + e); | ||
} | ||
}, | ||
|
||
createCharacterCode: function(i) { | ||
return '<div class="prevb-character-box">' | ||
+ '<div class="prevb-code">' + i + '</div>' | ||
// For hex codes (left out because of too much clutter) | ||
//+ '<div class="prevb-code">#' + i.toString(16).toUpperCase() + '</div>' | ||
+ '<div class="prevb-character">&#' + i + ';</div>' | ||
+ '</div>'; | ||
}, | ||
|
||
// Opens the sample box | ||
showSample: function() { | ||
var split = document.getElementById("prevb-splitter"); | ||
split.setAttribute("state", "open"); | ||
this.updateSampleBox(); | ||
}, | ||
|
||
// Hides the sample box | ||
hideSample: function() { | ||
var split = document.getElementById("prevb-splitter"); | ||
split.setAttribute("state", "collapsed"); | ||
}, | ||
|
||
// Updates the sample box to the selected font | ||
updateSampleBox: function() { | ||
// be sure to call the original onselect function: | ||
if(classHeaderSelected()) return; | ||
var preview1 = document.getElementById("prevb-preview"); | ||
preview1.setAttribute("style", 'font-family: "'+getSelectedFont()+'";'); | ||
var preview2 = document.getElementById("prevb-chars"); | ||
preview2.setAttribute("style", 'font-family: "'+getSelectedFont()+'";'); | ||
}, | ||
|
||
// Switches between Lipsum box and Unicode box | ||
switchMode: function() { | ||
var mode = document.getElementById("sample-option"); | ||
var preview1 = document.getElementById("prevb-chars"); | ||
var preview2 = document.getElementById("prevb-preview"); | ||
if(mode.value=="1") { | ||
preview2.setAttribute("hidden", "false"); | ||
preview1.setAttribute("hidden", "true"); | ||
} else { | ||
preview1.setAttribute("hidden", "false"); | ||
preview2.setAttribute("hidden", "true"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<!-- | ||
- This file is part of FindThatFont! | ||
- | ||
- FindThatFont! is free software: you can redistribute it and/or modify | ||
- it under the terms of the GNU General Public License as published by | ||
- the Free Software Foundation, either version 3 of the License, or | ||
- (at your option) any later version. | ||
- | ||
- FindThatFont! is distributed in the hope that it will be useful, | ||
- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
- GNU General Public License for more details. | ||
- | ||
- You should have received a copy of the GNU General Public License | ||
- along with FindThatFont!. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
<?xml version="1.0"?> | ||
<?xml-stylesheet href="chrome://previewbox/skin/prevb.css" type="text/css"?> | ||
|
||
<!DOCTYPE window SYSTEM "chrome://previewbox/locale/previewbox.dtd"> | ||
<overlay id="previewbox-Overlay" | ||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" | ||
xmlns:html="http://www.w3.org/1999/xhtml"> | ||
|
||
<script type="application/x-javascript" src="chrome://previewbox/content/previewbox.js" /> | ||
|
||
<commandset id="main-commands"> | ||
<command id="PreviewBox:prevbShow" oncommand="PreviewBox.showSample();"/> | ||
<command id="PreviewBox:prevbCollapse" oncommand="PreviewBox.hideSample();"/> | ||
<command id="PreviewBox:prevbSwitch" oncommand="PreviewBox.switchMode();"/> | ||
</commandset> | ||
|
||
<menupopup id="fontlist-popup"> | ||
<menuitem | ||
label="&prevbox.view;" | ||
accesskey="&prevbox.viewAccesskey;" | ||
insertbefore="menu-popup-separator" | ||
command="PreviewBox:prevbShow"/> | ||
</menupopup> | ||
|
||
<vbox id="fonts"> | ||
<splitter | ||
id="prevb-splitter" | ||
state="collapsed" | ||
collapse="after" | ||
resizebefore="closest" | ||
resizeafter="closest" | ||
persist="state" | ||
insertafter="helpframe"> | ||
<grippy/> | ||
</splitter> | ||
|
||
<vbox id="prevb" insertbefore="debugger-box" persist="height"> | ||
<toolbar toolbarname="&prevbox.toolbarname;" class="chromeclass-toolbar toolbar-primary"> | ||
<toolbarspacer id="prevb-spacer" flex="1"/> | ||
<radiogroup id="sample-option" | ||
orient="horizontal" | ||
command="PreviewBox:prevbSwitch" | ||
persist="value"> | ||
<radio id="option-characters" | ||
label="&prevbox.sampleChars;" | ||
value="0" | ||
persist="selected"/> | ||
<radio id="option-lipsum" | ||
label="&prevbox.sampleLipsum;" | ||
value="1" | ||
persist="selected"/> | ||
</radiogroup> | ||
<toolbarbutton | ||
id="prevb-close-button" | ||
flex="0" | ||
class="tabs-closebutton" | ||
command="PreviewBox:prevbCollapse" | ||
tooltiptext="&prevbox.hide;" | ||
/> | ||
</toolbar> | ||
<box id="prevb-chars" flex="1" hidden="true" persist="hidden"> | ||
<box id="prevb-chars-sub" flex="1"> | ||
<html:div> | ||
<html:p id="prevb-chars-container"></html:p> | ||
</html:div> | ||
</box> | ||
</box> | ||
<vbox id="prevb-preview" flex="1" hidden="false" persist="hidden"> | ||
<html:h2 class="prevb-preview">Lorem ipsum dolor sit amet</html:h2> | ||
<html:h3 class="prevb-preview">"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."</html:h3> | ||
<html:div class="prevb-preview"> | ||
<html:p class="prevb-preview"> | ||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In elementum massa ac enim. | ||
Duis pulvinar justo ut dolor. Aliquam nisl. Integer fermentum lacus vel erat. Vestibulum | ||
porttitor consequat eros. Fusce orci. Donec fringilla nonummy quam. Vivamus eget eros. | ||
Aliquam erat volutpat. Integer tempor semper eros. Aliquam accumsan pulvinar ligula. In | ||
hac habitasse platea dictumst. Nunc bibendum imperdiet nisl. Nulla quis velit non ipsum | ||
pharetra tristique. | ||
</html:p><html:p class="prevb-preview"> | ||
Mauris tincidunt sodales dui. Quisque lacus magna, imperdiet eget, varius ut, vulputate | ||
quis, ante. Curabitur elementum neque. Sed lacinia facilisis sem. Aenean hendrerit. Nam | ||
justo. Sed vel justo. Morbi sit amet nulla ut tortor posuere eleifend. Morbi condimentum | ||
nibh ac quam. Aliquam cursus, lectus id volutpat dapibus, urna est luctus dolor, et | ||
fermentum ante libero dictum tellus. Maecenas non neque imperdiet enim tincidunt | ||
fermentum. Etiam velit est, sodales ut, ultrices non, aliquam sed, turpis. | ||
</html:p><html:p class="prevb-preview"> | ||
Vivamus ipsum. Morbi lectus. Quisque eget arcu ut turpis lobortis mollis. Donec faucibus | ||
tincidunt lorem. Donec ultrices elit. Vestibulum eu odio. Cras posuere commodo pede. | ||
Vestibulum nec ante. Suspendisse laoreet blandit lacus. Etiam condimentum velit eu libero. | ||
Phasellus vel dolor. Donec lorem dui, semper ut, pharetra sagittis, pretium eu, diam. | ||
Fusce elit. Nam dignissim mollis lacus. Mauris enim est, dignissim non, congue eu, dictum | ||
a, ligula. | ||
</html:p> | ||
</html:div> | ||
</vbox> | ||
</vbox> | ||
</vbox> | ||
</overlay> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!-- | ||
- This file is part of FindThatFont! | ||
- | ||
- FindThatFont! is free software: you can redistribute it and/or modify | ||
- it under the terms of the GNU General Public License as published by | ||
- the Free Software Foundation, either version 3 of the License, or | ||
- (at your option) any later version. | ||
- | ||
- FindThatFont! is distributed in the hope that it will be useful, | ||
- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
- GNU General Public License for more details. | ||
- | ||
- You should have received a copy of the GNU General Public License | ||
- along with FindThatFont!. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
<?xml version="1.0"?> | ||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> | ||
|
||
<RDF:Seq about="urn:mozilla:locale:root"> | ||
<RDF:li resource="urn:mozilla:locale:en-US"/> | ||
</RDF:Seq> | ||
|
||
<RDF:Description about="urn:mozilla:locale:en-US" chrome:name="en-US"> | ||
<chrome:packages> | ||
<RDF:Seq about="urn:mozilla:locale:en-US:packages"> | ||
<RDF:li resource="urn:mozilla:locale:en-US:previewbox"/> | ||
</RDF:Seq> | ||
</chrome:packages> | ||
</RDF:Description> | ||
</RDF:RDF> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!ENTITY prevbox.hide "Hide"> | ||
<!ENTITY prevbox.view "View sample"> | ||
<!ENTITY prevbox.viewAccesskey "V"> | ||
<!ENTITY prevbox.sampleLipsum "Lorem Ipsum"> | ||
<!ENTITY prevbox.sampleChars "Character codes"> | ||
<!ENTITY prevbox.toolbarname "PreviewBox toolbar"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!-- | ||
- This file is part of FindThatFont! | ||
- | ||
- FindThatFont! is free software: you can redistribute it and/or modify | ||
- it under the terms of the GNU General Public License as published by | ||
- the Free Software Foundation, either version 3 of the License, or | ||
- (at your option) any later version. | ||
- | ||
- FindThatFont! is distributed in the hope that it will be useful, | ||
- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
- GNU General Public License for more details. | ||
- | ||
- You should have received a copy of the GNU General Public License | ||
- along with FindThatFont!. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
<?xml version="1.0"?> | ||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> | ||
|
||
<RDF:Seq about="urn:mozilla:skin:root"> | ||
<RDF:li resource="urn:mozilla:skin:classic/1.0" /> | ||
</RDF:Seq> | ||
|
||
<RDF:Description about="urn:mozilla:skin:classic/1.0"> | ||
<chrome:packages> | ||
<RDF:Seq about="urn:mozilla:skin:classic/1.0:packages"> | ||
<RDF:li resource="urn:mozilla:skin:classic/1.0:previewbox" /> | ||
</RDF:Seq> | ||
</chrome:packages> | ||
</RDF:Description> | ||
|
||
</RDF:RDF> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.