Skip to content

Commit

Permalink
Added license informations and file headers
Browse files Browse the repository at this point in the history
  • Loading branch information
taku0 committed Oct 4, 2012
1 parent c69ba1c commit 33b3a25
Show file tree
Hide file tree
Showing 16 changed files with 658 additions and 98 deletions.
373 changes: 373 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## License

Copyright 2012 taku0 ( https://github.com/taku0 )
The files licensed under the MPL 2.0 (Mozilla Public License Version 2.0).
The files comes with ABSOLUTELY NO WARRANTY.
See LICENSE or http://mozilla.org/MPL/2.0/ for details.
19 changes: 19 additions & 0 deletions data/detectContext.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

/*
* Functions detect the context of the menu.
*
* The main function is detectContext.
* The context is detected with detector functions.
* Detector functions takes a node and returns boolean.
* Detector functions are applied to the node in sequence and
* the associated context name of the detector function returning true first
* is returned.
* Typical detector function uses XPath returning boolean.
*/

"use strict";

/**
Expand Down Expand Up @@ -60,6 +78,7 @@ var contextDetectors = [

/**
* @return {string} The context of the node.
* @param {Node} node A node on which the menu opens.
*/
function detectContext(node) {
for (let detector of contextDetectors) {
Expand Down
6 changes: 6 additions & 0 deletions data/initialize.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

/*
* Initialization routines
*
Expand Down
86 changes: 15 additions & 71 deletions data/menu.js
Original file line number Diff line number Diff line change
@@ -1,79 +1,23 @@
"use strict";

// FIXME What happens if CSS transforms are applied to
// the body element and/or iframe element?

//// Types for JSDoc

var types = types || {};

/**
* The type of the menu item variant.
*
* There is two variants: primary and secondary.
*
* The primary variant is used when alt is released;
* the secondary variant is used otherwise.
*
* The "icon" property is a URL reference to an element within
* the SVG document.
* The "label" property is a label text.
* The "action" property is a function invoked when the item is activated.
* The "action" property is required for leaf items.
* The optional "classes" property is an array of class names.
* Menu filters may refer the class names.
* The optional "children" property is an array of child menu items.
*
* @typedef {{icon: string,
* label: string,
* action: ?function(PieMenu),
* classes: ?Array.<string>
* children: ?Array.<types.MenuItem>}}
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
types.Variant = null;

/**
* The type of the menu item.
*
* The menu item is an array of variants.
*
* @typedef {Array.<types.Variant>}
/*
* The menu class.
*
* The menu captures input events on the window and updates DOM.
* The menu has a state object handling input.
*
* The coordinate system used by the menu is the user coordinate of
* the menu SVG node.
*/
types.MenuItem = null;

/**
* The type of the states of the page when the menu is created.
*
* The "isFirst" property is true iff there is no previous pages in the history.
* The "isLast" property is true iff there is no next pages in the history.
* The "isLoading" property is true iff the page is loading.
*
* @typedef {{isFirst: boolean,
* isLast: boolean,
* isLoading: boolean}}
*/
types.PageState = null;
"use strict";

/**
* The type of the menu filters,
* that is the functions that tweak the menu items.
*
* Menu filters takes the target node, the state of tha page,
* an original menu item, and the configurations and return a new menu item.
*
* The filters are called just before the menu item is rendered.
*
* The filters may return a null or an empty array to hide the menu item.
*
* Any filter should not modify original menu item objects.
*
* @typedef {function(Node,
* types.PageState,
* types.MenuItem,
* Object.<string, *>):
* ?types.MenuItem}
*/
types.MenuFilter = null;
// FIXME What happens if CSS transforms are applied to
// the body element and/or iframe element?

//// The menu class

Expand Down
91 changes: 64 additions & 27 deletions data/menu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions data/menuItems.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

/*
* The menu definition.
*
* There are several menus, one for each contexts.
* Each menu is an array of menu item while a menu item is
* an array of variants.
* Variants are primary variant and secondary variant.
* Pressing alt select secondary variant.
* See also types.Variant for detail.
*
* Null menu item represents empty item.
*
* The menu items are filtered by menu filters.
* Menu filters tweak the menu item; it hides the disabled menu or
* replace menu items depend on page state.
*/

"use strict";

var pageMenu = {
Expand Down
6 changes: 6 additions & 0 deletions data/queryPageState.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

/*
* Commnunication functions between the content scripts and the add-on
* about page states.
Expand Down
Loading

0 comments on commit 33b3a25

Please sign in to comment.