Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Options page

  • Loading branch information...
commit c66456a04496f4a0536adec7c33173149cdd2715 1 parent 0219bda
@andrusha andrusha authored
View
10 Makefile
@@ -7,7 +7,7 @@ all: dev
release: dev
echo "Optimizing with Closure compiler"
- for file in "${NAME}" "inject"; do \
+ for file in "${NAME}" "inject" "options"; do \
closure --js $(RELEASE_DIR)/$$file.js --js_output_file $(RELEASE_DIR)/$$file.compiled.js --compilation_level SIMPLE_OPTIMIZATIONS ; \
mv $(RELEASE_DIR)/$$file.compiled.js $(RELEASE_DIR)/$$file.js ; \
done
@@ -17,15 +17,17 @@ release: dev
echo "Compressing extension"
cd $(RELEASE_DIR) ; \
- zip ${NAME}.zip manifest.json icon.png icon_enabled.png 48.png 128.png background.html mathml-chrome.js inject.js
+ zip ${NAME}.zip manifest.json icon.png icon_enabled.png 48.png 128.png background.html options.html mathml-chrome.js inject.js options.js
dev:
echo "Compiling HAML"
- for file in "background"; do \
+ for file in "background" "options"; do \
haml $$file.haml ${RELEASE_DIR}/$$file.html; \
done
echo "Compiling coffee script"
coffee --compile --lint --join $(RELEASE_DIR)/${NAME}.js lib.coffee cached_storage.coffee ${NAME}.coffee
- coffee --compile --lint --join $(RELEASE_DIR)/inject.js inject.coffee
+ for file in "inject" "options"; do \
+ coffee --compile --lint --join $(RELEASE_DIR)/$$file.js $$file.coffee; \
+ done
View
2  inject.coffee
@@ -5,7 +5,7 @@ inject = ->
config.setAttribute 'type', 'text/x-mathjax-config'
config.innerHTML = """
MathJax.Hub.Config({
- tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
+ tex2jax: {inlineMath: [['$','$'], ['\\\\(','\\\\)']]}
});
"""
View
3  manifest.json
@@ -13,5 +13,6 @@
"default_icon": "icon.png",
"default_title": "Enable Math on this domain"
},
- "background_page": "background.html"
+ "background_page": "background.html",
+ "options_page": "options.html"
}
View
6 options.coffee
@@ -0,0 +1,6 @@
+$ ->
+ return unless localStorage['enabled']?
+
+ for domain in JSON.parse localStorage['enabled']
+ do (domain) ->
+ $("<li><a href='http://#{domain}/'>#{domain}</a></li>").appendTo("ul.domains")
View
40 options.haml
@@ -0,0 +1,40 @@
+!!!
+%html
+ %head
+ %title Math anywhere options page
+ %script{src: 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'}
+ %script{src: 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js'}
+ %script{src: 'options.js'}
+ %style
+ :sass
+ *
+ margin: 0
+ padding: 0
+ border: 0
+
+ .container
+ width: 400px
+ margin: 100px auto
+ background: #F5F5FF
+ border-radius: 15px
+ border: 1px solid #EEF
+ padding: 30px
+
+ .domains
+ list-style: none
+ margin-left: 1em
+ color: #333
+ font: 16px Helvetica,arial,freesans,clean,sans-serif
+ line-height: 1.4
+
+ h1
+ font: 26px Helvetica,arial,freesans,clean,sans-serif
+ line-height: 1.4
+ color: #333
+ font-weight: 300
+ margin-bottom: 10px
+
+ %body
+ .container
+ %h1 Enabled domains:
+ %ul.domains
View
2  release/inject.js
@@ -6,7 +6,7 @@
if (typeof MathJax !== "undefined" && MathJax !== null) return;
config = document.createElement('script');
config.setAttribute('type', 'text/x-mathjax-config');
- config.innerHTML = "MathJax.Hub.Config({\n tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}\n});";
+ config.innerHTML = "MathJax.Hub.Config({\n tex2jax: {inlineMath: [['$','$'], ['\\\\(','\\\\)']]}\n});";
cdn = document.createElement('script');
cdn.setAttribute('type', 'text/javascript');
cdn.setAttribute('src', 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML');
View
43 release/options.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+ <head>
+ <title>Math anywhere options page</title>
+ <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>
+ <script src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js'></script>
+ <script src='options.js'></script>
+ <style>
+ * {
+ margin: 0;
+ padding: 0;
+ border: 0; }
+
+ .container {
+ width: 400px;
+ margin: 100px auto;
+ background: #f5f5ff;
+ border-radius: 15px;
+ border: 1px solid #eeeeff;
+ padding: 30px; }
+
+ .domains {
+ list-style: none;
+ margin-left: 1em;
+ color: #333333;
+ font: 16px Helvetica, arial, freesans, clean, sans-serif;
+ line-height: 1.4; }
+
+ h1 {
+ font: 26px Helvetica, arial, freesans, clean, sans-serif;
+ line-height: 1.4;
+ color: #333333;
+ font-weight: 300;
+ margin-bottom: 10px; }
+ </style>
+ </head>
+ <body>
+ <div class='container'>
+ <h1>Enabled domains:</h1>
+ <ul class='domains'></ul>
+ </div>
+ </body>
+</html>
View
17 release/options.js
@@ -0,0 +1,17 @@
+(function() {
+
+ $(function() {
+ var domain, _i, _len, _ref, _results;
+ if (localStorage['enabled'] == null) return;
+ _ref = JSON.parse(localStorage['enabled']);
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ domain = _ref[_i];
+ _results.push((function(domain) {
+ return $("<li><a href='http://" + domain + "/'>" + domain + "</a></li>").appendTo("ul.domains");
+ })(domain));
+ }
+ return _results;
+ });
+
+}).call(this);
Please sign in to comment.
Something went wrong with that request. Please try again.