Skip to content

Commit

Permalink
Initial state. Has most functionality needed.
Browse files Browse the repository at this point in the history
Layout and basics are figured out.
Good enough to send to Github.

Todo list:
* implement data-l10n-target, and accept any html attribute or end it
* with '()' to call a function by that name.
  • Loading branch information
Groxx committed Jan 9, 2012
0 parents commit 0f938dd
Show file tree
Hide file tree
Showing 17 changed files with 14,600 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
.DS_Store
11 changes: 11 additions & 0 deletions LICENSE
@@ -0,0 +1,11 @@
Copyright (c) 2012, Steven Littiebrant
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Attribution of the original source in some visible (non-obfuscated) form is required, using at least the name 'Steven Littiebrant'.
Source code comments are permissible as attribution.

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
The name of Steven Littiebrant may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 changes: 30 additions & 0 deletions README.md
@@ -0,0 +1,30 @@
A jump-start to your Chrome extension projects.
-----------------------------------------------
Because I hate doing it all over every single time.

![a screenshot](http://github.com/groxx/Chrome-Extension-Boilerplate/raw/master/images/screenshot.png)

**NOT** intended to be used un-modified, merely to be quicker
(and possibly better, but no guarantees are implied)
than doing it from scratch.

Lots of things in here are unnecessary.
Rename what you want.
Delete what you want.
Reorganize what you want.

The majority of the documentation exists in the extension -
just load it as an unpacked extension and check out the options page.

For the moment, the features include:

* A fairly rich options page, with basic styling and preference serialization / loading.

This intentionally mimics the Chrome page, but with a lot less shiny.
It's basic and functional, which is all I really wanted.
Options pages always feel harder to make than what I'm making the extension for
(as I've mostly made simpler extensions),
so I've spent the most time on that, so I can just drop in a couple fields and be done with it.
* Basic framework and example code for a localizable extension
* Example images in 4 sizes
* Comments. Lots of comments. More to come.
72 changes: 72 additions & 0 deletions _locales/en/messages.json
@@ -0,0 +1,72 @@
{
/*
Comments work here too! Sweet, they didn't always...
Eventually, I'd like to localize the whole extension.
But not quite yet, as Chrome requires a reload to get new messages.json data.
*/
// v---- localization tab entries ----v
"l10nTabName": {
"message":"Localization"
,"description":"name of the localization tab"
}
,"l10nHeader": {
"message":"It does localization too! (this whole tab is, actually)"
,"description":"Header text for the localization section"
}
,"l10nIntro": {
"message":"'L10n' refers to 'Localization' - 'L' an 'n' are obvious, and 10 comes from the number of letters between those two. It is the process/whatever of displaying something in the language of choice. It uses 'I18n', 'Internationalization', which refers to the tools / framework supporting L10n. I.e., something is internationalized if it has I18n support, and can be localized. Something is localized for you if it is in your language / dialect."
,"description":"introduce the basic idea."
}
,"l10nProd": {
"message":"You <strong>are</strong> planning to allow localization, right? You have <em>no idea</em> who will be using your extension! You have no idea who will be translating it! At least support the basics, it's not hard, and having the framework in place will let you transition much more easily later on."
,"description":"drive the point home. It's good for you."
}
,"l10nFirstParagraph": {
"message":"When the options page loads, elements decorated with <strong>data-l10n</strong> will automatically be localized!"
,"description":"inform that <el data-l10n='' /> elements will be localized on load"
}
,"l10nSecondParagraph": {
"message":"If you need more complex localization, you can also define <strong>data-l10n-args</strong>. This should contain <span class='code'>$containerType$</span> filled with <span class='code'>$dataType$</span>, which will be passed into Chrome's i18n API as <span class='code'>$functionArgs$</span>. In fact, this paragraph does just that, and wraps the args in mono-space font. Easy!"
,"description":"introduce the data-l10n-args attribute. End on a lame note."
,"placeholders": {
"containerType": {
"content":"$1"
,"example":"'array', 'list', or something similar"
,"description":"type of the args container"
}
,"dataType": {
"content":"$2"
,"example":"string"
,"description":"type of data in each array index"
}
,"functionArgs": {
"content":"$3"
,"example":"arguments"
,"description":"whatever you call what you pass into a function/method. args, params, etc."
}
}
}
,"l10nThirdParagraph": {
"message":"Message contents are passed right into innerHTML without processing - include any tags (or even scripts) that you feel like. If you have an input field, the placeholder will be set instead, and buttons will have the value attribute set."
,"description":"inform that we handle placeholders, buttons, and direct HTML input"
}
,"l10nButtonsBefore": {
"message":"Different types of buttons are handled as well. &lt;button&gt; elements have their html set:"
}
,"l10nButton": {
"message":"in a <strong>button</strong>"
}
,"l10nButtonsBetween": {
"message":"while &lt;input type='submit'&gt; and &lt;input type='button'&gt; get their 'value' set (note: no HTML):"
}
,"l10nSubmit": {
"message":"a <strong>submit</strong> value"
}
,"l10nButtonsAfter": {
"message":"Awesome, no?"
}
,"l10nExtras": {
"message":"You can even set <span class='code'>data-l10n</span> on things like the &lt;title&gt; tag, which lets you have translatable page titles, or fieldset &lt;legend&gt; tags, or anywhere else - the default <span class='code'>Boil.localize()</span> behavior will check every tag in the document, not just the body."
,"description":"inform about places which may not be obvious, like <title>, etc"
}
}
10 changes: 10 additions & 0 deletions background.html
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<script>
setTimeout(function() {
console.log(localStorage);
}, 1000);
</script>
</head>
</html>
Binary file added images/big app icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/browser action icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/context menu icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0f938dd

Please sign in to comment.