-
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
0 parents
commit 10a8581
Showing
613 changed files
with
7,282 additions
and
0 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,11 @@ | ||
#CacheManager | ||
|
||
Entry for Syntax Error '13 | ||
|
||
##Details | ||
Cache Manager is a chrome extension that helps you preload your favorite pages beforehand so you don't have to wait any longer on the web-pages you use daily. | ||
|
||
##Technology | ||
|
||
- Chrome APIs | ||
- Html, Css, Javascript, Jquery |
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 @@ | ||
http://www.sitepoint.com/build-your-own-chrome-extension-a-google-documents-word-count-tool-part-3/ |
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,8 @@ | ||
<html> | ||
<body> | ||
<p>Debugging Purpose</p> | ||
</body> | ||
<script type="text/javascript" src="jquery-1.10.2.min.js"></script> | ||
<script type="text/javascript" src="fancy-settings/source/lib/store.js"></script> | ||
<script type="text/javascript" src="background.js"></script> | ||
</html> |
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,58 @@ | ||
var currPageSize = 0; | ||
var currPageurl = ""; | ||
var currCache = 0; | ||
var cacheLimit = 190 - 10; //Actual limit - size of pages to be permanent in cache | ||
var i = 0; //cache 5 pages continuously | ||
var urlToOpen = 0; | ||
|
||
var settings = new Store("settings", { | ||
"url1": '', | ||
"url2": '', | ||
"url3": '', | ||
"url4": '', | ||
"url5": '', | ||
"openurl": 0 | ||
}); | ||
|
||
/* | ||
Sample - | ||
http://www.mashable.com | ||
https://www.facebook.com | ||
https://mail.google.com | ||
https://www.quora.com | ||
https://www.evernote.com | ||
*/ | ||
|
||
chrome.browserAction.onClicked.addListener(function(tab) { | ||
chrome.tabs.create({'url': chrome.extension.getURL('fancy-settings/source/index.html')}, function(tab) { | ||
// Tab opened. | ||
}); | ||
}); | ||
|
||
chrome.extension.onRequest.addListener( | ||
function(request, sender, sendResponse) { | ||
chrome.pageAction.show(sender.tab.id); | ||
if(request.pageSize && request.pageUrl && !request.prerender){ | ||
currCache += request.pageSize; | ||
currPageSize = request.pageSize; | ||
currPageurl = request.pageUrl; | ||
if(currCache >= cacheLimit){ | ||
if(i > 5){ | ||
currCache %= cacheLimit; | ||
i %= 5; | ||
urlToOpen %= 5; | ||
}else{ | ||
i++; | ||
settings.toObject().openurl = urlToOpen++; | ||
} | ||
//prerender | ||
chrome.extension.sendRequest({ | ||
pageSize: currPageSize, | ||
pageUrl: currPageurl, | ||
prerender: true | ||
}, function(response) {}); | ||
} | ||
} | ||
sendResponse(settings.toObject()); | ||
} | ||
); |
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,13 @@ | ||
# Changelog | ||
|
||
## v1.2 [ API CHANGE! ] | ||
* **Feature**: Added version number to README file | ||
* **Feature**: Added CHANGELOG | ||
* **Feature**: Added alignment support | ||
* **Feature**: Added support for linking to specific tabs | ||
* **Change**: Removed the possibility to use objects to define options for elements other than popupButton | ||
* **Change**: Added support for option groups in popupButtons, changing the format when defining options as objects | ||
* **Change**: Changed the default value of "display" in the slider params from true to false | ||
* **Change**: Search doesn't change the DOM structure of settings any more | ||
* **Change**: i18n now returns the string you entered instead of undefined if no translation can be found | ||
* **Bug**: Fixed an issue were the search field had the wrong placeholder when "search" had no translation |
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,19 @@ | ||
Copyright (c) 2011 - 2012 Frank Kohlhepp | ||
|
||
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. |
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,22 @@ | ||
**Attention: use [tags](https://github.com/frankkohlhepp/fancy-settings/tags) to download your copy. The current master branch is a bit of a mess. At least for now. Sorry.** | ||
|
||
# [Fancy Settings 1.2](https://github.com/frankkohlhepp/fancy-settings) | ||
*Create fancy, chrome-look-alike settings for your Chrome or Safari extension in minutes!* | ||
|
||
### Howto | ||
Welcome to Fancy Settings! Are you ready for tabs, groups, search, good style? | ||
Let's get started, it only takes a few minutes... | ||
|
||
[Getting started](https://github.com/frankkohlhepp/fancy-settings/wiki) | ||
[View Sample](http://frankkohlhepp.github.com/fancy-settings/) | ||
|
||
### License | ||
Fancy Settings is licensed under the **MIT-license**. | ||
For details see *LICENSE.txt* | ||
|
||
Former versions of Fancy Settings were licensed under the LGPL v2.1 license. | ||
The MIT-license applies retroactively to all versions, i.e. the whole Git repository. | ||
Older versions are therefore dual-licensed under LGPL and MIT, newer version are licensed under MIT. | ||
|
||
Older versions refer to code committed before 08/24/2012 10:50 GMT | ||
Newer versions refer to code committed after 08/24/2012 10:50 GMT |
134 changes: 134 additions & 0 deletions
134
fancy-settings/source/coffee/classes/fancy-settings.coffee
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,134 @@ | ||
### | ||
## Fancy Settings by Frank Kohlhepp | ||
## Copyright (c) 2011 - 2012 Frank Kohlhepp | ||
## https://github.com/frankkohlhepp/fancy-settings | ||
## License: MIT-license | ||
### | ||
window.FancySettings = class FancySettings | ||
constructor: (@name) -> | ||
@tabs = {} | ||
@settings = {} | ||
|
||
$("title").set "text", @name | ||
$("name").set "text", @name | ||
|
||
$("search-tab").set "text", i18n.get "Search" | ||
$("search-tab-name").set "text", i18n.get "Search Results" | ||
$("search").set "placeholder", i18n.get("Search") + "..." | ||
$("nothing-found").set "text", i18n.get "No matches were found." | ||
|
||
@tab = new Tab $("tab-container"), $("content") | ||
@search = new Search $("search") | ||
|
||
getTab: (name) => | ||
return @tabs[name] if @tabs[name]? | ||
|
||
# Create new tab | ||
tab = @tab.new() | ||
tab.groups = {} | ||
|
||
tab.tab.set "text", name | ||
@search.bind tab.tab | ||
|
||
tab.content.name = (new Element "h2", | ||
class: "tab-name" | ||
text: name | ||
).inject tab.content | ||
|
||
tab.content.settings = (new Element "div", | ||
class: "tab-settings" | ||
).inject tab.content | ||
|
||
@tabs[name] = tab | ||
|
||
getGroup: (name, tab) => | ||
return tab.groups[name] if tab.groups[name]? | ||
|
||
# Create new group | ||
group = (new Element "div", | ||
class: "setting group" | ||
).inject tab.content.settings | ||
|
||
group.name = (new Element "div", | ||
class: "setting group-name" | ||
text: name | ||
).inject group | ||
|
||
group.content = (new Element "div", | ||
class: "setting group-content" | ||
).inject group | ||
|
||
group.setting = new Setting group.content | ||
tab.groups[name] = group | ||
|
||
check: (param, value) => | ||
success = typeOf(value) is "string" and !!value | ||
throw """Error: "#{param}" is a required parameter. Check your manifest!""" unless success | ||
this | ||
|
||
new: (params) => | ||
# Check required basic values | ||
@check "tab", params.tab | ||
@check "group", params.group | ||
@check "name", params.name | ||
@check "type", params.type | ||
|
||
if @settings[params.name]? | ||
throw """Error: A setting with name "#{params.name}" already exists.""" | ||
|
||
tab = @getTab params.tab | ||
group = @getGroup params.group, tab | ||
|
||
# Create and index the setting | ||
setting = group.setting.new params | ||
setting.tab = tab | ||
setting.group = group | ||
|
||
@settings[params.name] = setting | ||
@search.index setting | ||
setting | ||
|
||
align: (settings) => | ||
settings = settings.map (name) => | ||
@settings[name] | ||
|
||
maxOffset = 0 | ||
types = [ | ||
"text" | ||
"number" | ||
"pushButton" | ||
"slider" | ||
"popupButton" | ||
] | ||
|
||
document.html.addClass "measuring" | ||
settings.each (setting) => | ||
unless types.contains setting.params.type | ||
throw """Error: Type "#{setting.params.type}" can't be aligned.""" | ||
|
||
if setting.params.type is "pushButton" or "slider" or "popupButton" | ||
offset = setting.label.offsetWidth + 3 | ||
else | ||
offset = setting.label.offsetWidth | ||
|
||
if offset > maxOffset | ||
maxOffset = offset | ||
|
||
settings.each (setting) => | ||
offset = setting.label.offsetWidth | ||
if offset < maxOffset | ||
setting.element.setStyle "margin-left", (maxOffset - offset) + "px" | ||
document.html.removeClass "measuring" | ||
|
||
FancySettings.initWithManifest = (callback) -> | ||
fancySettings = new FancySettings manifest.name | ||
|
||
manifest.settings.each (params) => | ||
fancySettings.new params | ||
|
||
if manifest.alignment? | ||
manifest.alignment.each (group) => | ||
fancySettings.align group | ||
|
||
callback fancySettings if callback? | ||
this |
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,91 @@ | ||
### | ||
## Fancy Settings by Frank Kohlhepp | ||
## Copyright (c) 2011 - 2012 Frank Kohlhepp | ||
## https://github.com/frankkohlhepp/fancy-settings | ||
## License: MIT-license | ||
### | ||
window.Search = class Search | ||
constructor: (@search) -> | ||
@settings = [] | ||
|
||
# Wire up search box | ||
find = => | ||
@find @search.get "value" | ||
|
||
@search.addEvent "keyup", (event) => | ||
if event.key is "esc" | ||
@reset() | ||
else | ||
find() | ||
|
||
@search.addEventListener "search", find | ||
|
||
# Wire up search string in hash | ||
searchString = (decodeURI document.location.hash.substring(1).split("/")[1] or "").trim() | ||
if searchString | ||
@search.focus() | ||
@search.set "value", searchString | ||
@find searchString | ||
|
||
window.addEventListener "hashchange", => | ||
searchString = (decodeURI document.location.hash.substring(1).split("/")[1] or "").trim() | ||
if searchString isnt @search.get("value").trim() | ||
if searchString | ||
@search.focus() | ||
@search.set "value", searchString | ||
@find searchString | ||
else | ||
@reset() | ||
|
||
bind: (tab) => | ||
tab.addEvent "click", @reset | ||
this | ||
|
||
index: (setting) => | ||
@settings.push setting | ||
@find @search.get("value") | ||
this | ||
|
||
find: (searchString) => | ||
# Set searchString in hash | ||
if searchString.trim() and (decodeURI document.location.hash.substring(1).split("/")[1] or "").trim() isnt searchString.trim() | ||
document.location.hash = "#{document.location.hash.substring(1).split("/")[0]}/#{encodeURI searchString.trim()}" | ||
|
||
# Exit search mode | ||
if !searchString.trim() | ||
document.location.hash = document.location.hash.substring(1).split("/")[0] | ||
document.html.removeClass "searching" | ||
return this | ||
|
||
# Or enter search mode | ||
|
||
# Reset results | ||
$("nothing-found").removeClass "match" | ||
@settings.each (setting) => | ||
setting.bundle.removeClass "match" | ||
setting.group.removeClass "match" | ||
setting.tab.content.removeClass "match" | ||
document.html.addClass "searching" | ||
|
||
# Filter settings | ||
results = @settings.filter (setting) => | ||
if setting.searchString.toLowerCase().contains searchString.trim().toLowerCase() | ||
true | ||
else | ||
false | ||
|
||
# Display results | ||
if !results.length | ||
$("nothing-found").addClass "match" | ||
else | ||
results.each (setting) => | ||
setting.bundle.addClass "match" | ||
setting.group.addClass "match" | ||
setting.tab.content.addClass "match" | ||
|
||
this | ||
|
||
reset: => | ||
@search.set "value", "" | ||
@search.blur() | ||
@find "" |
Oops, something went wrong.