aboutsummaryrefslogtreecommitdiff
path: root/contexts/data/fiveui
diff options
context:
space:
mode:
Diffstat (limited to 'contexts/data/fiveui')
-rw-r--r--contexts/data/fiveui/background.js210
-rw-r--r--contexts/data/fiveui/chan.js53
-rw-r--r--contexts/data/fiveui/chrome/ajax.js39
-rw-r--r--contexts/data/fiveui/chrome/background.html31
-rw-r--r--contexts/data/fiveui/chrome/background.js165
-rw-r--r--contexts/data/fiveui/chrome/chrome-injected-compute.js27
-rw-r--r--contexts/data/fiveui/chrome/chrome-injected-ui.js27
-rw-r--r--contexts/data/fiveui/chrome/chrome-options.js45
-rw-r--r--contexts/data/fiveui/chrome/chrome-port.js70
-rw-r--r--contexts/data/fiveui/entry.css59
-rw-r--r--contexts/data/fiveui/entry.js277
-rw-r--r--contexts/data/fiveui/ffcheck.js3
-rw-r--r--contexts/data/fiveui/firefox/ajax.js37
-rw-r--r--contexts/data/fiveui/firefox/bootstrap.js22
-rw-r--r--contexts/data/fiveui/firefox/firefox-injected-compute.js55
-rw-r--r--contexts/data/fiveui/firefox/firefox-injected-ui.js30
-rw-r--r--contexts/data/fiveui/firefox/firefox-options.js33
-rw-r--r--contexts/data/fiveui/firefox/icon-content.html82
-rw-r--r--contexts/data/fiveui/firefox/icon-script.js42
-rw-r--r--contexts/data/fiveui/firefox/main.js200
-rw-r--r--contexts/data/fiveui/firefox/options-icon.html31
-rw-r--r--contexts/data/fiveui/firefox/options-script.js27
-rw-r--r--contexts/data/fiveui/firefox/storage.js72
-rw-r--r--contexts/data/fiveui/firefox/tabIds.js36
-rw-r--r--contexts/data/fiveui/firefox/test/test-main.js55
-rw-r--r--contexts/data/fiveui/images/Gear_3.svg95
-rw-r--r--contexts/data/fiveui/images/attribution.txt3
-rw-r--r--contexts/data/fiveui/images/down-arrow.pngbin4791 -> 0 bytes
-rw-r--r--contexts/data/fiveui/images/down-arrow.svg136
-rw-r--r--contexts/data/fiveui/images/errorCircle.pngbin22950 -> 0 bytes
-rw-r--r--contexts/data/fiveui/images/fiveui-icon-128.pngbin4703 -> 0 bytes
-rw-r--r--contexts/data/fiveui/images/fiveui-icon-16.pngbin655 -> 0 bytes
-rw-r--r--contexts/data/fiveui/images/fiveui-icon-48.pngbin1826 -> 0 bytes
-rw-r--r--contexts/data/fiveui/images/fiveui-icon-disabled.pngbin858 -> 0 bytes
-rw-r--r--contexts/data/fiveui/images/fiveui-icon-enabled.pngbin900 -> 0 bytes
-rw-r--r--contexts/data/fiveui/images/fiveui-icon-working.pngbin1107 -> 0 bytes
-rw-r--r--contexts/data/fiveui/images/right-arrow.pngbin4991 -> 0 bytes
-rw-r--r--contexts/data/fiveui/images/right-arrow.svg145
-rw-r--r--contexts/data/fiveui/images/warningTriangle.pngbin21341 -> 0 bytes
-rw-r--r--contexts/data/fiveui/injected/fiveui-injected-compute.js320
-rw-r--r--contexts/data/fiveui/injected/fiveui-injected-ui.js228
-rw-r--r--contexts/data/fiveui/injected/injected.css151
-rw-r--r--contexts/data/fiveui/injected/jquery-plugins.js174
-rw-r--r--contexts/data/fiveui/injected/prelude.js432
-rw-r--r--contexts/data/fiveui/messenger.js141
-rw-r--r--contexts/data/fiveui/options.css144
-rw-r--r--contexts/data/fiveui/options.html88
-rw-r--r--contexts/data/fiveui/options.js217
-rw-r--r--contexts/data/fiveui/rules.js289
-rw-r--r--contexts/data/fiveui/selenium/selenium-injected-compute.js104
-rw-r--r--contexts/data/fiveui/set.js58
-rw-r--r--contexts/data/fiveui/settings.js389
-rw-r--r--contexts/data/fiveui/state.js202
-rw-r--r--contexts/data/fiveui/update-manager.js51
-rw-r--r--contexts/data/fiveui/url-pat.js140
-rw-r--r--contexts/data/fiveui/utils.js145
56 files changed, 0 insertions, 5380 deletions
diff --git a/contexts/data/fiveui/background.js b/contexts/data/fiveui/background.js
deleted file mode 100644
index 284b443..0000000
--- a/contexts/data/fiveui/background.js
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Module : background.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-fiveui = fiveui || {};
-
-(function() {
-/**
- * @constructor
- *
- * @param {!function(!string):!string} dataLoader
- */
-fiveui.Background = function(settings, updateWidget, loadScripts, dataLoader) {
- // Initialize a storage mechanism for FiveUI.
- // Chrome utilizes HTML5's localStorage API as a backend, but other
- // contexts (such as Firefox) would supply a different backend
- // storage to the settings constructor.
- //
- // The data in settings is persisted across executions of the
- // context and the plugin. It is used for long-term storage of user
- // preferences, rule sets, and similarly long-lived FiveUI settings.
- this.settings = settings;
-
- // the state of all managed tabs
- this.state = new fiveui.State(settings);
-
- // how we communicate with the status widget
- this.updateWidget = updateWidget;
-
- // how we signal the browser to load a content script
- this.loadScripts = loadScripts;
-
- this.dataLoader = dataLoader;
-};
-
-fiveui.Background.prototype._registerComputeListeners = function(port, tabState){
- var bg = this;
- port.on('ReportProblem', function(request) {
- var problem = fiveui.Problem.fromJSON(request);
- if(tabState.addProblem(problem) && tabState.uiPort != null) {
- bg.updateWidget(tabState);
- tabState.uiPort.emit('ShowProblem', problem);
- }
- });
- port.on('ReportStats', function (stats) {
- if (tabState.addStats(stats) && tabState.uiPort != null) {
- bg.updateWidget(tabState);
- tabState.uiPort.emit('ShowStats', stats);
- }
- });
-};
-
-fiveui.Background.prototype._registerUiListeners = function(port, tabState){
- var bg = this;
- port.on('Position', function(request) {
- tabState.winState.x = request.left;
- tabState.winState.y = request.top;
- });
- port.on('Size', function(request) {
- tabState.winState.width = request.width;
- tabState.winState.height = request.height;
- });
- port.on('CloseUI', function(request) {
- tabState.winState.closed = true;
- });
- port.on('ClearProblems', function(request) {
- tabState.clearProblems();
- bg.updateWidget(tabState);
- });
- port.on('MaskRules', function(request) {
- _.each(tabState.computePorts, function(cp) {
- cp.emit('MaskRules', null);
- });
- });
- port.on('UnmaskRules', function(request) {
- _.each(tabState.computePorts, function(cp) {
- cp.emit('UnmaskRules', null);
- });
- });
-};
-
-/**
- * Accept a new connection from a content script.
- */
-fiveui.Background.prototype.connect = function(tabId, port, url, isUiPort) {
-
- var tabState = this.state.acquireTabState(tabId);
-
- if (isUiPort) {
- tabState.uiPort = port;
- this._registerUiListeners(port, tabState);
- port.emit('RestoreUI', tabState.toEmit());
- this.updateWidget(tabState);
- } else {
- tabState.computePorts.push(port);
- this._registerComputeListeners(port, tabState);
-
- // get the rule set and send it down to the injected page:
- var pat = this.settings.checkUrl(url);
- if (!pat) {
- console.err('could not find url pattern for tab.url, but one was strongly expected');
- } else {
- var ruleSet = this.settings.getRuleSet(pat.rule_id);
-
- port.emit('SetRules', ruleSet);
- }
- }
-};
-
-/**
- * @param {!number} tabId
- * @param {!string} url
- * @param {*} data
- */
-fiveui.Background.prototype.pageLoad = function(tabId, url, data) {
- var pat = this.settings.checkUrl(url);
-
- if (null == pat) {
- this.updateWidget(null);
- } else {
- var tabState = this.state.acquireTabState(tabId);
- tabState.computePorts = [];
-
- this.updateWidget(tabState);
-
- var dependencies = [];
- var ruleSet = this.settings.getRuleSet(pat.rule_id);
-
- if (ruleSet && ruleSet.dependencies ) {
- dependencies = ruleSet.dependencies;
- }
-
- var computeScripts = _.flatten(
- [ [ this.dataLoader('lib/jquery/jquery-1.8.3.js')
- , this.dataLoader('fiveui/injected/prelude.js')
- , this.dataLoader('lib/jshash/md5.js')
- , this.dataLoader('fiveui/injected/jquery-plugins.js')
- ]
- , dependencies
- , [ this.dataLoader('fiveui/injected/fiveui-injected-compute.js')
- ]
- ]);
- this.loadScripts(tabId, computeScripts, true, data);
-
- var uiScripts = _.flatten(
- [ this.dataLoader('target/injected.css')
- , this.dataLoader('target/bundled.css')
- , this.dataLoader('lib/jquery/jquery-1.8.3.js')
- , this.dataLoader('lib/jquery/jquery-ui-1.9.2.custom.js')
- , this.dataLoader('fiveui/injected/prelude.js')
- , this.dataLoader('fiveui/injected/fiveui-injected-ui.js')
- , this.dataLoader('fiveui/injected/jquery-plugins.js')
- ]);
- this.loadScripts(tabId, uiScripts, false, data);
- }
-};
-
-/**
- * Updates the widget according to the tab state of the specified tab.
- *
- * @param {!number} tabId Id of the tab that is currently active, and
- * thus, dictating the widget display.
- */
-fiveui.Background.prototype.activate = function(tabId) {
- var tabState = this.state.getTabState(tabId);
- this.updateWidget(tabState);
-};
-
-/**
- * Stop tracking the state of a tab.
- *
- * @param {!number} tabId Id of the tab to free the state of.
- */
-fiveui.Background.prototype.removeTab = function(tabId) {
- this.state.removeTabState(tabId);
-};
-
-/**
- * Request that the user interface be restored, if it is closed.
- */
-fiveui.Background.prototype.showUI = function(tabId) {
- var tabState = this.state.getTabState(tabId);
- if(null == tabState) {
- return;
- }
-
- if(tabState.winState.closed) {
- tabState.winState.closed = false;
- tabState.uiPort.emit('ShowUI', null);
- }
-};
-
-})();
diff --git a/contexts/data/fiveui/chan.js b/contexts/data/fiveui/chan.js
deleted file mode 100644
index 47c6145..0000000
--- a/contexts/data/fiveui/chan.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Module : chan.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var fiveui = fiveui || {};
-
-(function() {
-
-/**
- * @constructor
- */
-fiveui.Chan = function() {
- this.fns = {};
-};
-
-_.extend(fiveui.Chan.prototype, {
-
- /**
- * @param {!string} type
- * @param {!function(*)} fn
- */
- on: function(type, fn) {
- this.fns[type] = fn;
- },
-
- /**
- * @param {!string} type
- * @param {*} data
- */
- emit: function(type, data) {
- this.chan.fns[type](data);
- }
-
-});
-
-})();
diff --git a/contexts/data/fiveui/chrome/ajax.js b/contexts/data/fiveui/chrome/ajax.js
deleted file mode 100644
index 68ced39..0000000
--- a/contexts/data/fiveui/chrome/ajax.js
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-var fiveui = fiveui || {};
-
-(function() {
-
-fiveui.ajax = fiveui.ajax || {};
-
-/**
- * Use jQuery to get the resource, calling the success or error continuations
- * when the result is returned. This always retrieves as text, leaving any
- * further processing to the success continuation.
- */
-fiveui.ajax.get = function(url, options) {
-
- _.defaults(options, {
- success:function() {},
- error: function() {}
- });
-
- jQuery.ajax(url, {
-
- dataType: 'text',
-
- success:function(text) {
- // strip out everything else from the args
- options.success(text);
- },
-
- error:function() {
- // call with no context
- options.error();
- },
-
- });
-
-};
-
-})();
diff --git a/contexts/data/fiveui/chrome/background.html b/contexts/data/fiveui/chrome/background.html
deleted file mode 100644
index ea90678..0000000
--- a/contexts/data/fiveui/chrome/background.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
- * Module : chrome/background.html
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Chrome Only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-<!DOCTYPE html>
-<html>
- <head>
- <title>Background Page</title>
- <script src="../../lib/jquery/jquery-1.8.3.js"></script>
- <script src="../../underscore.js"></script>
- <script src="../../backbone.js"></script>
- <script src="../../target/chrome-background.js"></script>
- </head>
- <body/>
-</html>
diff --git a/contexts/data/fiveui/chrome/background.js b/contexts/data/fiveui/chrome/background.js
deleted file mode 100644
index 7f74a33..0000000
--- a/contexts/data/fiveui/chrome/background.js
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Module : chrome/background.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Chrome Only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var fiveui = fiveui || {};
-
-(function() {
-
-fiveui.chrome = fiveui.chrome || {};
-
-/**
- * The primary entry point for the FiveUI Chrome background page.
- */
-fiveui.chrome.background = function() {
-
- /**
- * Inject code and resources into the specified tab's web page.
- *
- * @param {!number} tabid The id of the tab to load scripts into.
- * @param {!Array.<string>} inScripts The list of scripts to load in
- * order.
- * @param {!boolean} inFrames Whether or not to inject into iFrames.
- * @return {void}
- */
- var loadScripts = function(tabid, inScripts, inFrames) {
- var chromeScripts = [dataLoader('fiveui/chrome/chrome-port.js')];
- if(inFrames) {
- chromeScripts.push(dataLoader('fiveui/chrome/chrome-injected-compute.js'));
- } else {
- chromeScripts.push(dataLoader('fiveui/chrome/chrome-injected-ui.js'));
- }
- var scripts = _.flatten([chromeScripts, inScripts]);
-
- var end = function() {};
-
- var loop = function() {
- var next = loop;
- if (scripts.length == 1) {
- next = end;
- }
-
- var script = scripts.shift();
-
- // console.log('injecting: ' + script);
-
- if (/css$/.test(script)) {
- chrome.tabs.insertCSS(tabid, { 'file' : script }, next);
- } else {
- chrome.tabs.executeScript(tabid, { 'file' : script }, next);
- }
- };
-
- loop();
- };
-
- /**
- * Set the current widget icon.
- *
- * @param {!string} iconPath The local path to the icon to use.
- * @return {void}
- */
- var setIcon = function(iconPath) {
- chrome.tabs.getSelected(null,
- function(tab) {
- chrome.browserAction.setIcon({
- path: iconPath,
- tabId: tab.id
- });
- });
- };
-
- /**
- * Change the text undearneath the fiveui icon.
- *
- * @param {!fiveui.TabState} tabState The tab state object to update.
- * @return {void}
- */
- var updateIconText = function(tabState) {
- var tabId = tabState.tabId;
- var probs = tabState.problems.length;
- var text = '';
- if (probs > 0) {
- if (probs > 99) {
- text = '99+';
- } else {
- text = probs.toString();
- }
- }
- chrome.browserAction.setBadgeText({ text: text, tabId: tabId });
- };
-
- var updateWidget = function(tabState) {
- if(null == tabState) {
- setIcon('../images/fiveui-icon-disabled.png');
- } else {
- setIcon('../images/fiveui-icon-enabled.png');
- updateIconText(tabState);
- }
- };
-
- // launch the generic background script
- var dataLoader = function (path) {
- return "data/"+path;
- };
- var settings = new fiveui.Settings(localStorage);
- background = new fiveui.Background(settings, updateWidget,
- loadScripts, dataLoader);
-
- // notify the generic background about a new content script connection.
- chrome.extension.onConnect.addListener(
- function(chPort) {
- var port = new fiveui.ChromePort(chPort);
- var tabId = chPort.sender.tab.id;
- var url = chPort.sender.tab.url;
-
- background.connect(tabId, port, url, chPort.name == 'ui');
- });
-
-
- chrome.tabs.onCreated.addListener(function(tab) {
- // console.log('in oncreated');
- if (tab.url) {
- background.pageLoad(tab.id, tab.url);
- }
- });
- // check page load events against the generic background
- chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
- if (changeInfo.status == 'complete') {
- background.pageLoad(tabId, tab.url);
- }
- });
-
- chrome.tabs.onRemoved.addListener(function(tabId, removeInfo) {
- background.removeTab(tabId);
- });
-
- // show the browser widget when the fiveui button is clicked.
- chrome.browserAction.onClicked.addListener(function(tab) {
- background.showUI(tab.id);
- });
-};
-
-// Add event listeners once the DOM has fully loaded by listening for the
-// `DOMContentLoaded` event on the document, and adding your listeners to
-// specific elements when it triggers.
-jQuery(fiveui.chrome.background);
-
-})();
diff --git a/contexts/data/fiveui/chrome/chrome-injected-compute.js b/contexts/data/fiveui/chrome/chrome-injected-compute.js
deleted file mode 100644
index a372913..0000000
--- a/contexts/data/fiveui/chrome/chrome-injected-compute.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Module : chrome/chrome-injected-compute.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Chrome Only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @return {{on: function(!string, function(*)), emit: function(!string, *)}}
- */
-var obtainComputePort = function() {
- return new fiveui.ChromePort(chrome.extension.connect({ name: 'compute' }));
-};
diff --git a/contexts/data/fiveui/chrome/chrome-injected-ui.js b/contexts/data/fiveui/chrome/chrome-injected-ui.js
deleted file mode 100644
index 939a62d..0000000
--- a/contexts/data/fiveui/chrome/chrome-injected-ui.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Module : chrome/chrome-injected-ui.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Chrome Only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @return {{on: function(!string, function(*)), emit: function(!string, *)}}
- */
-var obtainPort = function() {
- return new fiveui.ChromePort(chrome.extension.connect({ name: 'ui' }));
-};
diff --git a/contexts/data/fiveui/chrome/chrome-options.js b/contexts/data/fiveui/chrome/chrome-options.js
deleted file mode 100644
index 9abccea..0000000
--- a/contexts/data/fiveui/chrome/chrome-options.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Module : chrome/chrome-options.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Chrome Only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var fiveui = fiveui || {};
-
-(function() {
-
-fiveui.chrome = fiveui.chrome || {};
-fiveui.chrome.options = fiveui.chrome.options || {};
-
-
-_.extend(fiveui.chrome.options, {
- init: function() {
- var optionsChan = new fiveui.Chan();
- var storageChan = new fiveui.Chan();
-
- optionsChan.chan = storageChan;
- storageChan.chan = optionsChan;
-
- var settings = new fiveui.Settings(localStorage);
-
- fiveui.Settings.manager(storageChan, settings);
- fiveui.options.init(optionsChan);
- }
-});
-
-})();
diff --git a/contexts/data/fiveui/chrome/chrome-port.js b/contexts/data/fiveui/chrome/chrome-port.js
deleted file mode 100644
index 8a5aeae..0000000
--- a/contexts/data/fiveui/chrome/chrome-port.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Module : chrome/chrome-port.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Chrome Only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-if (typeof goog != 'undefined') {
- goog.provide('fiveui.ChromePort');
-} else {
- var fiveui = fiveui || {};
-}
-
-/**
- * @constructor
- * @param {!{onMessage:Object,postMessage:function(*):void}} port The connection to manage.
- */
-fiveui.ChromePort = function(port) {
- var events = {};
-
- this._port = port;
- this._events = events;
-
- this._port.onMessage.addListener(function(obj) {
- var evt = obj.type;
- var cb = events[evt];
- if(null != evt && null != cb) {
- cb(obj.payload);
- }
- });
-};
-
-/**
- * Listen to incoming messages.
- *
- * @param {!string} evt The event to listen for.
- * @param {!function(*)} cb The callback to invoke.
- * @return {void}
- */
-fiveui.ChromePort.prototype.on = function(evt, cb) {
- this._events[evt] = cb;
-};
-
-/**
- * Send a message to the background.
- *
- * @param {!string} evt The event to fire.
- * @param {?Object} obj The data to associate with the event.
- * @return {void}
- */
-fiveui.ChromePort.prototype.emit = function(evt, obj) {
- // console.log('chromeport.emit: '+evt);
- // console.log(obj);
- this._port.postMessage({ type: evt, payload: obj });
- // console.log('chromeport.emit: '+evt+' done');
-};
diff --git a/contexts/data/fiveui/entry.css b/contexts/data/fiveui/entry.css
deleted file mode 100644
index ec4791c..0000000
--- a/contexts/data/fiveui/entry.css
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Module : entry.css
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-ul.entries {
- list-style: none;
- padding-left: 5px;
-}
-
-ul.entries li.entry {
- border-top: 1px solid #CDCDCD;
- margin-top: 5px;
- padding-top: 10px;
- padding-bottom: 10px;
-}
-
-li.entry .error {
- margin-top: 10px;
- padding: 10px;
- background-color: #FF4D4D;
- color: #ffffff;
-}
-
-ul.entries li.entry:first-child {
- border-top: 0px;
-}
-
-li.entry .button {
- cursor: pointer;
- cursor: hand;
-}
-
-li.entry .editable {
- padding: 5px;
- border: 1px solid #CDCDCD;
-}
-
-li.entry .placeholder {
- font-style: italic;
- color: #CDCDCD;
-}
diff --git a/contexts/data/fiveui/entry.js b/contexts/data/fiveui/entry.js
deleted file mode 100644
index 025034a..0000000
--- a/contexts/data/fiveui/entry.js
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * Module : entry.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-var fiveui = fiveui || {};
-
-(function() {
-
-var editable = function(el, model, placeholder) {
-
- el.prop('contenteditable', true).addClass('editable');
-
- // prevent newlines
- el.on('keypress', function(e) {
- return e.which != 13;
- });
-
- var addPlaceholder = function() {
- el.addClass('placeholder')
- .text(placeholder)
- .one('click keypress paste', remPlaceholder);
- };
-
- var remPlaceholder = function() {
- el.removeClass('placeholder').text('');
- };
-
- // if the model is new, set the placeholder, and a listener to clear it
- if(model.isNew()) {
- addPlaceholder();
- }
-
- el.on('blur', function() {
- if(_.isEmpty(el.text())) {
- addPlaceholder();
- }
- });
-
- el.focus();
-
-};
-
-
-/** UrlPat Entry Elements ****************************************************/
-
-fiveui.UrlPatEntry = Backbone.View.extend({
-
- tagName: 'li',
-
- className: 'entry',
-
- events: {
- 'click span.save' : 'save',
- 'click span.remove' : 'remove',
- 'click span.edit' : 'edit',
- },
-
- initialize:function() {
- this.listenTo(this.model, 'remove', function() {
- this.$el.remove();
- this.stopListening();
- });
- },
-
- viewTemplate: _.template(
- [ '<div>'
- , ' <span class="button remove">x</span>'
- , ' <span class="button edit">edit</span>'
- , ' <span><%= regex %></span>'
- , ' <span><%= rule_name %></span>'
- , '</div>'
- ].join('')),
-
- render:function() {
- var attrs = _.clone(this.model.attributes);
- var ruleSet = this.options.rules.model.findWhere({ id: attrs.rule_id })
- attrs.rule_name = ruleSet.get('name');
- this.$el.html(this.viewTemplate(attrs));
- return this;
- },
-
- editTemplate: _.template(
- [ '<div>'
- , ' <span class="button remove">x</span>'
- , ' <span class="button save">save</span>'
- , ' <span class="regex"></span>'
- , ' <span class="rules"></span>'
- , '</div>'
- ].join('')),
-
- edit:function() {
- var attrs = this.model.attributes;
- this.$el.html(this.editTemplate(attrs));
-
- this.$el.find('.rules').append(this.options.rules.render().$el);
- editable(this.$el.find('.regex'), this.model, 'url pattern');
- return this;
- },
-
- remove: function() {
- this.model.destroy();
- },
-
- save:function() {
- var regex = this.$el.find('.regex').text();
- var rule_id = parseInt(this.options.rules.$el.val());
- this.model.save({ regex : regex, rule_id : rule_id }, {
- success: _.bind(this.render, this),
- error: _.bind(this.edit, this)
- });
- },
-
-});
-
-
-/** Rule Set View ************************************************************/
-
-fiveui.RulesView = Backbone.View.extend({
-
- tagName: 'select',
-
- initialize:function() {
- this.listenTo(this.model, 'sync', this.update);
- this.listenTo(this.model, 'remove', this.update);
- },
-
- optionTemplate:_.template(
- '<option value="<%= id %>"><%= name %></option>'
- ),
-
- update:function() {
- if(this.model.length == 0) {
- return this.remove();
- } else {
- return this.render();
- }
- },
-
- remove:function() {
- this.stopListening();
- this.$el.remove();
-
- this.trigger('remove');
-
- return this;
- },
-
- render:function() {
-
- var scope = this;
-
- this.$el.children().remove();
-
- var text = this.model.foldl(function(body,ruleSet) {
- return body + scope.optionTemplate(ruleSet.attributes);
- }, '');
-
- this.$el.html(text);
-
- return this;
- },
-
-});
-
-
-/** Rule Entry Elements ******************************************************/
-
-fiveui.RuleSetEntry = Backbone.View.extend({
-
- tagName: 'li',
-
- className: 'entry',
-
- events: {
- 'click .save' : 'save',
- 'click .remove' : 'remove',
- 'click .edit' : 'edit',
- 'click .reload' : 'reload',
- },
-
- viewTemplate: _.template(
- [ '<div class="content">'
- , ' <span class="button remove">x</span>'
- , ' <span class="button edit">edit</span>'
- , ' <span class="button reload">reload</span>'
- , ' <span class="title"><%= name %></span>'
- , '</div>'
- ].join('')),
-
- render:function() {
- var attrs = this.model.attributes;
- this.$el.html(this.viewTemplate(attrs));
- return this;
- },
-
- editTemplate: _.template(
- [ '<div class="content">'
- , ' <span class="button remove">x</span>'
- , ' <span class="button save">save</span>'
- , ' <span class="source"><%= source %></span>'
- , '</div>'
- ].join('')),
-
- edit:function() {
- var attrs = this.model.attributes;
- this.$el.html(this.editTemplate(attrs));
-
- editable(this.$el.find('.source'), this.model,
- 'http://example.com/manifest.json')
-
- return this;
- },
-
- errorTemplate: _.template('<div class="error"><%= message %></div>'),
-
- editError:function(target, message) {
- this.edit();
-
- this.$el.append(this.errorTemplate({ message: message }));
-
- return this;
- },
-
- save: function() {
- var source = this.$el.find('.source').text();
- this.model.set('source', source);
- this.model.save({}, {
- success: _.bind(this.render, this),
- error: _.bind(this.editError, this)
- });
- },
-
- reload:function() {
- this.model.save({}, {
- success: _.bind(this.render, this),
- error: _.bind(this.edit, this)
- });
- },
-
- remove:function() {
- var self = this;
-
- this.model.destroy({
- wait:true,
-
- success:function() {
- self.$el.remove();
- self.stopListening();
- },
-
- error:function() {
- console.log('communicate failure somehow...');
- }
- });
- },
-
-});
-
-})();
diff --git a/contexts/data/fiveui/ffcheck.js b/contexts/data/fiveui/ffcheck.js
deleted file mode 100644
index 2157ed0..0000000
--- a/contexts/data/fiveui/ffcheck.js
+++ /dev/null
@@ -1,3 +0,0 @@
-if (! /Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
- window.onload=fiveui.chrome.options.init;
-}
diff --git a/contexts/data/fiveui/firefox/ajax.js b/contexts/data/fiveui/firefox/ajax.js
deleted file mode 100644
index da95c38..0000000
--- a/contexts/data/fiveui/firefox/ajax.js
+++ /dev/null
@@ -1,37 +0,0 @@
-
-var fiveui = fiveui || {};
-var Request = require('request').Request;
-
-(function() {
-
-fiveui.ajax = fiveui.ajax || {};
-
-/**
- * Use the request api to make an XHR request from the extension context.
- * Behaves somewhat like the jQuery.ajax method, but only ever returns the text
- * content of the response.
- */
-fiveui.ajax.get = function(url, opts) {
-
- _.defaults(opts, {
- success: function() {},
- error: function() {},
- });
-
- Request({
-
- url: url,
-
- onComplete:function(resp) {
- if(resp.status == 200) {
- opts.success(resp.text);
- } else {
- opts.error();
- }
- },
-
- }).get();
-
-};
-
-})();
diff --git a/contexts/data/fiveui/firefox/bootstrap.js b/contexts/data/fiveui/firefox/bootstrap.js
deleted file mode 100644
index e7f0b34..0000000
--- a/contexts/data/fiveui/firefox/bootstrap.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Module : firefox/bootstrap.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var fiveui = fiveui || {};
diff --git a/contexts/data/fiveui/firefox/firefox-injected-compute.js b/contexts/data/fiveui/firefox/firefox-injected-compute.js
deleted file mode 100644
index 1f1dc48..0000000
--- a/contexts/data/fiveui/firefox/firefox-injected-compute.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Module : firefox/firefox-injected-compute.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Firefox only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @param {!string} css The css to inject.
- */
-var addGlobalStyle = function(css) {
- var head = document.getElementsByTagName('head')[0]; // find head element, which should exist
- if (!head) {
- head = document.createElement('head');
-
- // XXX this is perhaps not reliable?
- document.body.appendChild(head);
- }
-
- var style = document.createElement('style'); // create <style> element
- style.type = 'text/css';
-
- if (style.styleSheet) { // for some cross-browser problem
- style.styleSheet.cssText = css; // attach CSS text to style elt
- } else {
- style.appendChild(document.createTextNode(css)); // attach CSS text to style elt
- }
- head.appendChild(style); // attach style element to head
-};
-
-/**
- * @return {{on: function(!string, function(*)), emit: function(!string, *)}}
- */
-var obtainComputePort = function() {
- var port = self.port;
-
- port.on('injectCSS', addGlobalStyle);
- return self.port;
-};
-
-
diff --git a/contexts/data/fiveui/firefox/firefox-injected-ui.js b/contexts/data/fiveui/firefox/firefox-injected-ui.js
deleted file mode 100644
index 79636c1..0000000
--- a/contexts/data/fiveui/firefox/firefox-injected-ui.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Module : firefox/firefox-injected-ui.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Firefox only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @return {{on: function(!string, function(*)), emit: function(!string, *)}}
- */
-var obtainPort = function() {
- var port = self.port;
- return self.port;
-};
-
-
diff --git a/contexts/data/fiveui/firefox/firefox-options.js b/contexts/data/fiveui/firefox/firefox-options.js
deleted file mode 100644
index 0ae65f9..0000000
--- a/contexts/data/fiveui/firefox/firefox-options.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Module : firefox/firefox-options.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Firefox only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var fiveui = fiveui || {};
-
-(function() {
-
-fiveui.firefox = fiveui.firefox || {};
-fiveui.firefox.options = fiveui.firefox.options || {};
-
-fiveui.firefox.options.init = function() {
- fiveui.options.init(self.port);
-};
-
-})();
diff --git a/contexts/data/fiveui/firefox/icon-content.html b/contexts/data/fiveui/firefox/icon-content.html
deleted file mode 100644
index d943367..0000000
--- a/contexts/data/fiveui/firefox/icon-content.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<!--
- * Module : firefox/icon-content.html
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Firefox Only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-<!DOCTYPE html>
-<head>
- <style type="text/css">
- body>div {
- width: 24px;
- }
- div {
- cursor: default;
- }
-
- #icon-div {
- position: absolute;
- }
-
- #badge-text {
- position: absolute;
- right: 0px;
- bottom: 4px;
- border: 1px solid black;
- border-radius: 3px;
- color: white;
- font-size: 7pt;
- font-weigth: bold;
- padding-left: 2px;
- padding-right: 1px;
-
- /* IE10 */
- background-image: -ms-linear-gradient(top, #E61010 0%, #750202 100%);
-
- /* Mozilla Firefox */
- background-image: -moz-linear-gradient(top, #E61010 0%, #750202 100%);
-
- /* Opera */
- background-image: -o-linear-gradient(top, #E61010 0%, #750202 100%);
-
- /* Webkit (Safari/Chrome 10) */
- background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #E61010), color-stop(1, #750202));
-
- /* Webkit (Chrome 11+) */
- background-image: -webkit-linear-gradient(top, #E61010 0%, #750202 100%);
-
- /* Proposed W3C Markup */
- background-image: linear-gradient(top, #E61010 0%, #750202 100%);
- }
- </style>
-</head>
-<html>
- <body>
- <div id="icon-div" height="16px">
- <img id="disabled-img"
- src="../images/fiveui-icon-disabled.png"
- height="16px" width="16px">
- </img>
- <img id="enabled-img"
- src="../images/fiveui-icon-enabled.png"
- height="16px" width="16px"
- style="display:none">
- </img>
- <div id="badge-text"></div>
- </div>
- </body>
-</html>
diff --git a/contexts/data/fiveui/firefox/icon-script.js b/contexts/data/fiveui/firefox/icon-script.js
deleted file mode 100644
index 61545da..0000000
--- a/contexts/data/fiveui/firefox/icon-script.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Module : firefox/icon-script.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Firefox only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-(function() {
- var updateBadgeText = function(text) {
- $('#badge-text').text(text);
- $('#badge-text').show();
- };
-
- self.port.on('setEnabled', function(text) {
- $('#disabled-img').hide();
- $('#enabled-img').show();
- if (text.length != 0) {
- updateBadgeText(text);
- } else {
- $('#badge-text').hide();
- }
- });
- self.port.on('setDisabled', function() {
- $('#disabled-img').show();
- $('#enabled-img').hide();
- $('#badge-text').hide();
- });
- })();
diff --git a/contexts/data/fiveui/firefox/main.js b/contexts/data/fiveui/firefox/main.js
deleted file mode 100644
index 2723c72..0000000
--- a/contexts/data/fiveui/firefox/main.js
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Module : firefox/main.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Firefox only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-_ = require('underscore');
-Backbone = require('backbone');
-
-var fiveui = fiveui || {};
-
-(function() {
-
-fiveui.firefox = fiveui.firefox || {};
-
-const widgets = require("widget");
-const tabs = require("tabs");
-const data = require("self").data;
-const pageMod = require("page-mod");
-
-fiveui.firefox.main = function() {
- var settings = new fiveui.Settings(new fiveui.firefox.StorageWrapper());
- var activeId = 0;
-
- // initialze the background functionality
-
- // the FiveUI button:
- var icon = widgets.Widget({
- id: "FiveUI-Icon",
- label: "FiveUI",
- contentURL: data.url('fiveui/firefox/icon-content.html'),
- contentScriptFile: [
- data.url('lib/jquery/jquery-1.8.3.js'),
- data.url('fiveui/firefox/icon-script.js')
- ],
- onClick: function() {
- background.showUI(activeId);
- }
- });
-
- var optionsButton = widgets.Widget(
- { id: "FiveUI-Options",
- label: "FiveUI",
- contentURL: data.url('fiveui/firefox/options-icon.html'),
- contentScriptFile: [
- data.url('lib/jquery/jquery-1.8.3.js'),
- data.url('fiveui/firefox/options-script.js')
- ]
- }
- );
-
- /**
- * @param {?fiveui.TabState} tabState
- */
- var updateWidget = function(tabState) {
- if(null == tabState) {
- icon.port.emit('setDisabled');
- icon.width = 16;
- } else {
- var problems = getProblemCount(tabState);
- icon.port.emit('setEnabled', problems);
- if (problems == 0){
- icon.width = 16;
- } else {
- icon.width = 24;
- }
- }
- };
-
- // store the contents of the injected css, so that we can inject it later
- var injectedCSS = [
- data.load('target/injected.css'),
- data.load('target/bundled.css')
- ].join('\n');
-
- /**
- * Inject code and resources into the specified tab's web page.
- *
- * @param {!number} tabid The id of the tab to load scripts into.
- * @param {!Array.<string>} inScripts The list of scripts to load in
- * order.
- * @param {!boolean} inFrames Whether or not to inject into iFrames.
- * @return {void}
- */
- var loadScripts = function(tabId, inScripts, inFrames, tab) {
-
- if(inFrames) {
- var firefoxScripts = [dataLoader('fiveui/firefox/firefox-injected-compute.js')];
- } else {
- var firefoxScripts = [dataLoader('fiveui/firefox/firefox-injected-ui.js')];
- }
-
- // just scripts, css gets filtered out.
- var scripts = _.filter(_.flatten([firefoxScripts, inScripts]),
- function(script) {
- console.log(script);
- return script.search(/\.css$/i) == -1;
- });
-
- if (tab) {
- var worker = tab.attach({
- contentScriptFile: scripts
- });
-
- background.connect(tabId, worker.port, tab.url, !inFrames);
- worker.port.emit('injectCSS', injectedCSS);
- }
- };
-
- var dataLoader = function(path) {
- return data.url(path);
- };
-
- var background = new fiveui.Background(settings, updateWidget,
- loadScripts, dataLoader);
-
- var tabIds = new fiveui.firefox.TabIds();
-
- var handleNewTab = function(tab) {
- var tabId = tabIds.allocate();
-
- tab.on('activate', function() {
- background.activate(tabId);
- activeId = tabId;
- });
-
- tab.on('ready', function() {
- background.pageLoad(tabId, tab.url, tab);
- });
-
- tab.on('close', function() {
- tabIds.free(tabId);
- background.removeTab(tabId);
- });
- };
-
- // handle existing tabs
- _.each(tabs, handleNewTab);
-
- // manage new tab creation
- tabs.on('open', handleNewTab);
-
- /**
- * @param {!fiveui.TabState} tabstate
- * @return {void}
- */
- var getProblemCount = function(tabState){
- var tabId = tabState.tabId;
- var probs = tabState.problems.length;
- var text = '';
- if (probs > 0) {
- if (probs > 99) {
- text = '99+';
- } else {
- text = probs.toString();
- }
- }
- return text;
- };
-
- var showOptions = function() {
- // TODO does not make use of existing options tabs, if any are open:
- tabs.open(data.url('fiveui/options.html'));
- };
-
- // set up a page-mod to be active on the options page, so that
- // page can communicate with the add-on:
- pageMod.PageMod(
- { include: data.url('fiveui/options.html'),
- contentScriptWhen: 'end',
- contentScriptFile: [
- data.url("target/firefox-options.js")
- ],
- contentScript: "fiveui.firefox.options.init()",
- onAttach: function (worker) {
- fiveui.Settings.manager(worker.port, settings);
- }
- });
-
- optionsButton.port.on('showOptions', showOptions);
-};
-
-exports.main = fiveui.firefox.main;
-
-})();
diff --git a/contexts/data/fiveui/firefox/options-icon.html b/contexts/data/fiveui/firefox/options-icon.html
deleted file mode 100644
index 850b530..0000000
--- a/contexts/data/fiveui/firefox/options-icon.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
- * Module : firefox/options-icon.html
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Firefox only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-
-<html>
- <body>
- <div id="options-div">
- <img id="options-img"
- src="../images/Gear_3.svg"
- height="16" width="16">
- </img>
- </div>
- </body>
-</html>
diff --git a/contexts/data/fiveui/firefox/options-script.js b/contexts/data/fiveui/firefox/options-script.js
deleted file mode 100644
index 2008883..0000000
--- a/contexts/data/fiveui/firefox/options-script.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Module : firefox/options-script.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Firefox only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-(function() {
- $('#options-div').click(function() {
- //console.log('options-div handler');
- self.port.emit('showOptions');
- });
- })();
diff --git a/contexts/data/fiveui/firefox/storage.js b/contexts/data/fiveui/firefox/storage.js
deleted file mode 100644
index 9aa51aa..0000000
--- a/contexts/data/fiveui/firefox/storage.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Module : firefox/storage.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Firefox only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-if (typeof goog != 'undefined') {
- goog.provide('fiveui.firefox.StorageWrapper');
-} else {
- var fiveui = fiveui || {};
- fiveui.firefox = fiveui.firefox || {};
-}
-
-const ss = require('simple-storage');
-
-/**
- * A wraper around the Firefox Simple-Storage API to match the w3c Storage interface:
- * http://dev.w3.org/html5/webstorage/#storage-0
- */
-fiveui.firefox.StorageWrapper = function() {
- this.__defineGetter__('length',
- function(){
- return Object.keys(ss.storage).length;
- });
-};
-
-fiveui.firefox.StorageWrapper.prototype.key = function(idx) {
- return Object.keys(ss.storage)[idx];
-};
-
-fiveui.firefox.StorageWrapper.prototype.getItem = function(key) {
- return ss.storage[key];
-};
-
-fiveui.firefox.StorageWrapper.prototype.setItem = function(key, value) {
- ss.storage[key] = value;
-};
-
-fiveui.firefox.StorageWrapper.prototype.removeItem = function(key) {
- var keys = Object.keys(ss.storage);
- for(var i=0; i<keys.length; ++i) {
- if(keys[i] == key) {
- keys.splice(i,1);
- delete ss.storage[key];
- return;
- }
- }
-};
-
-fiveui.firefox.StorageWrapper.prototype.clear = function() {
- var keys = Object.keys(ss.storage);
- for(var i=0; i<keys.length; ++i) {
- delete ss.storage[keys[i]];
- }
-};
-
-exports.StorageWrapper = fiveui.firefox.StorageWrapper;
diff --git a/contexts/data/fiveui/firefox/tabIds.js b/contexts/data/fiveui/firefox/tabIds.js
deleted file mode 100644
index babd7cf..0000000
--- a/contexts/data/fiveui/firefox/tabIds.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Module : firefox/tabIds.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Firefox only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-(function() {
-
-fiveui.firefox.TabIds = function() {
- this.next = 0;
-};
-
-fiveui.firefox.TabIds.prototype.allocate = function() {
- var tabId = this.next;
- this.next = this.next + 1;
- return tabId;
-};
-
-fiveui.firefox.TabIds.prototype.free = function(tabId) {};
-
-})();
diff --git a/contexts/data/fiveui/firefox/test/test-main.js b/contexts/data/fiveui/firefox/test/test-main.js
deleted file mode 100644
index c25fec5..0000000
--- a/contexts/data/fiveui/firefox/test/test-main.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Module : firefox/test/test-main.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Firefox only)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-const stWrapper = require("fiveui/firefox/storage");
-
-var setup = function(fn){
- return function(test) {
- var storage = new stWrapper.StorageWrapper();
- storage.clear();
- fn(test);
- };
-};
-
-exports.test_newStorageWrapper = setup(function(test) {
- var storage = new stWrapper.StorageWrapper();
- var key = 'key';
- var val = 'val';
- storage.setItem(key, val);
- test.assertEqual(val, storage.getItem(key), 'wrong value');
-});
-
-exports.test_keys = setup(function(test) {
- var storage = new stWrapper.StorageWrapper();
- var key = 'key';
- var val = 'val';
- storage.setItem(key, val);
- test.assertEqual(key, storage.key(0), 'wrong key returned');
-});
-
-exports.test_length = setup(function(test) {
- var storage = new stWrapper.StorageWrapper();
- var x = 10;
- for (var i=0; i < x; ++i) {
- storage.setItem(i, i*i);
- }
- test.assertEqual(x, storage.length, 'unexpected length');
-}); \ No newline at end of file
diff --git a/contexts/data/fiveui/images/Gear_3.svg b/contexts/data/fiveui/images/Gear_3.svg
deleted file mode 100644
index ca241ce..0000000
--- a/contexts/data/fiveui/images/Gear_3.svg
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="110.001"
- height="110.003"
- id="svg2501"
- sodipodi:version="0.32"
- inkscape:version="0.46"
- version="1.0"
- sodipodi:docname="gear 3.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape">
- <defs
- id="defs2503">
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 526.18109 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="744.09448 : 526.18109 : 1"
- inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
- id="perspective2509" />
- </defs>
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- gridtolerance="10000"
- guidetolerance="10"
- objecttolerance="10"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="0.35"
- inkscape:cx="375"
- inkscape:cy="520"
- inkscape:document-units="px"
- inkscape:current-layer="layer1"
- showgrid="false"
- inkscape:window-width="672"
- inkscape:window-height="718"
- inkscape:window-x="600"
- inkscape:window-y="249" />
- <metadata
- id="metadata2506">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <cc:license
- rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
- <dc:creator>
- <cc:Agent>
- <dc:title>eugrafia</dc:title>
- </cc:Agent>
- </dc:creator>
- </cc:Work>
- <cc:License
- rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Reproduction" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Distribution" />
- <cc:requires
- rdf:resource="http://creativecommons.org/ns#Notice" />
- <cc:requires
- rdf:resource="http://creativecommons.org/ns#Attribution" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
- <cc:requires
- rdf:resource="http://creativecommons.org/ns#ShareAlike" />
- </cc:License>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Layer 1"
- inkscape:groupmode="layer"
- id="layer1"
- transform="translate(-90.71378,-123.07497)">
- <g
- id="g11"
- transform="translate(-331.78622,98.676973)">
- <path
- d="M 477.502,50.642 C 461.474,50.642 448.433,63.543 448.433,79.4 C 448.433,95.257 461.474,108.158 477.502,108.158 C 493.53,108.158 506.57,95.257 506.57,79.4 C 506.57,63.543 493.53,50.642 477.502,50.642 z M 523.424,79.399 C 523.424,77.938 523.347,76.495 523.211,75.069 L 532.501,71.351 C 532.08,68.504 531.441,65.727 530.596,63.04 L 520.599,63.678 C 519.578,60.942 518.3,58.328 516.794,55.868 L 523.524,48.539 C 521.907,46.18 520.106,43.955 518.147,41.879 L 509.415,46.747 C 507.318,44.74 505.03,42.93 502.579,41.346 L 505.433,31.837 C 502.962,30.413 500.37,29.173 497.676,28.133 L 491.94,36.272 C 489.202,35.375 486.348,34.727 483.407,34.353 L 481.808,24.561 C 480.386,24.453 478.951,24.398 477.501,24.398 C 476.051,24.398 474.614,24.453 473.192,24.561 L 471.594,34.353 C 468.652,34.727 465.8,35.375 463.06,36.272 L 457.326,28.133 C 454.63,29.173 452.04,30.413 449.568,31.837 L 452.424,41.346 C 449.971,42.93 447.683,44.741 445.586,46.747 L 436.855,41.879 C 434.896,43.955 433.095,46.18 431.477,48.539 L 438.209,55.868 C 436.701,58.328 435.424,60.942 434.403,63.678 L 424.405,63.04 C 423.561,65.727 422.921,68.504 422.5,71.351 L 431.791,75.069 C 431.654,76.495 431.577,77.938 431.577,79.399 C 431.577,80.86 431.654,82.303 431.791,83.729 L 422.5,87.447 C 422.921,90.294 423.562,93.071 424.405,95.758 L 434.403,95.12 C 435.424,97.856 436.701,100.47 438.209,102.929 L 431.477,110.259 C 433.095,112.618 434.896,114.843 436.855,116.919 L 445.586,112.051 C 447.683,114.058 449.971,115.866 452.424,117.452 L 449.568,126.961 C 452.04,128.385 454.631,129.625 457.326,130.664 L 463.06,122.527 C 465.8,123.424 468.652,124.072 471.594,124.446 L 473.192,134.238 C 474.614,134.345 476.05,134.401 477.501,134.401 C 478.95,134.401 480.386,134.345 481.808,134.238 L 483.407,124.446 C 486.348,124.072 489.202,123.424 491.94,122.527 L 497.675,130.664 C 500.37,129.625 502.961,128.386 505.433,126.961 L 502.579,117.452 C 505.03,115.866 507.318,114.057 509.415,112.051 L 518.147,116.919 C 520.106,114.843 521.907,112.618 523.524,110.259 L 516.792,102.929 C 518.3,100.47 519.578,97.856 520.599,95.12 L 530.596,95.758 C 531.442,93.071 532.08,90.294 532.501,87.447 L 523.211,83.729 C 523.347,82.303 523.424,80.86 523.424,79.399 z M 477.502,112.796 C 458.888,112.796 443.743,97.815 443.743,79.4 C 443.743,60.985 458.888,46.004 477.502,46.004 C 496.116,46.004 511.26,60.985 511.26,79.4 C 511.26,97.815 496.116,112.796 477.502,112.796 z"
- id="path13" />
- </g>
- </g>
-</svg>
diff --git a/contexts/data/fiveui/images/attribution.txt b/contexts/data/fiveui/images/attribution.txt
deleted file mode 100644
index fb8c49c..0000000
--- a/contexts/data/fiveui/images/attribution.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Gear_3.svg is used under a Creative Commons liscense. The svg was found here:
-
- - http://en.wikipedia.org/wiki/File:Gear_3.svg
diff --git a/contexts/data/fiveui/images/down-arrow.png b/contexts/data/fiveui/images/down-arrow.png
deleted file mode 100644
index 4fd7d54..0000000
--- a/contexts/data/fiveui/images/down-arrow.png
+++ /dev/null
Binary files differ
diff --git a/contexts/data/fiveui/images/down-arrow.svg b/contexts/data/fiveui/images/down-arrow.svg
deleted file mode 100644
index 6b4ba07..0000000
--- a/contexts/data/fiveui/images/down-arrow.svg
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
- xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="300"
- height="300"
- id="svg2"
- version="1.1"
- inkscape:version="0.48.1 r9760"
- sodipodi:docname="right-arrow.svg"
- inkscape:export-filename="/home/creswick/development/uic/contexts/data/fiveui/images/right-arrow.png"
- inkscape:export-xdpi="85.190002"
- inkscape:export-ydpi="85.190002">
- <defs
- id="defs4">
- <linearGradient
- id="linearGradient3794"
- osb:paint="solid">
- <stop
- style="stop-color:#000000;stop-opacity:1;"
- offset="0"
- id="stop3796" />
- </linearGradient>
- <filter
- inkscape:collect="always"
- id="filter3863"
- x="-0.20427911"
- width="1.4085582"
- y="-0.23588121"
- height="1.4717624">
- <feGaussianBlur
- inkscape:collect="always"
- stdDeviation="12.950693"
- id="feGaussianBlur3865" />
- </filter>
- </defs>
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="1.4"
- inkscape:cx="70.679679"
- inkscape:cy="159.10715"
- inkscape:document-units="px"
- inkscape:current-layer="layer1"
- showgrid="false"
- fit-margin-top="0"
- fit-margin-left="0"
- fit-margin-right="0"
- fit-margin-bottom="0"
- inkscape:window-width="1278"
- inkscape:window-height="773"
- inkscape:window-x="0"
- inkscape:window-y="25"
- inkscape:window-maximized="0"
- showguides="true"
- inkscape:guide-bbox="true">
- <sodipodi:guide
- orientation="0,1"
- position="84.285714,260"
- id="guide3851" />
- <sodipodi:guide
- orientation="1,0"
- position="40,265.71429"
- id="guide3853" />
- </sodipodi:namedview>
- <metadata
- id="metadata7">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Layer 1"
- inkscape:groupmode="layer"
- id="layer1"
- transform="translate(-76.077235,-254.86721)">
- <path
- sodipodi:type="star"
- style="opacity:0.31818183;fill:#000000;fill-opacity:1;stroke:none;filter:url(#filter3863)"
- id="path2987-6"
- sodipodi:sides="3"
- sodipodi:cx="145"
- sodipodi:cy="453.79074"
- sodipodi:r1="87.845528"
- sodipodi:r2="43.922764"
- sodipodi:arg1="-0.52359878"
- sodipodi:arg2="0.52359878"
- inkscape:flatsided="false"
- inkscape:rounded="0"
- inkscape:randomized="0"
- d="M 221.07646,409.86798 183.03823,475.75212 145,541.63627 106.96177,475.75212 68.923541,409.86798 l 76.076459,0 z"
- transform="matrix(0.98585031,0,0,1.1383619,72.27179,-151.28232)"
- inkscape:export-filename="/home/creswick/development/uic/contexts/data/fiveui/images/downArrow.png"
- inkscape:export-xdpi="120"
- inkscape:export-ydpi="120"
- inkscape:transform-center-x="25.000015" />
- <path
- sodipodi:type="star"
- style="fill:#000000;fill-opacity:1;stroke:none"
- id="path2987"
- sodipodi:sides="3"
- sodipodi:cx="145"
- sodipodi:cy="453.79074"
- sodipodi:r1="87.845528"
- sodipodi:r2="43.922764"
- sodipodi:arg1="-0.52359878"
- sodipodi:arg2="0.52359878"
- inkscape:flatsided="false"
- inkscape:rounded="0"
- inkscape:randomized="0"
- d="M 221.07646,409.86798 183.03823,475.75212 145,541.63627 106.96177,475.75212 68.923541,409.86798 l 76.076459,0 z"
- transform="matrix(0.98585031,0,0,1.1383619,48.12894,-171.71088)"
- inkscape:export-filename="/home/creswick/development/uic/contexts/data/fiveui/images/downArrow.png"
- inkscape:export-xdpi="120"
- inkscape:export-ydpi="120"
- inkscape:transform-center-x="25.000015" />
- </g>
-</svg>
diff --git a/contexts/data/fiveui/images/errorCircle.png b/contexts/data/fiveui/images/errorCircle.png
deleted file mode 100644
index d5c1dc0..0000000
--- a/contexts/data/fiveui/images/errorCircle.png
+++ /dev/null
Binary files differ
diff --git a/contexts/data/fiveui/images/fiveui-icon-128.png b/contexts/data/fiveui/images/fiveui-icon-128.png
deleted file mode 100644
index 1f0b6c4..0000000
--- a/contexts/data/fiveui/images/fiveui-icon-128.png
+++ /dev/null
Binary files differ
diff --git a/contexts/data/fiveui/images/fiveui-icon-16.png b/contexts/data/fiveui/images/fiveui-icon-16.png
deleted file mode 100644
index cc256e0..0000000
--- a/contexts/data/fiveui/images/fiveui-icon-16.png
+++ /dev/null
Binary files differ
diff --git a/contexts/data/fiveui/images/fiveui-icon-48.png b/contexts/data/fiveui/images/fiveui-icon-48.png
deleted file mode 100644
index 2d586fa..0000000
--- a/contexts/data/fiveui/images/fiveui-icon-48.png
+++ /dev/null
Binary files differ
diff --git a/contexts/data/fiveui/images/fiveui-icon-disabled.png b/contexts/data/fiveui/images/fiveui-icon-disabled.png
deleted file mode 100644
index 66b6a63..0000000
--- a/contexts/data/fiveui/images/fiveui-icon-disabled.png
+++ /dev/null
Binary files differ
diff --git a/contexts/data/fiveui/images/fiveui-icon-enabled.png b/contexts/data/fiveui/images/fiveui-icon-enabled.png
deleted file mode 100644
index 144f64e..0000000
--- a/contexts/data/fiveui/images/fiveui-icon-enabled.png
+++ /dev/null
Binary files differ
diff --git a/contexts/data/fiveui/images/fiveui-icon-working.png b/contexts/data/fiveui/images/fiveui-icon-working.png
deleted file mode 100644
index 94643c7..0000000
--- a/contexts/data/fiveui/images/fiveui-icon-working.png
+++ /dev/null
Binary files differ
diff --git a/contexts/data/fiveui/images/right-arrow.png b/contexts/data/fiveui/images/right-arrow.png
deleted file mode 100644
index 614e65d..0000000
--- a/contexts/data/fiveui/images/right-arrow.png
+++ /dev/null
Binary files differ
diff --git a/contexts/data/fiveui/images/right-arrow.svg b/contexts/data/fiveui/images/right-arrow.svg
deleted file mode 100644
index 192f654..0000000
--- a/contexts/data/fiveui/images/right-arrow.svg
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
- xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="300"
- height="300"
- id="svg2"
- version="1.1"
- inkscape:version="0.48.1 r9760"
- sodipodi:docname="down-arrow.svg">
- <defs
- id="defs4">
- <linearGradient
- id="linearGradient3794"
- osb:paint="solid">
- <stop
- style="stop-color:#000000;stop-opacity:1;"
- offset="0"
- id="stop3796" />
- </linearGradient>
- <filter
- inkscape:collect="always"
- id="filter3816"
- x="-0.15434422"
- width="1.3086884"
- y="-0.17822135"
- height="1.3564427">
- <feGaussianBlur
- inkscape:collect="always"
- stdDeviation="9.7849681"
- id="feGaussianBlur3818" />
- </filter>
- <filter
- inkscape:collect="always"
- id="filter3863"
- x="-0.20427911"
- width="1.4085582"
- y="-0.23588121"
- height="1.4717624">
- <feGaussianBlur
- inkscape:collect="always"
- stdDeviation="12.950693"
- id="feGaussianBlur3865" />
- </filter>
- </defs>
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="1.4"
- inkscape:cx="70.679679"
- inkscape:cy="159.10715"
- inkscape:document-units="px"
- inkscape:current-layer="layer1"
- showgrid="false"
- fit-margin-top="0"
- fit-margin-left="0"
- fit-margin-right="0"
- fit-margin-bottom="0"
- inkscape:window-width="1278"
- inkscape:window-height="773"
- inkscape:window-x="0"
- inkscape:window-y="25"
- inkscape:window-maximized="0"
- showguides="true"
- inkscape:guide-bbox="true">
- <sodipodi:guide
- orientation="0,1"
- position="84.285714,260"
- id="guide3851" />
- <sodipodi:guide
- orientation="1,0"
- position="40,265.71429"
- id="guide3853" />
- </sodipodi:namedview>
- <metadata
- id="metadata7">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Layer 1"
- inkscape:groupmode="layer"
- id="layer1"
- transform="translate(-76.077235,-254.86721)">
- <path
- sodipodi:type="star"
- style="opacity:0.31818182000000000;fill:#000000;fill-opacity:1;stroke:none;filter:url(#filter3863)"
- id="path2987-6"
- sodipodi:sides="3"
- sodipodi:cx="145"
- sodipodi:cy="453.79074"
- sodipodi:r1="87.845528"
- sodipodi:r2="43.922764"
- sodipodi:arg1="-0.52359878"
- sodipodi:arg2="0.52359878"
- inkscape:flatsided="false"
- inkscape:rounded="0"
- inkscape:randomized="0"
- d="M 221.07646,409.86798 183.03823,475.75212 145,541.63627 106.96177,475.75212 68.923541,409.86798 l 76.076459,0 z"
- transform="matrix(0,-0.98585031,1.1383619,0,-326.358,533.24407)"
- inkscape:export-filename="/home/creswick/development/uic/contexts/data/fiveui/images/downArrow.png"
- inkscape:export-xdpi="120"
- inkscape:export-ydpi="120"
- inkscape:transform-center-y="25.000015" />
- <path
- sodipodi:type="star"
- style="fill:#000000;fill-opacity:1;stroke:none"
- id="path2987"
- sodipodi:sides="3"
- sodipodi:cx="145"
- sodipodi:cy="453.79074"
- sodipodi:r1="87.845528"
- sodipodi:r2="43.922764"
- sodipodi:arg1="-0.52359878"
- sodipodi:arg2="0.52359878"
- inkscape:flatsided="false"
- inkscape:rounded="0"
- inkscape:randomized="0"
- d="M 221.07646,409.86798 183.03823,475.75212 145,541.63627 106.96177,475.75212 68.923541,409.86798 l 76.076459,0 z"
- transform="matrix(0,-0.98585031,1.1383619,0,-350.50085,512.81551)"
- inkscape:export-filename="/home/creswick/development/uic/contexts/data/fiveui/images/downArrow.png"
- inkscape:export-xdpi="120"
- inkscape:export-ydpi="120"
- inkscape:transform-center-y="25.000015" />
- </g>
-</svg>
diff --git a/contexts/data/fiveui/images/warningTriangle.png b/contexts/data/fiveui/images/warningTriangle.png
deleted file mode 100644
index dac1d03..0000000
--- a/contexts/data/fiveui/images/warningTriangle.png
+++ /dev/null
Binary files differ
diff --git a/contexts/data/fiveui/injected/fiveui-injected-compute.js b/contexts/data/fiveui/injected/fiveui-injected-compute.js
deleted file mode 100644
index 7ae9848..0000000
--- a/contexts/data/fiveui/injected/fiveui-injected-compute.js
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Module : injected/fiveui-injected-compute.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-(function(){
- var guidGenerator = function () {
- var S4 = function() {
- return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
- };
- return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
- };
-
- /**
- * Storage namespace for in-browser logic
- */
- var core = {};
- core.port = obtainComputePort();
-
- /**
- * Whether or not rules are fired when a dom change is detected.
- */
- core.maskRules = false;
-
- /**
- * Timeout (in miliseconds) for the dom to settle, before running the rules
- * engine again.
- */
- core.timeout = 500;
-
- /**
- * Whether or not the rules thread should be started.
- */
- core.scheduled = false;
-
- /**
- * Start the process that checks for the need to run the rules, and
- * reschedules when necessary.
- */
- core.scheduleRules = function() {
- core.lastEvent = new Date();
-
- var check = function() {
- var delta = new Date() - core.lastEvent;
- if(delta > core.timeout && !core.maskRules) {
- core.scheduled = false;
- core.evaluate(core.rules.rules);
- } else {
- setTimeout(check, core.timeout);
- }
- };
-
- if(!core.scheduled && !core.maskRules) {
- core.scheduled = true;
- check();
- }
- };
-
- core.port.on('MaskRules', function() {
- core.maskRules = true;
- });
-
- core.port.on('UnmaskRules', function() {
- core.maskRules = false;
- });
-
- core.reportProblem = function(prob) {
- core.port.emit('ReportProblem', prob);
- };
-
- core.reportStats = function(stats) {
- core.port.emit('ReportStats', stats);
- };
-
- core.hash = function(rule, name, node) {
- var prob = {
- name: name,
- descr: rule.description,
- url: window.location.href,
- severity: 1,
- xpath: core.getElementXPath(node)
- };
-
- var nodeParents = function(node) {
- var parents = '';
- $(node).parents().each(
- function (idx, elt) {
- parents += elt.tagName;
- parents += ">";
- });
- return parents;
- };
-
- var nodeHash = function(node) {
- if (node == null) {
- return "";
- }
-
- return nodeParents(node) + node.id + node.tagName;
- };
-
- var str = prob.name + prob.descr + prob.url + prob.severity
- + name + nodeHash(node);
-
- prob.hash = hex_md5(str); // hex_md5() is from md5.js
-
- return prob;
- };
-
- /* The next two methods are provided under the following license: */
- /* Software License Agreement (BSD License)
-
- Copyright (c) 2007, Parakey Inc.
- All rights reserved.
-
- Redistribution and use of this software in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- * 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.
-
- * Neither the name of Parakey Inc. nor the names of its
- contributors may be used to endorse or promote products
- derived from this software without specific prior
- written permission of Parakey Inc.
-
- 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 OWNER 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.
- */
-
- /**
- * Gets an XPath for an element which describes its hierarchical location.
- */
- core.getElementXPath = function(element)
- {
- if (element && element.id)
- return '//*[@id="' + element.id + '"]';
- else
- return core.getElementTreeXPath(element);
- };
-
- core.getElementTreeXPath = function(element)
- {
- var paths = [];
-
- // Use nodeName (instead of localName) so namespace prefix is included (if any).
- for (; element && element.nodeType == 1; element = element.parentNode)
- {
- var index = 0;
- for (var sibling = element.previousSibling; sibling; sibling = sibling.previousSibling)
- {
- // Ignore document type declaration.
- if (sibling.nodeType == Node.DOCUMENT_TYPE_NODE)
- continue;
-
- if (sibling.nodeName == element.nodeName)
- ++index;
- }
-
- var tagName = element.nodeName.toLowerCase();
- var pathIndex = (index ? "[" + (index+1) + "]" : "");
- paths.splice(0, 0, tagName + pathIndex);
- }
-
- return paths.length ? "/" + paths.join("/") : null;
- };
-
- /* END of BSD licensed code */
-
- core.evaluate = function(rs) {
- var theRule = null;
- var date = new Date();
- var stats =
- { start: date.getTime()
- , end: null
- , numRules: 0
- , numElts: 0
- };
- fiveui.stats.numElts = 0; // reset stats element counter
-
- var report = function(name, node) {
- var prob = core.hash(theRule, name, node);
- var query = $(node);
- if(!query.hasClass(prob.hash)) {
- query.addClass(prob.hash);
- core.reportProblem(prob);
- }
- };
-
- for(var i=0; i<rs.length; ++i) {
- var theRule = rs[i];
- var scope = {
- name: theRule.name,
- description: theRule.description,
- ruleSet: core.rules
- };
-
- if (theRule.rule) {
- try {
- // note: fiveui.stats.numElts is updated as a side effect here
- theRule.rule.apply(scope);
- } catch (e) {
- console.log('exception running rule: ' + theRule.name);
- console.log(e.toString());
- }
- stats.numRules += 1;
- }
- }
-
- date = new Date();
- stats.end = date.getTime();
- stats.numElts = fiveui.stats.numElts;
- core.reportStats(stats);
- };
-
- /**
- * Set up handlers for DOM mutation events, and register
- * recursively on inserted frames.
- */
- var registerDomListeners = function(context) {
- /**
- * @param {DOMNode} elt
- */
- var underFiveUI = function(elt) {
- var ancestor = $(elt).parentsUntil('#uic-top', 'body');
- return ancestor.length == 0;
- };
-
- var uicAttrEvent = function(elt){
- return null != elt.className
- && elt.className.search(/\s?uic-[^\s]+/) >= 0;
- };
-
- var handleDOMEvent = function(e){
- if ( !uicAttrEvent(e.target) && !underFiveUI(e.target) ) {
- core.scheduleRules();
- }
- };
-
- context.addEventListener('DOMNodeInserted', handleDOMEvent);
- context.addEventListener('DOMNodeRemoved', handleDOMEvent);
- context.addEventListener('DOMSubtreeModified', handleDOMEvent);
- context.addEventListener('DOMAttrModified', handleDOMEvent);
- context.addEventListener('DOMNodeRemovedFromDocument', handleDOMEvent);
- context.addEventListener('DOMNodeInsertedIntoDocument', handleDOMEvent);
- context.addEventListener('DOMCharacterDataModified', handleDOMEvent);
- context.addEventListener('DOMNodeInsertedIntoDocument', handleDOMEvent);
-
- context.addEventListener('DOMNodeInserted',
- function(e) {
- var eTagName = e.target.tagName;
- if (eTagName == 'IFRAME' || eTagName == 'FRAME') {
- e.target.onload = function() {
- core.scheduleRules();
- registerDomListeners(e.target.contentDocument);
- };
- }
- });
- };
-
- var registerBackendListeners = function(port) {
- port.on('SetRules', function(payload) {
-
- var rules = payload.rules;
-
- core.rules = payload;
- core.rules.rules = [];
-
- for(var i=0; i<rules.length; ++i) {
- var moduleStr =
- [ '(function(){'
- , 'var exports = {};'
- , rules[i].module
- , 'return exports;'
- , '})()'
- ].join('\n');
-
- core.rules.rules.push(eval(moduleStr));
- }
-
- if (null == core.rules) {
- debugger;
- }
-
- core.scheduleRules();
- registerDomListeners(document);
- });
- };
-
- registerBackendListeners(core.port);
-}());
-
diff --git a/contexts/data/fiveui/injected/fiveui-injected-ui.js b/contexts/data/fiveui/injected/fiveui-injected-ui.js
deleted file mode 100644
index 6831436..0000000
--- a/contexts/data/fiveui/injected/fiveui-injected-ui.js
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Module : injected/fiveui-injected-ui.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-(function(){
- /**
- * Storage namespace for in-browser logic
- */
- var core = {};
- core.port = obtainPort();
-
- core.ui = $('<div></div>').attr('id', 'uic-dialog');
-
- core.lockDepth = 0;
-
- core.lockMask = function() {
- core.lockDepth = core.lockDepth + 1;
- if(core.lockDepth == 1) {
- core.port.emit('MaskRules', null);
- }
- };
-
- core.unlockMask = function() {
- core.lockDepth = core.lockDepth - 1;
- if(core.lockDepth == 0) {
- core.port.emit('UnmaskRules', null);
- }
- };
-
- /**
- * Due to the lack of a confirmation continuation with the port api, this
- * function runs a continuation after 10ms of delivering the MaskRules
- * message, then waits another 10ms before delivering the UnmaskRules
- * message. The two delays seem to give a better chance that the
- * continuation runs within the masked context.
- */
- core.maskRules = function(body) {
- core.lockMask();
-
- setTimeout(function() {
- body();
- setTimeout(function() {
- core.unlockMask();
- }, 10);
- }, 10);
- };
-
- core.highlightProblem = function(elt) {
- core.maskRules(function() {
- elt.css('background-color', 'rgba(255,0,0,0.3)')
- .addClass('uic-problem');
- });
- };
-
- core.maskProblem = function(elt) {
- core.maskRules(function() {
- elt.css('background-color', '')
- .removeClass('uic-problem');
- });
- };
-
- core.renderStats = function (stats) {
- core.maskRules(function () {
- var statsDiv, statsDetail;
- statsDiv = $('#fiveui-stats');
- statsDiv.children().remove();
- statsDetail = $('<table class="fiveui-table"><tr><td class="fiveui-table-text">rules checked:</td><td class="fiveui-table-number">' + stats.numRules + '</td></tr>' +
- '<tr><td class="fiveui-table-text">elements checked:</td><td class="fiveui-table-number">' + stats.numElts + '</td></tr>' +
- '<tr><td class="fiveui-table-text">elapsed time (ms):</td><td class="fiveui-table-number">' + (stats.end - stats.start) + '</td></tr></table>');
- statsDiv.append(statsDetail);
- });
- };
-
- core.renderProblem = function(prob) {
- core.maskRules(function() {
- var probDiv = $('<div class="pr"></div>');
-
-
- /** Problem Controls **/
- var prControls = $('<div class="prControls"></div>');
- probDiv.append(prControls);
-
- var prSeverity = $('<div class="prSeverity"></div>');
- prControls.append(prSeverity);
-
- if (1 == prob.severity) {
- prSeverity.addClass('prSeverity-err');
- } else {
- prSeverity.addClass('prSeverity-warn');
- }
-
- var prExpand = $('<div class="prExpand prExpand-right"></div>');
- prControls.append(prExpand);
-
- /** Problem Content **/
- var prMessage = $('<div class="prMessage"></div>');
- probDiv.append(prMessage);
-
- var prTitle = $('<div class="prTitle">'+prob.name+'</div>');
- prMessage.append(prTitle);
-
- var prDetails = $('<div class="prDetails"></div>');
- prMessage.append(prDetails);
-
- var prDescr = $('<p>'+prob.descr+'</p>');
- prDetails.append(prDescr);
- prDetails.hide();
-
- $('#problemList').append(probDiv);
-
- prExpand.click(
- function() {
- var elt = $(this);
- if(elt.is('.prExpand-down')) {
- elt.removeClass('prExpand-down')
- .addClass('prExpand-right');
- prDetails.hide();
- core.maskProblem(fiveui.query('.' + prob.hash));
- } else {
- elt.addClass('prExpand-down')
- .removeClass('prExpand-right');
- prDetails.show();
- core.highlightProblem(fiveui.query('.' + prob.hash));
- }
-
- return false;
- });
- });
- };
-
- var dragStop = function(evt,e) {
- core.port.emit('Position', core.ui.parent().position());
- };
-
- var resizeStop = function(evt,e) {
- core.port.emit('Size', { width: core.ui.width(), height: core.ui.height() });
- };
-
- var beforeClose = function(evt,e) {
- core.port.emit('CloseUI');
- };
-
- var registerBackendListeners = function(port) {
-
- port.on('ShowUI', function(unused) {
- core.ui.dialog('open');
- });
-
-
- port.on('ShowProblem', function(problem) {
- core.renderProblem(problem);
- });
-
- port.on('ShowStats', function(stats) {
- core.renderStats(stats);
- });
-
- port.on('RestoreUI', function(state) {
- core.ui.append($('<div id="controls"></div>'));
-
- core.ui.append($('<div id="problemList"></div>'));
-
- var newDialog = core.ui.dialog({ title: 'FiveUI',
- dragStop: dragStop,
- resizeStop: resizeStop,
- beforeClose: beforeClose,
- position: [state.winState.x, state.winState.y],
- width: state.winState.width,
- height: state.winState.height,
- autoOpen: false,
- zIndex: 50000
- });
- newDialog.parent().attr('id', 'uic-top');
-
- $('#controls').append($('<div id="clearButton"></div>')
- .button({ label: 'clear' }));
-
- $('#clearButton').click(function() {
- $('#problemList').children().remove();
- port.emit('ClearProblems');
- core.renderStats(fiveui.stats.zero);
- core.maskProblem(fiveui.query('.uic-problem'));
- });
-
- ///////////////////////////////////////////
- // Add a button that causes a debuger break.
- //
- // handy for playing with Jquery on the dom.
- // Note: This only works in Google Chrome.
- $('#controls').append($('<div id="breakButton"></div>')
- .button({ label: 'break' }));
- $('#breakButton').click(function() {
- debugger; //
- }); //
- ////////////////////////////////////////////
-
- core.ui.append($('<div id="fiveui-stats"></div>'));
-
- if(!state.winState.closed) {
- core.ui.dialog('open');
- }
-
- $(state.problems).each(function(ix,prob) {
- core.renderProblem(prob);
- });
- core.renderStats(state.stats);
- });
- };
-
- registerBackendListeners(core.port);
-})();
diff --git a/contexts/data/fiveui/injected/injected.css b/contexts/data/fiveui/injected/injected.css
deleted file mode 100644
index 2f50058..0000000
--- a/contexts/data/fiveui/injected/injected.css
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Module : injected/injected.css
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.uic-problem {
- background-color: rgba(255, 0, 0, 0.3);
- border: 2px solid;
- border-color: red;
-}
-
-/* Reduce the JQuery UI spacing on the left of the dialog content. */
-#uic-dialog {
- padding-left: 3px;
- font-family: Courier;
-}
-
-#uic-top {
- font-family: Courier;
-}
-
-.ui-dialog .ui-dialog-content {
- /* overflow: hidden !important; */
- position: relative;
-}
-
-#breakButton, #clearButton {
- font-family: Courier;
-}
-
-/* stats area style */
-
-#fiveui-stats {
- font-family: Courier;
- font-size: 10px;
- background-color: #F0F0F0;
- border: 1px solid #DDDDDD;
- border-style: groove;
- padding: 3px;
- height: auto;
- width: 97%;
- margin-top: 0.5em;
- margin-bottom: 0.75em;
-}
-
-.fiveui-table-number {
- text-align: right;
- color: blue;
-}
-
-.fiveui-table-text {
- text-align: left;
- color: black;
- padding-right: 3px;
-}
-
-/* problem list style */
-
-#problemList {
- border-style: groove;
- background: white;
-
- /*
- position: absolute;
- top: 95px;
- bottom: 0px;
- */
-
- /* coarse estimate of width in most standard sizes */
- width: 97%;
-
- margin-top: 0.5em;
- margin-bottom: 0.75em;
-
- overflow-y: scroll;
-}
-
-.pr {
- border-top: 1px solid #ddd;
-}
-
-.pr:first-child {
- border-top: 0px;
-}
-
-.pr>.prControls {
- float: left;
- width: 2em;
-}
-
-.pr>div.prControls>div {
- padding: 0;
- margin: 0;
- width: 1em;
- height: 1em;
- float: left;
- background-size: 1em 1em;
- background-repeat:no-repeat;
-}
-
-.prExpand {
-}
-
-.prSeverity-err {
- background-image: url(../images/errorCircle.png);
-}
-
-.prSeverity-warn {
- background-image: url(../images/warningTriangle.png);
-}
-
-.prExpand-right {
- background-image: url(../images/right-arrow.png);
-}
-.prExpand-down {
- background-image: url(../images/down-arrow.png);
-}
-
-.prMessage {
- margin: 0;
- margin-left: 2em;
- padding: 0;
-}
-
-.prTitle {
- display: block;
- margin: 0px;
-}
-
-.prHead {
- border-bottom: 1px solid #ccc;
-}
-
-.prDetails {
-}
diff --git a/contexts/data/fiveui/injected/jquery-plugins.js b/contexts/data/fiveui/injected/jquery-plugins.js
deleted file mode 100644
index 0f13c2a..0000000
--- a/contexts/data/fiveui/injected/jquery-plugins.js
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Module : injected/jquery-plugins.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-if (typeof goog != 'undefined') {
- goog.provide('fiveui.jquery');
-}
-
-/**
- * This module provides several useful jQuery plugins related to checking and reporting
- * UI consistency issues.
- *
- * @namespace
- */
-fiveui.jquery = fiveui.jquery || {};
-
-
-/**
- * Wrapper for the :contains('text') selector
- *
- * @param {!String} text Text to select for
- * @returns {!Object} A modified jQuery object
- */
-fiveui.jquery.hasText = function (text) {
- return this.filter(":contains('" + text + "')")
-}
-
-/**
- * Color checker plugin: filters for elements whose CSS color property is
- * not in the given set.
- *
- * @description Note: This is a special case of fiveui.jquery.cssIsNot, i.e.
- * $(..).notColorSet(set) == $(..).cssIsNot("color", set, fiveui.color.colorToHex)
- * @see {fiveui.color.colorToHex}
- *
- * @param {String[]} cset A set of allowable color strings
- * @returns {!Object} A modified jQuery object
- */
-fiveui.jquery.notColorSet = function (cset) {
- var allowable = {};
- for (var i = 0; i < cset.length; i += 1) { allowable[cset[i]] = true; } // array -> object
- return this.filter(function (index) {
- var color = fiveui.color.colorToHex($(this).css("color")); // .css("color") returns rgb(...)
- return !(color in allowable);
- });
-}
-
-/**
- * General CSS propetry checker plugin
- *
- * @description This plugin filters for elements whose CSS property `prop` is not a member
- * of the given array `cset`. The values checked are transformed using the
- * optional given function `fn`. This may be used to normalize values that the
- * browser returns so they can be compared to values in `cset`.
- *
- * @param {String} prop CSS property selector
- * @param {String|String[]} set allowable values (either a string or an array of strings)
- * @param {function(String):String} [fn] Function to apply to return values of $(this).css(prop), fn defaults to the identity function.
- * @returns {Object} jQuery object
- */
-fiveui.jquery.cssIsNot = function (prop, set, fn) {
- var allowable = {};
- fn = fn || function (x) { return x; }; // default is Id
- if (typeof set === "string") {
- allowable[fn(set)] = true;
- }
- else { // assume `set` is an array of strings
- for (var i = 0; i < set.length; i += 1) { allowable[fn(set[i])] = true; } // array -> object
- }
- return this.filter(function (index) {
- var cssProp = fn($(this).css(prop));
- return !(cssProp in allowable);
- });
-}
-
-/**
- * Filter out elements that do not contain the attribute
- * href=`href`.
- *
- * @param {String} href the href to look for
- * @returns {Object} jQuery object
- */
-fiveui.jquery.linksTo = function (href) {
- return this.filter(function (index) {
- var addr = $(this).attr("href");
- return (addr == href);
- });
-}
-
-/**
- * Visually highlight elements in the jQuery object.
- *
- * @description This plugin is useful mostly in the process of writing
- * guidelines, for example the guideline developer can load a page,
- * click the "Break" button on the FiveUI window, enter the browser's
- * Javascript console, and run:
- *
- * @example > $5("p").hasText("foo").highlight();
- *
- * @param {String} [hint] Highlighted border color, defaults to "red"
- * @returns {!Object} A modified jQuery object
- */
-fiveui.jquery.highlight = function (hint) {
- hint = hint || "red"; // Default is "red"
- return this.css("background-color", "rgba(255, 0, 0, 0.3)")
- .css("border-style", "solid")
- .css("border-color", hint);
-}
-
-/**
- * Returns a list of css properties that element in the jQuery
- * object have.
- *
- * @description This plugin is useful for analysis of a given page when
- * writing guielines. For example if the guideline developer wants to
- * know what font sizes are used on a loaded page, they can run from the
- * Javascript console:
- *
- * @example > $5("*").propDist("font-size", true);
- *
- * @param {String} prop CSS property to be inspected
- * @param {boolean} [log] Boolean which enables console logging of the result; default is `false`.
- * @returns {Object} A frequence map { "property": frequency }
- */
-fiveui.jquery.propDist = function (prop, log) {
- var res = {};
- log = log || false;
- this.each(function (i, elt) {
- var p = $(elt).css(prop);
- if (p in res) {
- res[p] += 1;
- }
- else {
- res[p] = 1;
- }
- });
- if (log) {
- console.log("Property distribution:");
- for (var p in res) {
- console.log(" " + p + ": " + res[p]);
- }
- }
- return res;
-}
-
-/**
- * Register the plugins. This adds methods to the jQuery.fn namespace.
- */
-fiveui.jquery.init = function () {
- for (fn in fiveui.jquery) {
- f = fiveui.jquery[fn];
- if (jQuery.isFunction(f) && fn != "init") {
- jQuery.fn[fn] = fiveui.jquery[fn];
- }
- }
-}
-fiveui.jquery.init();
diff --git a/contexts/data/fiveui/injected/prelude.js b/contexts/data/fiveui/injected/prelude.js
deleted file mode 100644
index 3f3b4f5..0000000
--- a/contexts/data/fiveui/injected/prelude.js
+++ /dev/null
@@ -1,432 +0,0 @@
-/*
- * Module : injected/prelude.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * The FiveUI Prelude.
- *
- * @description
- * The prelude provides a collection of utilities to ease the
- * conversion from human-readable guideline documents (such as the Web
- * Accessibilty Guidelines, or Apple Human Interface Guidelines) to
- * executable Rules.
- *
- * @namespace
- */
-var fiveui = fiveui || {};
-
-(function() {
-
-/**
- * A global namespace for statistics collection.
- *
- * @namespace
- */
-fiveui.stats = fiveui.stats || {};
-/** @global */
-fiveui.stats.numElts = 0;
-/** @const */
-fiveui.stats.zero = { numRules: 0, start: 0, end: 0, numElts: 0 };
-
-/** DOM Traversal ************************************************************/
-
-/**
- * fiveui.query is a wrapper around the jQuery $() function.
- *
- * @description
- * fiveui.query recurses into iframes and frames, whereas $(...) stops
- * when it encounters internal frames.
- *
- * Generally, rules written for FiveUI will want to cover the entire
- * visible page, and as such, should use fiveui.query; however, $(...)
- * is available if recursing into frames is not necessary.
- *
- * @param {String} sel The jQuery selector string.
- * @param {Object} [context] The context to run the query within. This is often a DOM object/tree.
- * @returns {Object} A jQuery object, suitable for chaining.
- */
-fiveui.query = function (sel, context) {
- var ctx = context || document;
- var $results = jQuery(sel, ctx);
-
- jQuery('iframe, frame', ctx).each(
- function(idx, elt) {
- var $tempResults;
- if (elt.contentDocument) {
- try {
- $tempResults = fiveui.query(sel, elt.contentDocument);
- } catch (e) {
- console.log("encoutered a non-cooperative iframe/frame at " + $(elt).attr("src"));
- console.log(e.toString());
- $tempResults = [];
- }
-
- $results = $results.add($tempResults);
- }
- }
- );
-
- $filteredResults = $results.not('#uic-top *')
- .not('#uic-top')
- .filter(':visible');
-
- // update global stats
- fiveui.stats.numElts += $filteredResults.length;
-
- return $filteredResults;
-};
-
-/**
- * Provide a short alias for fiveui.query along the lines of the jQuery $ alias.
- *
- * @example $5("p").hasText("foo") -> jQuery object containing paragraph elements
- * containing the text "foo"
- * </pre></p>
- *
- * @const
- *
- */
-var $5 = fiveui.query;
-
-/** Utilities ****************************************************************/
-
-/**
- * Determine if a given value is a string or not.
- *
- * @param {*} [o] A value of some type that may or may not be defined.
- * @returns {!boolean} true if the object is a defined, non-null string, false
- * otherwise.
- */
-fiveui.isString = function(o) {
- return typeof o == 'string';
-};
-
-
-/**
- * String-specific utilities.
- *
- * @namespace
- */
-fiveui.string = {};
-
-/**
- * Non-destructively removes whitespace from the start and end of a
- * string.
- *
- * @param {String} [s] The string to trim of whitespace.
- * @returns {String} The input string, without leading or trailing
- * whitespace. Returns null if you gave it null.
- */
-fiveui.string.trim = function(s) {
- if (s) {
- return s.replace(/^\s+|\s+$/g,"");
- }
- return s;
-};
-
-/**
- * Tokenize a string on whitespace.
- *
- * @param {!String} s The string to tokenize.
- * @returns {String[]>} An array of substrings.
- */
-fiveui.string.tokens = function (s) {
- var posLength = function(ar) {
- return 1 <= ar.length;
- };
-
- return s.split(/\s/).filter(posLength);
-};
-
-
-/**
- * A simple heuristic check to see if a string is in Title Case.
- *
- * @description
- * This does not perform an exhaustive gramatical analysis, and as
- * such, it is prone to generating false-positives in some cases. In
- * particular, it only has a short 'white list' of articles,
- * conjections, and prepositions that are allowed to be in lower case.
- *
- * @param {!String} str The string to check.
- * @returns {!boolean} true if the string is in title case, false if
- * it is not.
- */
-fiveui.string.isTitleCase = function(str) {
- var exception = function(str) {
- var exceptions = [ 'a', 'an', 'the' // articles
- , 'and', 'but', 'for', 'not', 'or' // conjuctions
- , 'in', 'on' // short prepositions
- , 'to' ];
- return exceptions.indexOf(str.toLowerCase()) != -1;
- };
-
- if ( !fiveui.word.capitalized(str[0]) ) {
- return false;
- }
-
- var tokens = fiveui.string.tokens(str);
- for (var i=1; i < tokens.length; ++i) {
- if (!exception(tokens[i]) && !fiveui.word.capitalized(tokens[i])) {
- return false;
- }
- }
- return true;
-};
-
-/**
- * Utilities for word-specific processing.
- *
- * @description The fiveui.word namespace focuses on tools for working directly
- * with words in the sense of natural languages, rather than general
- * strings (as is the case for the fiveui.string namespace).
- *
- * @namespace
- */
-fiveui.word = {};
-
-/**
- * Check to see if a sting begins with a capital letter.
- *
- * @param {!String} word The string to check for capitalization.
- * @returns {!boolean}
- */
-fiveui.word.capitalized = function(word) {
- return fiveui.isString(word) && word.search(/^[A-Z]/, word) >= 0;
-};
-
-/**
- * Check to see if a sting consists entirely of capital letters.
- *
- * @param {!String} word The string to check for capitalization.
- * @returns {!boolean}
- */
-fiveui.word.allCaps = function(word) {
- return fiveui.isString(word)
- && word.search(/^\w/, word) >= 0
- && (word == word.toUpperCase());
-};
-
-
-/**
- * Utilities for dealing with color.
- *
- * @namespace
- */
-fiveui.color = {};
-
-/**
- * Color check compiler. It is recommended to use the jQuery plugin
- * fiveui.jquery.cssIsNot instead.
- *
- * @param {!String} selector The HTML element selector to check.
- * @param {String[]} colorSet An array of strings containing the HEX values of
- * colors in the desired color set.
- * @returns {!function()} A function which checks the rule
- * @see fiveui.jquery.cssIsNot
- */
-fiveui.color.colorCheck = function (selector, colorSet) {
- var allowable, i, fnStr, forEachFuncStr;
- allowable = {};
- for (i = 0; i < colorSet.length; i += 1) { allowable[colorSet[i]] = true; }
- forEachFuncStr = 'function (j, elt) {\n'
- + ' var allowable = ' + JSON.stringify(allowable) + ';\n'
- + ' var color = fiveui.color.colorToHex($(elt).css("color"));\n'
- + ' if (!(color in allowable)) {\n'
- + ' report("Disallowed color " + color + " in element matching " + ' + JSON.stringify(selector) + ', $(elt));\n'
- + ' }\n'
- + '}\n';
- fnStr = 'function () { fiveui.query("' + selector + '").each(' + forEachFuncStr + '); }';
- return eval('false||'+fnStr); // the `false||` trick is required for eval to parse a
- // function expression ?!?
-};
-
-/**
- * Covert rgb colors to hex and abreviated hex colors to their full 3 byte
- * form.
- *
- * In case there are parse errors during the conversion, i.e. color values
- * that are not understood, the input is returned unchanged.
- *
- * @param {!String} color The color string to convert. This should be either of the form rgb(...) or #...
- * @returns {!String} The color string in #XXXXXX form
- * @throws {ParseError} if the rgb color string cannot be parsed
- */
-fiveui.color.colorToHex = function(color) {
- var have, need;
- if (color.substr(0, 1) === '#') {
- if (color.length === 7) {
- return color;
- }
- else { // deal with #0 or #F7 cases
- var have = color.length - 1;
- var haveDigits = color.substr(1, color.length);
- var need = 6 - have;
- var reps = Math.ceil(need / have);
- var i, strColor;
- for (i = 0, stdColor = color; i < reps; i += 1) { stdColor += haveDigits; }
- return stdColor.substr(0, 7);
- }
- }
-
- var digits = /rgba?\((\d+), (\d+), (\d+)/.exec(color);
- if (!digits) {
- return color; // in case there is a parse error, we just
- // return the input unchanged
- }
-
- var red = parseInt(digits[1]);
- var green = parseInt(digits[2]);
- var blue = parseInt(digits[3]);
-
- var rgb = blue | (green << 8) | (red << 16);
- if (rgb === 0) {
- return '#000000'; // normalized form
- }
- else {
- return '#' + rgb.toString(16).toUpperCase();
- }
-};
-
-
-/**
- * Utilities for dealing with fonts.
- *
- * @namespace
- */
-fiveui.font = {};
-
-/**
- * Extracts the font-family, font-size (in px, as an int), and font-weight
- * from a jQuery object.
- *
- * @param {!Object} jElt A jQuery object to extract font info from
- * @returns {!Object} An object with properties: 'family', 'size', and 'weight'
- * @throws {ParseError} if the font size cannot be parsed
- */
-fiveui.font.getFont = function (jElt) {
- var res = {};
- var size = jElt.css('font-size');
- if(size.length > 0) {
- var psize = /(\d+)/.exec(size);
- if(!psize) {
- throw {
- name: 'ParseError',
- message: 'Could not parse font size: ' + jElt.css('font-size')
- };
- }
- else {
- res.size = psize
- }
- } else {
- res.size = '';
- }
- res.family = jElt.css('font-family');
- res.weight = jElt.css('font-weight').toString();
- // normalize reporting of the following two synonyms
- if (res.weight === '400') { res.weight = 'normal'; }
- if (res.weight === '700') { res.weight = 'bold'; }
- return res;
-};
-
-/**
- * Validate a font property object extracted using fiveui.font.getFont().
- *
- * @description The `allow` parameter should be an object whose top level properties are
- * (partial) font family names (e.g. 'Verdana'). For each font family name
- * there should be an object whose properties are font weights (e.g. 'bold'),
- * and for each font weight there should be an array of allowable sizes
- * (e.g. [10, 11, 12]).
- *
- * The `font` parameter should be an object containing 'family', 'weight', and
- * 'size' properties. These are returned by @see fiveui.font.getFont().
- *
- * @example > allow = { 'Verdana': { 'bold': [10, 12], 'normal': [10, 12]}};
- * > font = { family: 'Verdana Arial sans-serif', size: "10", weight: "normal" };
- * > fiveui.font.validate(allow, font) -> true
- *
- * @param {!Object} allow Object containing allowable font sets (see description and examples)
- * @param {!Object} font object to check
- * @param font.family A partial font family name (e.g. 'Verdana')
- * @param font.weight A font weight (e.g. 'bold')
- * @param font.size A font size string (e.g. "10")
- * @returns {!boolean}
- */
-fiveui.font.validate = function (allow, font) {
- var x;
- for (x in allow) { // loop over allowed font family keywords
- if (font.family.indexOf(x) !== -1) { break; }
- else { return false; }
- }
- return (font.weight in allow[x] && allow[x][font.weight].indexOf(parseInt(font.size)) != -1);
-};
-
-/**
- * Functions outside the fiveui namespace that can be called during rule
- * evaluation.
- */
-
-/**
- * <p>Report a problem to FiveUI.</p>
- *
- * @description
- * <p>report is used to indicate that a guideline has been violated.
- * Invocations should provide a short (1-line) string description of
- * the problem, as well as a reference to the element of the DOM that
- * violated the guideline.</p>
- *
- * <p>The second parameter is not strictly required, but we strongly
- * suggest providing a node if at all possible, as that is used to
- * visually highlight the problematic areas of the DOM at runtime.
- * Debugging a guideline violation becomes much more difficult without
- * the visual indicator.</p>
- *
- * @function
- * @param {!String} desc The description of the problem to report.
- * @param {?Node} node The node in the DOM that caused the problem.
- * @name report
- */
-
-/**
- * JSON.stringify is included here for extension and ruleset debugging
- * purposes. It is used by the jQuery pluggin jQuery.fn.log.
- */
-var JSON = JSON || {};
-JSON.stringify = JSON.stringify || function (obj) {
- var t = typeof (obj);
- if (t != "object" || obj === null) {
- // simple data type
- if (t == "string") obj = '"'+obj+'"';
- return String(obj);
- }
- else {
- // recurse array or object
- var n, v, json = [], arr = (obj && obj.constructor == Array);
- for (n in obj) {
- v = obj[n]; t = typeof(v);
- if (t == "string") v = '"'+v+'"';
- else if (t == "object" && v !== null) v = JSON.stringify(v);
- json.push((arr ? "" : '"' + n + '":') + String(v));
- }
- return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}");
- }
-};
-
-})();
diff --git a/contexts/data/fiveui/messenger.js b/contexts/data/fiveui/messenger.js
deleted file mode 100644
index fc1962c..0000000
--- a/contexts/data/fiveui/messenger.js
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Module : messenger.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var fiveui = fiveui || {};
-
-(function() {
-
-/**
- * @constructor
- * @param {{on: function(!string, function(*)), emit: function(!string, *)}}
- * channel The object containing on and emit.
- */
-fiveui.Messenger = function(channel) {
- this.callbacks = {};
- this.handlers = {};
-
- this.channel = channel;
- this.channel.on(fiveui.Messenger.type, _.bind(this._handler, this));
-};
-
-fiveui.Messenger.type = "fiveui_messaging_type";
-
-_.extend(fiveui.Messenger.prototype, {
-
- /**
- * @param {!string} type The message type to send.
- * @param {?Object} data The payload (which can be null).
- * @param {?function(?Object)} callback An optional callback to be
- * invoked in response.
- */
- send: function(type, data, callback){
- var id = null;
- if (callback) {
- id = this._newId();
- this.callbacks[id] = callback;
- }
-
- var payload = new fiveui.Messenger.Payload(false, type, data, id);
- this.channel.emit(fiveui.Messenger.type, payload);
- },
-
- /**
- * Register a handler for the specified message type.
- *
- * @param {!string} type The message type.
- * @param {!function(*)} callback The function to call when a message
- * of the specified type is received.
- */
- register: function(type, callback) {
- if(null == this.handlers[type]) {
- this.handlers[type] = [];
- }
- this.handlers[type].push(callback);
- },
-
- _handler: function(payload) {
- if (payload.isCallback && payload.id != null) {
- // this is a callback invocation, lookup the callback and invoke it:
- this.callbacks[payload.id](payload.data);
-
- // remove the callback:
- this._remove(payload.id);
- } else {
- // look up a handler and invoke it, passing in the response fn:
- var hs = this.handlers[payload.type];
- if (hs && hs.length > 0) {
-
- // this is a new incomming message.
- // create a response function:
- var respond = function(respData) {
- this.channel.emit(fiveui.Messenger.type,
- new fiveui.Messenger.Payload(true, payload.type, respData, payload.id));
- };
-
- // iterate over the handlers, invoking them with the response callback.
- _.each(hs, function(h) {
- h(payload.data, _.bind(respond, this));
- }, this);
- }
- }
- },
-
- /**
- * Remove a callback from the map of callbacks.
- *
- * @param {!number} callbackId The id of the callback to remove.
- */
- _remove: function(callbackId) {
- delete this.callbacks[callbackId];
- },
-
- /**
- * @return {!number} The next unique id for a callback.
- */
- _newId: function() {
- var list = Object.keys(this.callbacks);
- return fiveui.utils.getNewId(list);
- }
-
-});
-
-/**
- * @constructor
- * @param {!boolean} isCallback True if this is in response to a
- * message, false if this is requesting a callback.
- * @param {!string} type
- * @param {?Object} data
- * @param {!number} id Callback id to invoke, or in which this is a response.
- */
-fiveui.Messenger.Payload = function(isCallback, type, data, id) {
- this.isCallback = isCallback;
- this.type = type;
- this.id = id;
- this.__defineGetter__('data', function() {
- return JSON.parse(this.rawData);
- });
- this.__defineSetter__('data', function(obj){
- this.rawData = JSON.stringify(obj);
- });
- this.data = data;
-};
-
-})();
diff --git a/contexts/data/fiveui/options.css b/contexts/data/fiveui/options.css
deleted file mode 100644
index efe7d05..0000000
--- a/contexts/data/fiveui/options.css
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Module : options.css
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-html body, body {
- font-family: Arial, sans-serif;
- margin: 0;
- padding: 0;
-}
-
-#content {
- float: left;
-}
-
-div#icon {
- float: right;
- opacity: 0.25;
- background-image: url(images/fiveui-icon-128.png);
- background-repeat: no-repeat;
- background-position-x: 16px;
- background-position: 0px 16px;
- width: 128px;
- height: 160px;
- margin: 0;
- padding: 0;
- z-index: -1;
-}
-
-#navbar-container {
- background: -linear-gradient(left, #EAEEF3, #EAEEF3 97%, #D3D7DB);
- background: -moz-linear-gradient(left, #EAEEF3, #EAEEF3 97%, #D3D7DB);
- background: -webkit-linear-gradient(rgba(234, 238, 243, 0.2), #EAEEF3), -webkit-linear-gradient(left, #EAEEF3, #EAEEF3 97%, #D3D7DB);
- position: absolute;
- top: 0px;
- left: 0px;
- bottom: 0px;
- width: 20%;
- float: left;
-}
-
-#navbar-container>nav>div {
- cursor: pointer;
- border: 0px;
-}
-
-#navbar-content-title {
- font-size: 200%;
- font-weight: normal;
- color: #53637D;
- padding-right: 1em;
- padding-bottom: 0.5em;
- text-align: end;
- text-shadow: white 0 1px 2px;
-}
-
-nav {
- text-align: right;
-}
-
-nav div {
- padding-right: 0.5em;
- color: #426DC9;
- font-size: 14px;
- height: 16px;
- padding-bottom: 7px;
- padding-left: 0px;
- padding-right: 24px;
- padding-top: 7px;
- text-align: end;
- text-shadow: white 0px 1px 1px;
-}
-
-nav .selected {
- background: -linear-gradient(left, #BBCEE9, #BBCEE9 97%, #AABEDC);
- background: -moz-linear-gradient(left, #BBCEE9, #BBCEE9 97%, #AABEDC);
- background: -webkit-linear-gradient(left, #BBCEE9, #BBCEE9 97%, #AABEDC);
- border-bottom: 1px solid #8FAAD9;
- border-top: 1px solid #8FAAD9;
- color: black;
- text-shadow: #BBCEE9 0 1px 1px;
-}
-
-#content>section .selected {
-}
-
-#content>section {
- position: absolute;
- left: 20%;
- width: 50em;
- margin-left: 2em;
-}
-
-#content > section > section > h3 {
- display: table-cell;
- width: 130px;
- padding-right: 10px;
- padding-top: 17px;
-}
-
-#content > section > section > h3 + div {
- padding-bottom: 20px;
- display: table-cell;
-}
-
-div.title {
- font-size: 200%;
- border-bottom: 1px solid #EEEEEE;
-}
-
-.displayList {
- float: left;
- width: 50%;
-}
-
-#upDownGroup button {
- display: block
-}
-
-#upDownGroup {
- margin-top: auto;
- margin-bottom: auto;
- float: left;
-}
-
-.buttons {
- display: inline;
-}
diff --git a/contexts/data/fiveui/options.html b/contexts/data/fiveui/options.html
deleted file mode 100644
index 8994a69..0000000
--- a/contexts/data/fiveui/options.html
+++ /dev/null
@@ -1,88 +0,0 @@
-
-<!--
- * Module : options.html
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-<!DOCTYPE html>
-<html>
- <head>
- <meta charset="utf-8" />
- <title id="title">Five UI</title>
-
- <link id="favicon" rel="icon" href="images/fiveui-icon-16.png" />
- <link rel="stylesheet" href="options.css" />
- <link rel="stylesheet" href="entry.css" />
- <script src="../lib/jquery/jquery-1.8.3.js"></script>
- <script src="../underscore.js"></script>
- <script src="../backbone.js"></script>
- <script src="../target/chrome-options.js"></script>
- <script src="ffcheck.js"></script>
- </head>
-
- <body>
- <div id="icon"></div>
-
- <div id="navbar-container">
- <div id="navbar-content-title">Settings</div>
- <nav>
- <div id="url-defaults">URL Patterns</div>
- <div id="rule-sets">Rule Sets</div>
- <div id="basics">Basics</div>
- </nav>
- </div>
-
- <div id="content">
- <section id="tab-url-defaults">
- <div class="title">URL Patterns</div>
- <section>
- <ul id="urlPatEntries" class="entries"></ul>
- <div>
- <button id="addUrlPat">Add</button>
- </div>
- </section>
- </section>
-
- <section id="tab-rule-sets">
- <div class="title">Rule Sets</div>
- <section>
- <ul id="ruleSetEntries" class="entries"></ul>
- <div>
- <button id="addRsButton">Add</button>
- </div>
- </section>
- </section>
-
- <section id="tab-basics">
- <div class="title">Basics</div>
- <section>
- <h3>Window</h3>
- <div>
- <div class="checkbox">
- <label>
- <input type="checkbox" id="windowDisplayDefault"/>
- <span>Open the FiveUI Window as soon as a url is matched.</span>
- </label>
- </div>
- </div>
- </section>
- </section>
- </div>
-
- </body>
-</html>
diff --git a/contexts/data/fiveui/options.js b/contexts/data/fiveui/options.js
deleted file mode 100644
index 2b29f8d..0000000
--- a/contexts/data/fiveui/options.js
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Module : options.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var fiveui = fiveui || {};
-
-(function() {
-
-
-/*****************************************************************
- *
- * Misc. utility functions
- *
- ****************************************************************/
-
-var setClickHandler = function(sel, fn, scope) {
- var boundFn = fn;
- if (scope) {
- boundFn = _.bind(fn, scope);
- }
-
- sel.on('click', boundFn)
-};
-
-/**
- * @param {!string} selectEltId The id of the select element to
- * search for selected items.
- * @return {!Array.<!number>} An array of 'value' entries from the
- * selected elements. This may be empty, but it will not be null.
- */
-var findSelectedIds = function(elt) {
- var opts = elt.find('option:checked');
- return _.map(opts, function(o) { return o.value; });
-};
-
-
-fiveui.options = fiveui.options || {};
-
-/**
- * @param {{on: function(!string, function(*)), emit: function(!string, *)}} port
- */
-fiveui.options.init = function(port) {
-
- var msg = new fiveui.Messenger(port);
- var update = new fiveui.UpdateManager(msg);
-
- ruleSets = new fiveui.RuleSets([], { url: msg });
- urlPats = new fiveui.UrlPats([], { url: msg });
-
-
- /** UrlPat list entries ****************************************************/
-
- var urlPatEntries = jQuery('#urlPatEntries');
- var addUrlPat = jQuery('#addUrlPat');
-
- addUrlPat.prop('disabled', true);
-
- addUrlPat.on('click', function() {
- urlPats.add(new fiveui.UrlPatModel({}, { url : msg }));
- });
-
- // when a new rule set is sync'd, make sure that the add url pattern button is
- // enabled.
- ruleSets.on('sync', function() {
- if(ruleSets.length > 0) {
- addUrlPat.prop('disabled', false);
- }
- });
-
- // when a rule set is destroyed, and the collection is now empty, disable the
- // add url pattern button.
- ruleSets.on('destroy', function(model,col) {
- if(col.length <= 0) {
- addUrlPat.prop('disabled', true);
- }
- });
-
- // handle new url patterns being added to the collection.
- urlPats.on('add', function(model) {
- var view = new fiveui.UrlPatEntry({
- model: model,
- rules: new fiveui.RulesView({ model: ruleSets })
- });
- urlPatEntries.append(view.$el);
-
- if(model.isNew()) {
- view.edit();
- } else {
- view.render();
- }
- });
-
-
- /** RuleSet list entries ***************************************************/
-
- var ruleSetEntries = jQuery('#ruleSetEntries');
-
- // handle clicks to the 'add' button on the rule sets page
- jQuery('#addRsButton').on('click', function() {
- ruleSets.add(new fiveui.RuleSetModel({}, { url : msg }));
- });
-
- // render a ruleset added to the collection
- ruleSets.on('add', function(model) {
- var entry = new fiveui.RuleSetEntry({ model: model })
- ruleSetEntries.append(entry.$el);
-
- if(model.isNew()) {
- entry.edit();
- } else {
- addUrlPat.prop('disabled', false);
- entry.render();
- }
- });
-
-
- /** Basics *****************************************************************/
-
- var windowDisplayDefault = jQuery('#windowDisplayDefault');
-
- windowDisplayDefault.on('change', function() {
- msg.send('setDisplayDefault', windowDisplayDefault.prop('checked'))
- });
-
-
- /** Tab Management *********************************************************/
-
- /**
- * Select a tab header by Element reference.
- *
- * @param {!Element} clicked The navigation element to focus.
- * @return {void}
- */
- var selectNav = function(clicked) {
- var nav = clicked.parent();
-
- nav.find('div.selected', nav).removeClass('selected');
-
- jQuery('div.editorPane').hide();
-
- clicked.addClass('selected');
- };
-
- /**
- * Focus a tab, by Element reference.
- *
- * @param {!Element} el The tab element to focus.
- * @return {void}
- */
- var selectSection = function(el) {
- var cont = el.parent();
-
- // hide all sections
- cont.find('>section').removeClass('selected').hide();
-
- // display this section
- el.addClass('selected').show();
- };
-
- /**
- * A combination of selectNav and selectSection that will first lookup the
- * elements associated with a tab, then return a new function that when
- * called, will focus both the navigation element, and the tab it controls.
- *
- * @param {!string} id The id of the tab to focus.
- * @return {function()}
- */
- var select = function(id) {
- var sel = jQuery(id);
- return function() {
- selectNav(jQuery(this));
- selectSection(sel);
- };
- };
-
- // listen to click events on navigation elements
- setClickHandler(jQuery('#url-defaults'), select('#tab-url-defaults'));
- setClickHandler(jQuery('#rule-sets'), select('#tab-rule-sets'));
- setClickHandler(jQuery('#basics'), select('#tab-basics'));
-
- // select the url patterns tab by default
- selectNav(jQuery('#url-defaults'));
- selectSection(jQuery('#tab-url-defaults'));
-
-
- /** Pre-populate UI elements ***********************************************/
-
- msg.send('getDisplayDefault', null, function(def) {
- jQuery('#windowDisplayDefault').prop('checked', def);
- });
-
- // pre-populate the rule set and url pattern lists
- ruleSets.fetch({
- success:function() {
- urlPats.fetch();
- }
- });
-};
-
-})();
diff --git a/contexts/data/fiveui/rules.js b/contexts/data/fiveui/rules.js
deleted file mode 100644
index 68d821d..0000000
--- a/contexts/data/fiveui/rules.js
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Module : rules.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var fiveui = fiveui || {};
-
-(function() {
-
-/**
- * @constructor
- * @param {!string} module A Javascript module that defines the rule.
- */
-fiveui.Rule = function(module) {
- this.module = module;
-};
-
-fiveui.Rule.defaults = function(obj) {
- return _.defaults(obj, {
- module: '',
- });
-};
-
-/**
- * Create a Rule from a JSON object.
- *
- * @param {!Object} obj The object to take settings from.
- * @return {!fiveui.Rule} A populated Rule object.
- */
-fiveui.Rule.fromJSON = function(obj) {
- return new fiveui.Rule(obj.module);
-};
-
-/**
- * @constructor
- * @param {!number} id The unique RuleSet identifier.
- * @param {!string} name A human-readable name for this RuleSet.
- * @param {!string} desc A human-readable description of the Rule Set.
- * @param {!string} source The url where the manifest can be retrieved
- * @param {!Array.<fiveui.Rule>} rules An Array of Rules.
- * @param {?Array.<string>} deps Dependencies that this RuleSet requires.
- */
-fiveui.RuleSet = function(id, name, desc, source, rules, deps) {
- this.id = id;
- this.name = name;
- this.description = desc;
- this.source = source;
- this.rules = rules || [];
- this.dependencies = deps || [];
-};
-
-/**
- * Create a Rule Setfrom a JSON object.
- *
- * @param {!number} id A unique id for the rehydrated Rule.
- * @param {!Object} obj The object to take settings from.
- * @return {!fiveui.RuleSet} A populated RuleSet object.
- */
-fiveui.RuleSet.fromJSON = function(id, obj) {
- var rules = (/** @type {!Array.<!fiveui.Rule>} */
- _.map(obj.rules, fiveui.Rule.fromJSON));
-
- return new fiveui.RuleSet(id, obj.name, obj.description, obj.source,
- rules, obj.dependencies);
-};
-
-
-fiveui.RuleSet.defaults = function(obj) {
- return _.defaults(obj, {
- name: '',
- description: '',
- rules: [],
- dependencies: []
- });
-};
-
-
-/**
- * Options is an object that can contain a success and error continuation.
- */
-fiveui.RuleSet.load = function(manifest_url, options) {
-
- _.defaults(options, {
- success: function() {},
- error: function() { throw "failed when loading url"; }
- });
-
- var match = manifest_url.match(/\/[^\/]*$/);
-
- if(match) {
- var base_url = manifest_url.substring(0,match.index);
-
- // iterate over rules, retrieving the
- var loadRules = function(manifest, rules) {
-
- if(rules.length == 0) {
- options.success(manifest);
- } else {
-
- // XXX there's likely problems here, how should we make sure that the
- // url is what we expect?
- var rule_file = fiveui.Rule.defaults(rules.pop());
- var rule_url = base_url + '/' + rule_file;
-
- fiveui.ajax.get(rule_url, {
-
- success: function(text) {
- manifest.rules.push(new fiveui.Rule(text));
- loadRules(manifest, rules);
- },
-
- error: options.error
- });
-
- }
- };
-
- // fetch the manifest, and load its rules
- fiveui.ajax.get(manifest_url, {
-
- success: function(text) {
- try {
- var manifest = JSON.parse(fiveui.utils.filterJSON(text,'json'));
-
- } catch(e) {
- // XXX incoming error continuation is empty
- // (and we may have syntax error details in e)
- options.error();
- return;
- }
-
- fiveui.RuleSet.defaults(manifest);
-
- var rules = manifest.rules;
- manifest.rules = [];
- loadRules(manifest, rules);
- },
-
- error: options.error,
- });
-
-
- } else {
- options.error("unable to parse manifest url");
- }
-
-};
-
-
-/*******************************************************************************
- * Models for RuleSet
- ******************************************************************************/
-
-/**
- * The model for an single set of rules.
- */
-fiveui.RuleSetModel = Backbone.Model.extend({
-
- defaults: {
- id: null,
- name: '',
- description: '',
- source: '',
- rules: [],
- dependencies: [],
- },
-
- sync: function(method, model, options) {
-
- _.defaults(options, {
- success:function() {},
- error: function() {}
- });
-
- var msg = this.url;
- var id = model.get('id');
- var source = model.get('source');
-
- switch(method) {
-
- case 'update':
- case 'create':
- var rsMethod = method == 'update' ? 'updateRuleSet' : 'addRuleSet';
-
- msg.send('loadRuleSet', source, function(obj) {
- if(obj) {
- obj.id = id;
- obj.source = source;
-
- msg.send(rsMethod, obj, options.success);
- } else {
- options.error('failed to load manifest');
- }
- });
- break;
-
- case 'delete':
- msg.send('remRuleSet', id, function(obj) {
- if(obj.removed) {
- options.success();
- } else {
- options.error();
- }
- });
- break;
-
- case 'read':
- msg.send('getRuleSet', id, function(rs) {
- model.set({
- title: rs.name,
- descr: rs.description,
- source: rs.source,
- });
- });
- break;
-
- default:
- break;
- }
- }
-
-}, {
-
- /**
- * Generate a RuleSetModel from a RuleSet
- */
- fromRuleSet: function(ruleSet,msg) {
- return new fiveui.RuleSetModel({
- id: ruleSet.id,
- name: ruleSet.name,
- description: ruleSet.description,
- rules: ruleSet.rules,
- dependencies:ruleSet.dependencies,
- source: ruleSet.source,
- }, { url : msg });
- },
-
-});
-
-
-/**
- * The model for a collection of rule sets
- */
-fiveui.RuleSets = Backbone.Collection.extend({
-
- model: fiveui.RuleSetModel,
-
- sync: function(method, collection, options) {
- _.defaults(options, {
- success:function() {},
- error:function() {}
- });
-
- var self = this;
- var msg = this.url;
-
- switch(method) {
-
- case 'read':
- msg.send('getRuleSets', null, function(ruleSets) {
- options.success(_.map(ruleSets, function(rs) {
- return fiveui.RuleSetModel.fromRuleSet(rs, msg);
- }));
- });
- break;
-
- }
- }
-
-});
-
-
-})();
diff --git a/contexts/data/fiveui/selenium/selenium-injected-compute.js b/contexts/data/fiveui/selenium/selenium-injected-compute.js
deleted file mode 100644
index d0327b3..0000000
--- a/contexts/data/fiveui/selenium/selenium-injected-compute.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Module : selenium/selenium-injected-compute.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Not Portable (Selenium-specific)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Init FiveUI, if necessary:
-if (typeof fiveui == 'undefined') {
- fiveui = {};
-}
-
-/**
- * @return {{on: function(!string, function(*)), emit: function(!string, *)}}
- */
-var obtainComputePort = function() {
- fiveui.selPort = new fiveui.SeleniumPort();
- return fiveui.selPort;
-};
-
-/**
- * @constructor
- */
-fiveui.SeleniumPort = function() {
- this._events = {};
- this._messages = [];
-};
-
-/**
- * Listen to incoming messages.
- *
- * @param {!string} evt The event to listen for.
- * @param {!function(*)} cb The callback to invoke.
- * @return {void}
- */
-fiveui.SeleniumPort.prototype.on = function(evt, cb) {
- this._events[evt] = cb;
-};
-
-/**
- * Send a message to the background.
- *
- * @param {!string} evt The event to fire.
- * @param {?Object} obj The data to associate with the event.
- * @return {void}
- */
-fiveui.SeleniumPort.prototype.emit = function(evt, obj) {
- this._messages.push({ type: evt, payload: obj });
-};
-
-/**
- * Send a message to the injected script.
- *
- * @param {!string} evt The event to fire.
- * @param {?Object} obj The data to associate with the event.
- */
-fiveui.SeleniumPort.prototype.send = function(evt, obj) {
- if (this._events[evt]) {
- this._events[evt](obj);
- }
-};
-
-/**
- * Check to see if any messages have been generated.
- *
- * @param {[String]} type Message type to filter for (default: no filter)
- * @return {!Array.<{string, Object}>}
- */
-fiveui.SeleniumPort.prototype.query = function (type) {
- var msgs = [];
- var i;
-
- if (!type) {
- msgs = this._messages;
- }
- else {
- for (i=0; i < this._messages.length; i += 1) {
- console.log(this._messages);
- if (this._messages[i].type === type) {
- msgs.push(this._messages[i]);
- }
- }
- }
-
- // flush the read messages:
- this._messages = [];
-
- // return the new messages to the backend:
- return msgs;
-};
diff --git a/contexts/data/fiveui/set.js b/contexts/data/fiveui/set.js
deleted file mode 100644
index 7015a3e..0000000
--- a/contexts/data/fiveui/set.js
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-(function() {
-
-Set = function() {
- this.elems = {};
-};
-
-_.extend(Set.prototype, {
-
- add: function(obj) {
- var hash = this._getHash(obj);
- if(this.elems[hash] == undefined) {
- this.elems[hash] = obj;
- }
- },
-
- remove: function(obj) {
- var hash = this._getHash(obj);
- if(this.elems[hash]) {
- delete this.elems[hash];
- }
- },
-
- member: function(obj) {
- var hash = this._getHash(obj);
- return !!this.elems[hash];
- },
-
- contains: function(obj) {
- return this.member(obj);
- },
-
- size: function () {
- return _.size(this.elems);
- },
-
- isEmpty: function() {
- return this.size() == 0;
- },
-
- each: function(k, cxt) {
- _.each(this.elems, k, cxt);
- },
-
- _getHash: function(obj) {
- var str = obj.toString();
-
- // the same hash function that java uses for String.hashCode
- return _.reduce(str, function(hash, c) {
- hash = ((hash << 5) - hash) + c.charCodeAt();
- return hash & hash;
- }, 0);
- }
-
-});
-
-})();
diff --git a/contexts/data/fiveui/settings.js b/contexts/data/fiveui/settings.js
deleted file mode 100644
index c284db8..0000000
--- a/contexts/data/fiveui/settings.js
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * Module : settings.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var fiveui = fiveui || {};
-
-(function() {
-
-/**
- * Create a new instance of the Settings object
- *
- * @constructor
- * @param {!Storage} store The Storage instance to use.
- */
-fiveui.Settings = function(store) {
- this.store = store;
-};
-
-_.extend(fiveui.Settings.prototype, {
-
- /**
- * Retrieve an object associated with the key.
- *
- * @param {!string} key The key to look up.
- * @return {?Object} The returned JavaScript object.
- */
- get: function(key) {
- var value = this.store.getItem(key);
- if (value == null) {
- return null;
- } else {
- return JSON.parse(value);
- }
- },
-
- /**
- * Store an object with the given key.
- *
- * @param {string} key the key.
- * @param {Object} value the value.
- * @return {void}
- */
- set: function(key, value) {
- this.store.setItem(key, JSON.stringify(value));
- },
-
- /**
- * @param {string} key The local storage entry to remove.
- * @return {void}
- */
- remove: function(key) {
- this.store.removeItem(key);
- },
-
- /**
- * Set the display default.
- *
- * @param {!boolean} def Whether or not to display the FiveUI Window
- * when problems are reported.
- */
- setDisplayDefault: function(def) {
- this.set('displayDefault', def);
- },
-
- /**
- * Get the display default.
- *
- * @return {!boolean} true to show the window as soon as problems are
- * reported, false otherwise.
- */
- getDisplayDefault: function() {
- var def = this.get('displayDefault');
-
- // double negation to normalize funny things like null
- return !!def;
- },
-
- /**
- * Add a mapping from url patterns to RuleSets (via rule set ids)
- *
- * @param {!string} url_pat A regular expression (actually, a glob) to match URLs against.
- * @param {!number} rule_id The id of the RuleSet to use with any matching URL.
- * @return {!number} The id of the new url pattern.
- */
- addUrl: function(url_pat, rule_id) {
- var pats = this.getUrls();
-
- var new_id = fiveui.utils.getNewId(pats);
-
- this.updateUrl(new_id, url_pat, rule_id);
-
- // add it to the patterns list
- pats.push(new_id);
- this.set('urls', pats);
-
- return new_id;
- },
-
- updateUrl: function(id, url_pat, rule_id) {
- this.set('urls.' + id, new fiveui.UrlPat(id, url_pat, rule_id));
- return id;
- },
-
- /**
- * Retrieve the list of url patterns.
- *
- * @return {Array.<number>} An ordered list of the currently active
- * url patterns.
- */
- getUrls: function() {
- return (/** @type {Array.<number>} */ this.get('urls')) || [];
- },
-
- /**
- * Retrieve a specific url pattern.
- *
- * @param {!number} url_id The id of the url pattern to retrieve.
- * @return {?fiveui.UrlPat} The matching UrlPat or null,
- * if no pattern exists for url_id.
- */
- getUrlPat: function(url_id) {
- return /** @type {?fiveui.UrlPat} */ this.getById(url_id, 'urls', fiveui.UrlPat.fromJSON);
- },
-
- /**
- * Remove a UrlPat from the persistent storage.
- *
- * @param {!number} pat_id The id of the UrlPat to remove.
- * @return {void}
- */
- remUrlPat: function(pat_id) {
- this.remById(pat_id, 'urls');
- },
-
- /**
- * @param {!string} url A url to compare against the list of ordered
- * url patterns in local storage.
- * @return {?fiveui.UrlPat} The matching pattern, or null, if no
- * mapping was found.
- */
- checkUrl: function(url) {
- var pats = this.getUrls();
-
- // check for a possible match
- for (var i = 0; i < pats.length; ++i) {
- var pat = this.getUrlPat(pats[i]);
- if (pat.match(url)) {
- return pat;
- }
- }
-
- return null;
- },
-
- /**
- * Retrieve the list of rule sets.
- *
- * @return {!Array.<number>} An ordered list of the configured rule sets.
- */
- getRuleSets: function() {
- return (/** @type {!Array.<number>} */ this.get('ruleSet')) || [];
- },
-
-
- /**
- * @param {!Object} ruleSet The new rule set, as an anonymous JSON object.
- * @return {!fiveui.RuleSet} The new RuleSet object.
- */
- addRuleSet: function(ruleSet) {
- var ids = this.getRuleSets();
- var id = fiveui.utils.getNewId(ids);
-
- var newRS = this.updateRuleSet(id, ruleSet);
- ids.push(id);
- this.set('ruleSet', ids);
-
- return newRS;
- },
-
- /**
- * Change a rule set without generating a new id.
- *
- * @param {!number} ruleSetId The id of the ruleset that is being modified.
- * @param {!Object} ruleSet The rule set, as an anonymous JSON object.
- * @return {!fiveui.RuleSet} The new RuleSet object.
- */
- updateRuleSet: function(ruleSetId, ruleSet) {
- var newRS = fiveui.RuleSet.fromJSON(ruleSetId, ruleSet);
- this.set('ruleSet.'+ruleSetId, newRS);
- return newRS;
- },
-
- /**
- * @param {!number} id The id of the RuleSet to retrieve.
- * @return {?fiveui.RuleSet} The RuleSet, or null, if no RuleSet was found.
- */
- getRuleSet: function(id) {
- return /** @type {?fiveui.RuleSet} */ this.getById(id, 'ruleSet', fiveui.RuleSet.fromJSON);
- },
-
- /**
- * @param {!number} id The id of the rule set to remove.
- * @return {!Array.<fiveui.UrlPat>} null if the remove succeeded, otherwise,
- * returns the list of UrlPats that use this
- * rule set, if any.
- */
- remRuleSet: function(id) {
- var matches = _.map(this.getRuleSetUrlPats(id), function(id) {
- return this.getUrlPat(id);
- }, this);
-
- if (0 == matches.length) {
- this.remById(id, 'ruleSet');
- }
-
- return matches;
- },
-
- /**
- * @param {!number} ruleSetId The rule set to retrieve url patterns for.
- * @return {Array.<number>} Url pattern ids associated with this rule set.
- */
- getRuleSetUrlPats: function(ruleSetId) {
- var urls = this.getUrls();
- var patIds = [];
-
- _.each(urls, function(patId) {
- var pat = this.getUrlPat(patId);
- if(pat.rule_id == ruleSetId) {
- patIds.push(patId);
- }
- }, this);
-
- return patIds;
- },
-
- /**
- * @param {!number} id The nuber of the element to retrieve.
- * @param {!string} listName The name of the portion of the localstorage hierarchy to search for id.
- * @param {!function(number, !Object): *} fromJSON A deserialization function.
- *
- * @return {*} Either null, or the result of fromJSON.
- */
- getById: function(id, listName, fromJSON) {
- var obj = this.get(listName + '.' + id);
- if (!obj) {
- return null;
- }
-
- return fromJSON(id, obj);
- },
-
- /**
- * @param {!number} id The nuber of the element to retrieve.
- * @param {!string} listName The name of the portion of the
- * localstorage hierarchy to search for id.
- */
- remById: function(id, listName) {
- // remove it from the list of ids:
- var ids = this.get(listName) || [];
-
- for (var i = 0; i < ids.length; ++i) {
- if (ids[i] == id) {
- ids.splice(i, 1);
- this.set(listName, ids);
- this.remove(listName + '.' + id);
- break;
- }
- }
- }
-});
-
-
-/**
- * @param {!fiveui.Chan} chan
- * @param {!fiveui.Settings} settings
- * @return {void}
- */
-fiveui.Settings.manager = function(chan, settings) {
-
- var msg = new fiveui.Messenger(chan);
-
- msg.register('addRuleSet', function(ruleSet,respond){
- var newRS = settings.addRuleSet(ruleSet);
- respond(newRS);
- });
-
- msg.register('updateRuleSet', function(updatedRS,respond){
- var newRS = settings.updateRuleSet(updatedRS.id, updatedRS);
- respond(newRS);
- });
-
- msg.register('remRuleSet', function(ruleSetId, respond) {
- var pats = settings.remRuleSet(ruleSetId);
- respond({
- id: ruleSetId,
- pats: pats,
- removed: pats.length == 0
- });
- });
-
- msg.register('getRuleSetUrlPats', function(ruleSetId, respond) {
- var pats = settings.getUrls();
- var patIds = [];
-
- _.each(pats, function(patId) {
- var pat = settings.getUrlPat(patId);
- if(pat.rule_id == ruleSetId) {
- patIds.push(patId);
- }
- });
-
- respond(patIds);
- });
-
- // Retrieve the manifest, and return the object to the caller. Invokes the
- // caller with `null` when the manifest fails to load.
- msg.register('loadRuleSet', function(url, respond) {
- fiveui.RuleSet.load(url, {
- success:respond,
-
- error:function() {
- respond(null);
- },
- });
- });
-
- msg.register('getRuleSet', function(ruleSetId, respond){
- respond(settings.getRuleSet(ruleSetId));
- });
-
- msg.register('getRuleSets', function(unused, respond) {
- var ruleSets = _.map(settings.getRuleSets(),
- _.bind(settings.getRuleSet, settings));
- respond(ruleSets);
- });
-
- msg.register('getUrlPats', function(unused, respond){
- respond(_.map(settings.getUrls(), _.bind(settings.getUrlPat, settings)));
- });
-
- msg.register('addUrlPat', function(url, respond){
- var urlId = settings.addUrl(url.regex, url.rule_id);
- respond(settings.getUrlPat(urlId));
- });
-
- msg.register('updateUrlPat', function(pat, respond) {
- var obj = settings.getUrlPat(pat.id);
- settings.updateUrl(pat.id, pat.regex, pat.rule_id);
- respond(pat);
- });
-
- msg.register('getUrlPat', function(urlPatId, respond){
- respond(settings.getUrlPat(urlPatId));
- });
-
- msg.register('remUrlPat', function(urlPatId, respond){
- settings.remUrlPat(urlPatId);
- respond(true);
- });
-
- msg.register('setDisplayDefault', function(def) {
- settings.setDisplayDefault(def);
- });
-
- msg.register('getDisplayDefault', function(ignored, respond) {
- respond(settings.getDisplayDefault());
- });
-
-};
-
-})();
diff --git a/contexts/data/fiveui/state.js b/contexts/data/fiveui/state.js
deleted file mode 100644
index 226a439..0000000
--- a/contexts/data/fiveui/state.js
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Module : state.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var fiveui = fiveui || {};
-
-(function() {
-
-/**
- * @constructor
- * @param {!number} x The x-offset of the embedded dialog.
- * @param {!number} y The y-offset the dialog.
- * @param {!number} width The width of the dalog.
- * @param {!number} height The width of the dalog.
- * @param {!boolean} closed True if the window is closed, false if it is open.
- */
-fiveui.WinState = function(x, y, width, height, closed) {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- this.closed = closed;
-};
-
-/**
- * @constructor
- * @param {string} name The name of the rule that this problem represents.
- * @param {string} descr Short description of the problem.
- * @param {string} url The url that the problem occurred at.
- * @param {number} severity The severity of the problem
- */
-fiveui.Problem = function(name, descr, url, severity, hash) {
- this.name = name || '';
- this.descr = descr || '';
- this.url = url || '';
- this.severity = severity || 0;
- this.hash = hash;
-};
-
-/**
- * @param {!Object} obj The JSON object to use as a template for a problem.
- * @return {!fiveui.Problem} The problem that the object represents.
- */
-fiveui.Problem.fromJSON = function(obj) {
- return new fiveui.Problem(obj.name, obj.descr, obj.url, obj.severity, obj.hash);
-};
-
-/**
- * @constructor
- * @param {fiveui.WinState} winState The location of the FiveUI windown in
- * the injected page. Null if the window
- * is hidden.
- * @param {fiveui.ChromePort} uiPort The port used to communicate with
- * the corresponding tab.
- */
-fiveui.TabState = function(tabId, winState, uiPort) {
- this.tabId = tabId;
- this.winState = winState;
- this.uiPort = uiPort;
- this.computePorts = [];
- this.problems = [];
- this.seenProblems = new Set();
- this.stats = {};
-};
-
-_.extend(fiveui.TabState.prototype, {
-
- addProblem: function(prob) {
- if(!this.seenProblems.contains(prob.hash)) {
- this.problems.push(prob);
- this.seenProblems.add(prob.hash);
- return true;
- }
- else {
- return false;
- }
- },
-
- addStats: function (stats) {
- this.stats = stats;
- return true;
- },
-
- clearProblems: function() {
- this.problems = [];
- this.seenProblems = new Set();
- },
-
- clearStats: function() {
- for (var p in fiveui.stats.zero) { this.stats[p] = fiveui.stats.zero[p]; }
- },
-
- /*
- * Returns a copy of only the attributes in a TabState that are needed for
- * interpage communication.
- */
- toEmit: function() {
- return { winState: this.winState, problems: this.problems, stats: this.stats };
- }
-
-});
-
-/**
- * @constructor
- * @param {!fiveui.Settings} settings The settings object to obtain
- * defaults from.
- */
-fiveui.State = function(settings) {
- this.tabs = {};
- this.settings = settings;
-};
-
-_.extend(fiveui.State.prototype, {
-
- /**
- * @param {!number} tabId The id of the tab to retrieve state for.
- *
- * @return {?fiveui.TabState} The stored state of the tab, or null, if
- * no state exists for the requested tab.
- */
- getTabState: function(tabId) {
- return this.tabs[tabId] || null;
- },
-
- /**
- * Like getTabState, but creates an initial tab state if none exists.
- *
- * @param {!number} tabId The id of the tab to retrieve state for.
- * @param {!fiveui.ChromePort} port The port to use for communication
- * with the corresponding tab.
- * @return {!fiveui.TabState} Either an initial state if none existed, or the
- * state that exists already.
- */
- acquireTabState: function(tabId, port) {
- var ts = this.getTabState(tabId);
-
- if(null == ts) {
- var closed = ! this.settings.getDisplayDefault();
-
- // in the future, get these defaults from the settings instance.
- var ws = new fiveui.WinState(10, 10, 300, 300, closed);
- ts = new fiveui.TabState(tabId, ws, port);
- this.setTabState(ts);
- }
-
- return ts;
- },
-
- /**
- * @param {!fiveui.TabState} ts The state to store.
- * @return {void}
- */
- setTabState: function(ts) {
- this.tabs[ts.tabId] = ts;
- },
-
- /**
- * Update the state of a tab, if and only if the tabId exists in the state.
- *
- * @param {!number} tabId The id of the tab to store state for.
- * @param {function(fiveui.TabState): fiveui.TabState} fn A function
- * that modifies the tab state.
- *
- * @return {void}
- */
- adjust: function(tabId, fn) {
- var tState = this.getTabState(tabId);
- if (tState) {
- this.tabs[tabId] = fn(tState);
- }
- },
-
- /**
- * Remove the state of a tab.
- *
- * @param {!number} tabId The id of the tab to remove the state of.
- * @return {void}
- */
- removeTabState: function(tabId) {
- delete this.tabs[tabId];
- }
-
-});
-
-})();
diff --git a/contexts/data/fiveui/update-manager.js b/contexts/data/fiveui/update-manager.js
deleted file mode 100644
index 8013d2f..0000000
--- a/contexts/data/fiveui/update-manager.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Module : update-manager.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-(function() {
-
-
-fiveui.UpdateManager = function(msg) {
- var manager = this;
-
- // fired when the rule set gets updated
- msg.register('updateRuleSet', function(newRuleSet) {
- manager.trigger('updateRuleSet.' + newRuleSet.id, false, newRuleSet);
-
- // update the associated url patterns
- msg.send('getRuleSetPatIds', null, function(patIds) {
- _.each(patIds, function(patId) {
- manager.trigger('updateUrlPat.' + patId);
- });
- });
- });
-
- // fired when the url pat gets removed
- msg.register('remUrlPat', function(id) {
- var evt = 'remUrlPat.' + id;
- manager.trigger(evt);
- manager.off(evt);
- });
-
-};
-
-_.extend(fiveui.UpdateManager.prototype, Backbone.Events);
-
-})();
diff --git a/contexts/data/fiveui/url-pat.js b/contexts/data/fiveui/url-pat.js
deleted file mode 100644
index d723021..0000000
--- a/contexts/data/fiveui/url-pat.js
+++ /dev/null
@@ -1,140 +0,0 @@
-
-(function() {
-
-/**
- * Create a new Url Pattern to map urls to Rule Sets.
- *
- * @constructor
- * @param {!number} id New id for this UrlPat.
- * @param {!string} regex The pattern that is used to match Urls.
- * @param {!number} rule_id Unique id of the RuleSet to use for matching URLs.
- */
-fiveui.UrlPat = function(id, regex, rule_id) {
- this.id = id;
- this.regex = regex;
- this.rule_id = rule_id;
-};
-
-/**
- * Create a Url Pattern from a JSON object.
- *
- * @param {!number} id The id to use for the restored object.
- * @param {!Object} obj The object to take settings from.
- * @return {!fiveui.UrlPat} A populated UrlPat object.
- */
-fiveui.UrlPat.fromJSON = function(id, obj) {
- return new fiveui.UrlPat(id, obj.regex, obj.rule_id);
-};
-
-/**
- * Create a regular expression from a globbed pattern.
- *
- * @param {!string} str The globbed url.
- * @return {!RegExp} A compiled regular expression.
- */
-fiveui.UrlPat.compile = function(str) {
- var regex = str.replace(/\./g, '\.')
- .replace(/\*/g, '.*');
- return new RegExp(regex);
-};
-
-/**
- * Test a string Url against the regular expression held in a Url Pattern.
- *
- * @param {!string} url The Url the string to test.
- * @return {!boolean} If the Url matched the regular expression.
- */
-fiveui.UrlPat.prototype.match = function(url) {
- var pat = fiveui.UrlPat.compile(this.regex);
- return pat.test(url);
-};
-
-
-
-fiveui.UrlPatModel = Backbone.Model.extend({
-
- defaults: {
- id: null,
- regex: '',
- rule_id: null,
- },
-
- sync:function(method, model, options) {
- _.defaults(options, {
- success:function() {},
- error:function() {}
- });
-
- var msg = model.url;
- var id = model.get('id');
-
- switch(method) {
- case 'read':
- msg.send('getUrlPat', id, function(pat) {
- model.set(pat);
- options.success();
- });
- break;
-
- case 'update':
- msg.send('updateUrlPat', _.clone(model.attributes), options.success);
- break;
-
- case 'create':
- msg.send('addUrlPat', _.clone(model.attributes), options.success);
- break;
-
- case 'delete':
- msg.send('remUrlPat', id, function(res) {
- if(res) {
- options.success({});
- } else {
- options.error({});
- }
- });
- break;
- }
- }
-
-}, {
-
- fromUrlPat: function(pat, msg) {
- return new fiveui.UrlPatModel({
- id: pat.id,
- regex: pat.regex,
- rule_id: pat.rule_id
- }, { url : msg });
- }
-
-});
-
-
-fiveui.UrlPats = Backbone.Collection.extend({
-
- model: fiveui.UrlPatModel,
-
- sync:function(method, collection, options) {
-
- _.defaults(options, {
- success:function() {},
- error:function() {}
- });
-
- var msg = this.url;
-
- switch(method) {
-
- case 'read':
- msg.send('getUrlPats', null, function(pats) {
- options.success(_.map(pats, function(pat) {
- return fiveui.UrlPatModel.fromUrlPat(pat, msg);
- }));
- });
- break;
- }
-
- }
-
-});
-
-})();
diff --git a/contexts/data/fiveui/utils.js b/contexts/data/fiveui/utils.js
deleted file mode 100644
index 0ab3128..0000000
--- a/contexts/data/fiveui/utils.js
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Module : utils.js
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var fiveui = fiveui || {};
-
-(function() {
-
-fiveui.utils = fiveui.utils || {};
-
-/**
- * Chooses a function based on the current browser.
- */
-fiveui.utils.pick = function (mozFn, chrFn) {
- if (typeof chrome != 'undefined' ) {
- return chrFn;
- } else {
- return mozFn;
- }
-};
-
-/**
- * Create a browser-independent settings object. This uses different
- * backing storage depending on the browser:
- *
- * - Firefox: simple-storage
- * - Chrome: localStorage
- *
- * @return {!fiveui.Settings} A settings object that will persist data
- * between browser invocations.
- */
-// fiveui.utils.getSettings = fiveui.utils.pick(
-// function() {
-// // var ss = require('simple-storage');
-// var ss = {storage: {}}; // XXX hack, obviously.
-
-// var storageWrapper = new fiveui.utils.StorageWrapper(ss.storage);
-// return new fiveui.Settings(storageWrapper);
-// },
-// function() {
-// return new fiveui.Settings(localStorage);
-// });
-
-/**
- * Get an ID by adding one to the max id in current use.
- *
- * @param {Array.<number>} list the list of ids that the new id must
- * not conflict with.
- * @return {!number} A unique id for UrlPats.
- */
-fiveui.utils.getNewId = function(list) {
- // make sure we have a non-null, non-empty list:
- if (list === null || list.length == 0) {
- return 0;
- } else {
- return 1 + Math.max.apply(Math, list);
- }
-};
-
-
-/**
- * Remove c-style comments
- *
- * There's probably a faster way to do this.
- */
-var removeComments = function(data) {
-
- var state = 0;
- var toEOL = 1;
- var toEOC = 2;
-
- var sanitized = '';
- var len = data.length;
- var s = 0, e = 0;
-
- for(; e < len; ++e) {
- switch(state) {
- case toEOL:
- if(data[e] == '\n') {
- state = 0;
- s = e + 1;
- }
- break;
-
- case toEOC:
- if(data[e] == '*' && data[e+1] == '/') {
- state = 0;
- s = e + 2;
- e = e + 1;
- }
- break;
-
- default:
- if(data[e] == '/') {
- if(data[e+1] == '/') {
- sanitized = sanitized + data.substring(s,e);
- state = toEOL;
- e = e + 1;
- } else if(data[e+1] == '*') {
- sanitized = sanitized + data.substring(s,e);
- state = toEOC;
- e = e + 1;
- }
- }
- break;
- }
- }
-
- if(state == 0 && s < e) {
- sanitized = sanitized + data.substring(s,e);
- }
-
- return sanitized;
-};
-
-
-/**
- * Filter out comments, and other things that aren't appropriate in JSON.
- */
-fiveui.utils.filterJSON = function(data, type) {
- if(type == 'json') {
- return removeComments(data);
- } else {
- return data;
- }
-};
-
-})();