-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ericwclymer/master
Add options page
- Loading branch information
Showing
9 changed files
with
309 additions
and
90 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
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
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
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
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,53 @@ | ||
<html> | ||
<head> | ||
<script src='jquery-2.1.3.min.js' type='text/javascript'></script> | ||
<link href="style.css" rel="stylesheet" type="text/css" media="screen" /> | ||
</head> | ||
<body> | ||
<h1>IvoryTower Checker</h1> | ||
<hr> | ||
<h2>Options</h2> | ||
<form id="options"> | ||
<div id="topLevelSettings"> | ||
<div class="topLevelSetting"> | ||
<label for="showCohorts">Show Cohort By Users</label> | ||
<input type="checkbox" name="showCohorts" /> | ||
</div> | ||
<div class="topLevelSetting"> | ||
<label for="shortcuts">Enable Shortcuts</label> | ||
<input type="checkbox" name="shortcuts" /> | ||
</div> | ||
</div> | ||
<div id="shortcutSection"> | ||
<h3>Customize Shortcut Keys</h3> | ||
<div class="shortcutKey"> | ||
<label for="nextPost">Next Post</label> | ||
<input type="text" size="1" name="nextPost" placeholder="j" /> | ||
</div> | ||
<div class="shortcutKey"> | ||
<label for="previousPost">Previous Post</label> | ||
<input type="text" size="1" name="previousPost" placeholder="k" /> | ||
</div> | ||
<div class="shortcutKey"> | ||
<label for="unreadThread">Next Unread Thread</label> | ||
<input type="text" size="1" name="unreadThread" placeholder="n" /> | ||
</div> | ||
<div class="shortcutKey"> | ||
<label for="rateUp">Rate Up</label> | ||
<input type="text" size="1" name="rateUp" placeholder="u" /> | ||
</div> | ||
<div class="shortcutKey"> | ||
<label for="rateDown">Rate Down</label> | ||
<input type="text" size="1" name="rateDown" placeholder="d" /> | ||
</div> | ||
<div class="shortcutKey"> | ||
<label for="showHidden">Show Hidden</label> | ||
<input type="text" size="1" name="showHidden" placeholder="h" /> | ||
</div> | ||
</div> | ||
</form> | ||
|
||
<script src='core.js' type='text/javascript'></script> | ||
<script src='options.js' type='text/javascript'></script> | ||
</body> | ||
</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,53 @@ | ||
(function(window, $){ | ||
window.ITCheck = window.ITCheck || {}; | ||
|
||
ITCheck.storageGet("ITCheck.shortcutKeys", function(shortcutKeys){ | ||
ITCheck.storageGet('ITCheck.showCohorts', function(val){ | ||
if(val){ | ||
options.showCohorts.checked = val; | ||
}else{ | ||
ITCheck.storageSet('ITCheck.showCohorts', true); | ||
val = true; | ||
} | ||
options.showCohorts.checked = val; | ||
}); | ||
ITCheck.storageGet('ITCheck.shortcuts', function(val){ | ||
if(val){ | ||
options.shortcuts.checked = val; | ||
}else{ | ||
ITCheck.storageSet('ITCheck.shortcuts', true); | ||
val = true; | ||
} | ||
options.shortcuts.checked = val; | ||
}); | ||
for(var i = 0; i < shortcutKeys.length; i++){ | ||
var shortcutKey = shortcutKeys[i]; | ||
populateShortcutKey(shortcutKey); | ||
} | ||
for(var i = 0; i < shortcutKeys.length; i++){ | ||
var shortcutKey = shortcutKeys[i]; | ||
options[shortcutKey].onchange = function(e, shortcutKey){ | ||
var target = e.target; | ||
ITCheck.storageSet('ITCheck.shortcutKey.'+target.name, target.value); | ||
} | ||
} | ||
}); | ||
|
||
function populateShortcutKey(shortcutKey){ | ||
ITCheck.storageGet('ITCheck.shortcutKey.'+shortcutKey, function(val){ | ||
if(val){ | ||
options[shortcutKey].value = val; | ||
} | ||
}); | ||
} | ||
|
||
var options = $('#options')[0]; | ||
options.showCohorts.onchange = function() { | ||
ITCheck.storageSet('ITCheck.showCohorts', options.showCohorts.checked); | ||
}; | ||
|
||
options.shortcuts.onchange = function() { | ||
ITCheck.storageSet('ITCheck.shortcuts', options.shortcuts.checked); | ||
$('#shortcutSection').toggle(options.shortcuts.checked); | ||
}; | ||
})(window, 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
Oops, something went wrong.