mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-25 17:04:16 +00:00
feature(modules) rm
This commit is contained in:
parent
0a0a5f3d7c
commit
113dc28e9c
59 changed files with 1 additions and 14107 deletions
|
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
"name": "menu",
|
||||
"version": "0.7.8",
|
||||
"homepage": "https://github.com/coderaiser/menu-io",
|
||||
"authors": [
|
||||
"coderaiser <mnemonic.enemy@gmail.com>"
|
||||
],
|
||||
"description": "Simple css-based multillevel context menu",
|
||||
"main": "menu-io.min.js",
|
||||
"moduleType": [
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"menu"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"gulpfile.js",
|
||||
"node_modules"
|
||||
],
|
||||
"_release": "0.7.8",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v0.7.8",
|
||||
"commit": "cc27e55d884962ed21e7eb3abedebe01acec7311"
|
||||
},
|
||||
"_source": "git://github.com/coderaiser/menu-io.git",
|
||||
"_target": "~0.7.8",
|
||||
"_originalSource": "menu",
|
||||
"_direct": true
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
2015.02.20, v0.7.8
|
||||
|
||||
feature:
|
||||
- (menu) z-index: 1 -> 2
|
||||
|
||||
|
||||
2015.02.06, v0.7.7
|
||||
|
||||
feature:
|
||||
- (menu) speed up
|
||||
- (bower) ignore: add gulpfile
|
||||
- (bower) moduleType: add node
|
||||
|
||||
|
||||
2015.01.05, v0.7.5
|
||||
|
||||
fix:
|
||||
- (bower) rm bower_components
|
||||
|
||||
feature:
|
||||
- (jshintrc) add
|
||||
- (menu) rm util.io-part
|
||||
- (util) rm
|
||||
- (package) private
|
||||
- (gitignore) npm-debug.log
|
||||
- (bower) v0.7.4
|
||||
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2015 Coderaiser <mnemonic.enemy@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
Menu [![Build Status][BuildStatusIMGURL]][BuildStatusURL]
|
||||
====
|
||||
[BuildStatusURL]: https://travis-ci.org/coderaiser/menu-io "Build Status"
|
||||
[BuildStatusIMGURL]: https://api.travis-ci.org/coderaiser/menu-io.png?branch=gh-pages
|
||||
|
||||
Simple css-based context menu made for [Cloud Commander](http://cloudcmd.io).
|
||||
|
||||
Little bit better then other people do :).
|
||||
So to see at work look [here](http://jsfiddle.net/coderaiser/mAUUz/).
|
||||
|
||||
#How come?
|
||||
|
||||
Tired to use js based libraries which use jquery and `.hover` classes insteed of `:hover` pseudo-selectors.
|
||||
|
||||
#Why should I care?
|
||||
|
||||
- `1.6kb` min & gzip for js.
|
||||
- `1kb` min & gzip for css.
|
||||
- no dependencies (just part of [util-io](http://coderaiser.github.io/util-io)).
|
||||
- easy to use.
|
||||
- easy to extend.
|
||||
|
||||
# Install
|
||||
With help of [bower](http://bower.io "Bower").
|
||||
```
|
||||
bower install menu
|
||||
```
|
||||
|
||||
#How use?
|
||||
Create `html` page with `js` and `css` connected.
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="http://coderaiser.github.io/menu-io/menu.min.css">
|
||||
<script src="http://coderaiser.github.io/menu-io/menu.min.js"></script>
|
||||
```
|
||||
|
||||
Add little JavaScript:
|
||||
|
||||
```js
|
||||
var menu = MenuIO({
|
||||
'item name': function onItemNameClick() {
|
||||
}
|
||||
}
|
||||
```
|
||||
You could use element and (or) options parameters if you need to.
|
||||
|
||||
```js
|
||||
var element = document.body,
|
||||
|
||||
options = {
|
||||
icon : true, /* add class icon-item-name */
|
||||
beforeClose : alert,
|
||||
beforeShow : alert,
|
||||
beforeClick : alert,
|
||||
name : 'name of menu' /* if you want use a couple menu on one element */
|
||||
},
|
||||
|
||||
menu = MenuIO(element, options, {
|
||||
'item name': function onItemNameClick() {
|
||||
});
|
||||
```
|
||||
|
||||
Look for `examples` directory or copy example from bottom:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="http://coderaiser.github.io/menu-io/menu.min.css">
|
||||
<script src="http://coderaiser.github.io/menu-io/menu-io.min.js"></script>
|
||||
<script>
|
||||
window.addEventListener('load', function onLoad() {
|
||||
'use strict';
|
||||
|
||||
window.removeEventListener('load', onLoad);
|
||||
var menu = MenuIO({
|
||||
help: function() {
|
||||
alert('*help');
|
||||
},
|
||||
upload: {
|
||||
github: {
|
||||
gist: function() {
|
||||
alert('*gist');
|
||||
},
|
||||
main: function() {
|
||||
alert('*main');
|
||||
}
|
||||
},
|
||||
dropbox: function() {
|
||||
alert('*dropbox');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
#License
|
||||
MIT
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"name": "menu",
|
||||
"version": "0.7.8",
|
||||
"homepage": "https://github.com/coderaiser/menu-io",
|
||||
"authors": [
|
||||
"coderaiser <mnemonic.enemy@gmail.com>"
|
||||
],
|
||||
"description": "Simple css-based multillevel context menu",
|
||||
"main": "menu-io.min.js",
|
||||
"moduleType": [
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"menu"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"gulpfile.js",
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
html, body, .menu-container {
|
||||
width: 99%;
|
||||
height: 99%;
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
var menu, MenuIO;
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var element = document.querySelector('#js-menu-container'),
|
||||
options = {
|
||||
icon: true
|
||||
};
|
||||
|
||||
menu = MenuIO(element, options, {
|
||||
'help': function() {
|
||||
console.log('*help');
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Menu Example
|
||||
</title>
|
||||
<link rel="stylesheet" href="../menu-io.min.css">
|
||||
<link rel="stylesheet" href="example.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="js-menu-container" class="menu-container"></div>
|
||||
<script src="../menu-io.min.js"></script>
|
||||
<script src="menu-data.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Menu Example
|
||||
</title>
|
||||
<link rel="stylesheet" href="../menu-io.css">
|
||||
<link rel="stylesheet" href="example.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="js-menu-container" class="menu-container"></div>
|
||||
<script src="../menu-io.js"></script>
|
||||
<script src="menu-data.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
.menu-hidden {
|
||||
display:none;
|
||||
}
|
||||
|
||||
.menu {
|
||||
position : absolute;
|
||||
z-index : 2;
|
||||
padding : 0;
|
||||
|
||||
font-size : 14px;
|
||||
|
||||
list-style : none;
|
||||
|
||||
color : #222;
|
||||
|
||||
background : rgb(255,255,255);
|
||||
background : rgba(255,255,255, 0.9);
|
||||
|
||||
border-color : rgb(49,123,249);
|
||||
border-color : rgba(49,123,249,.40);
|
||||
border-style : solid;
|
||||
border-width : 1px;
|
||||
border-radius : 5px;
|
||||
|
||||
-webkit-user-select : none;
|
||||
-moz-user-select : none;
|
||||
-ms-user-select : none;
|
||||
-o-user-select : none;
|
||||
user-select : none;
|
||||
}
|
||||
|
||||
.menu-button {
|
||||
background: white;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
position: relative;
|
||||
padding: 3px 20px;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.menu-item::after {
|
||||
content: attr(data-key);
|
||||
float: right;
|
||||
}
|
||||
|
||||
.menu-item:hover {
|
||||
background-color: #e3f2ff;
|
||||
}
|
||||
|
||||
.menu-item > .menu {
|
||||
top: 0;
|
||||
left: 100%;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.menu-item:hover > .menu {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.menu-submenu > label:after {
|
||||
display: block;
|
||||
float: right;
|
||||
width: 0;
|
||||
height: 0;
|
||||
margin-top: 3px;
|
||||
margin-right: -10px;
|
||||
border-color: transparent;
|
||||
border-left-color: rgb(49,123,249);
|
||||
border-style: solid;
|
||||
border-width: 5px 0 5px 5px;
|
||||
content: " ";
|
||||
}
|
||||
|
|
@ -1,385 +0,0 @@
|
|||
var MenuIO;
|
||||
|
||||
(function (window) {
|
||||
'use strict';
|
||||
|
||||
MenuIO = function(element, options, menuData) {
|
||||
if (!(this instanceof MenuIO)) {
|
||||
return new MenuIO(element, options, menuData);
|
||||
}
|
||||
|
||||
var ElementMenu,
|
||||
Element,
|
||||
Options = {},
|
||||
ElementFuncs = new ElementFuncsProto(),
|
||||
ElementHeight,
|
||||
ElementEvent,
|
||||
MenuFuncs = {},
|
||||
TEMPLATE = {
|
||||
MAIN: '<ul data-name="js-menu" class="menu menu-hidden">' +
|
||||
'{{ items }}' +
|
||||
'</ul>',
|
||||
ITEM: '<li data-name="js-menu-item" class="menu-item{{ className }}"{{ attribute }}>' +
|
||||
'<label data-menu-path="{{ path }}">{{ name }}</label>' +
|
||||
'{{ subitems }}' +
|
||||
'</li>'
|
||||
};
|
||||
|
||||
if (menuData) {
|
||||
Element =
|
||||
ElementEvent = element;
|
||||
Options = options;
|
||||
} else if (options) {
|
||||
Element =
|
||||
ElementEvent = element;
|
||||
menuData = options;
|
||||
} else {
|
||||
Element = document.body;
|
||||
ElementEvent = window;
|
||||
menuData = element;
|
||||
}
|
||||
|
||||
function init() {
|
||||
var name,
|
||||
isObj = typeof menuData === 'object';
|
||||
|
||||
if (!isObj) {
|
||||
name = menuData;
|
||||
menuData = {};
|
||||
menuData[name] = null;
|
||||
}
|
||||
|
||||
ElementMenu = createMenu(menuData);
|
||||
|
||||
ElementEvent.addEventListener('click', onClick);
|
||||
ElementEvent.addEventListener('contextmenu', onContextMenu);
|
||||
}
|
||||
|
||||
function createMenu(menuData) {
|
||||
var menu,
|
||||
items = '',
|
||||
buildItems = function(menuData, path) {
|
||||
var DATA_MENU = 'data-menu="js-submenu"',
|
||||
Data_KEY = 'data-key=',
|
||||
items = '';
|
||||
|
||||
if (path)
|
||||
path += '.';
|
||||
else
|
||||
path = '';
|
||||
|
||||
Object.keys(menuData).forEach(function(name) {
|
||||
var nameIcon,
|
||||
key = '',
|
||||
subitems = '',
|
||||
className = '',
|
||||
attribute = '',
|
||||
pathName = path + name,
|
||||
|
||||
data = menuData[name],
|
||||
isObj = typeof data === 'object';
|
||||
|
||||
if (!isObj) {
|
||||
MenuFuncs[pathName] = data;
|
||||
} else {
|
||||
subitems = rendy(TEMPLATE.MAIN, {
|
||||
items: buildItems(data, pathName)
|
||||
});
|
||||
|
||||
className = ' menu-submenu';
|
||||
attribute = ' ' + DATA_MENU;
|
||||
}
|
||||
|
||||
if (Options.icon) {
|
||||
nameIcon = name
|
||||
.replace(/\(|\)/g, '')
|
||||
.replace(/\s/g, '-')
|
||||
.toLowerCase();
|
||||
|
||||
className += ' icon icon-' + nameIcon;
|
||||
}
|
||||
|
||||
if (Options.keys) {
|
||||
key = Options.keys[name];
|
||||
|
||||
if (key)
|
||||
attribute = ' ' + Data_KEY + key;
|
||||
}
|
||||
|
||||
items += rendy(TEMPLATE.ITEM, {
|
||||
name : name,
|
||||
subitems : subitems,
|
||||
className : className,
|
||||
attribute : attribute,
|
||||
path : pathName
|
||||
});
|
||||
});
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
items = buildItems(menuData);
|
||||
|
||||
menu = document.createElement('ul');
|
||||
menu.setAttribute('data-name', 'js-menu');
|
||||
menu.className = 'menu menu-hidden';
|
||||
menu.innerHTML = items;
|
||||
|
||||
Element.appendChild(menu);
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
this.show = showMenuElement;
|
||||
this.hide = hideMenuElement;
|
||||
|
||||
function checkElement(target, position) {
|
||||
var is,
|
||||
element = ElementFuncs.getItem(target),
|
||||
isName = ElementFuncs.isName(element),
|
||||
isItem = ElementFuncs.isItem(element),
|
||||
isSub = ElementFuncs.isSubMenu(element);
|
||||
|
||||
if (!isName || !isItem) {
|
||||
element = document.elementFromPoint(position.x, position.y);
|
||||
isSub = ElementFuncs.isSubMenu(element);
|
||||
isName = ElementFuncs.isName(element);
|
||||
isItem = ElementFuncs.isItem(element);
|
||||
}
|
||||
|
||||
is = {
|
||||
name : isName,
|
||||
item : isItem,
|
||||
sub : isSub,
|
||||
};
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
function onClick(event, checkResult) {
|
||||
var itemData, notClick,
|
||||
afterClick = Options.afterClick,
|
||||
beforeClick = Options.beforeClick,
|
||||
name = Options.name,
|
||||
|
||||
element = event.target,
|
||||
is = checkResult || checkElement(element, {
|
||||
x: event.clientX,
|
||||
y: event.clientY
|
||||
});
|
||||
|
||||
notClick = exec(beforeClick, name);
|
||||
|
||||
if (is.sub) {
|
||||
event.preventDefault();
|
||||
} else {
|
||||
hideMenuElement();
|
||||
|
||||
if (!notClick && (is.name || is.item)) {
|
||||
itemData = getMenuItemData(element);
|
||||
exec(itemData);
|
||||
exec(afterClick);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onContextMenu(event) {
|
||||
var element = event.target,
|
||||
x = event.clientX,
|
||||
y = event.clientY,
|
||||
is = checkElement(element, {
|
||||
x: x,
|
||||
y: y
|
||||
});
|
||||
|
||||
if (is.name || is.item || is.sub)
|
||||
onClick(event, is);
|
||||
else {
|
||||
hideMenuElement();
|
||||
showMenuElement(x, y);
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function setMenuPosition(x, y) {
|
||||
var isNumberX = typeof x === 'number',
|
||||
isNumberY = typeof y === 'number',
|
||||
heightMenu = getMenuHeight(),
|
||||
heightInner = window.innerHeight;
|
||||
|
||||
if (heightInner < heightMenu + y)
|
||||
y -= heightMenu;
|
||||
|
||||
if (isNumberX)
|
||||
ElementMenu.style.left = x + 'px';
|
||||
|
||||
if (isNumberY)
|
||||
ElementMenu.style.top = y - 14 + 'px';
|
||||
}
|
||||
|
||||
function showMenuElement(x, y) {
|
||||
var beforeShow = Options.beforeShow,
|
||||
name = Options.name,
|
||||
params = {
|
||||
x : x,
|
||||
y : y,
|
||||
name : name
|
||||
},
|
||||
|
||||
notShow = exec(beforeShow, params);
|
||||
|
||||
if (!notShow) {
|
||||
ElementMenu.classList.remove('menu-hidden');
|
||||
setMenuPosition(params.x, params.y);
|
||||
}
|
||||
}
|
||||
|
||||
function hideMenuElement() {
|
||||
var notHide = exec(Options.beforeClose);
|
||||
|
||||
if (!notHide)
|
||||
ElementMenu.classList.add('menu-hidden');
|
||||
}
|
||||
|
||||
function getMenuItemData(element) {
|
||||
var path, data;
|
||||
|
||||
element = ElementFuncs.getName(element);
|
||||
|
||||
if (element) {
|
||||
path = element.getAttribute('data-menu-path');
|
||||
}
|
||||
|
||||
data = MenuFuncs[path];
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function getMenuHeight() {
|
||||
var styleComputed, height;
|
||||
|
||||
if (!ElementHeight) {
|
||||
styleComputed = getComputedStyle(ElementMenu);
|
||||
height = styleComputed.height;
|
||||
ElementHeight = parseInt(height, 10);
|
||||
}
|
||||
|
||||
return ElementHeight;
|
||||
}
|
||||
|
||||
init();
|
||||
};
|
||||
|
||||
function ElementFuncsProto() {
|
||||
this.getItem = getItem;
|
||||
this.getName = getName;
|
||||
this.isName = isName;
|
||||
this.isItem = isItem;
|
||||
this.isMenu = isMenu;
|
||||
this.isSubMenu = isSubMenu;
|
||||
|
||||
function getItem(element) {
|
||||
var isNameElement;
|
||||
|
||||
if (element) {
|
||||
isNameElement = isName(element);
|
||||
|
||||
if (isNameElement)
|
||||
element = element.parentElement;
|
||||
}
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
function getName(element) {
|
||||
var is;
|
||||
|
||||
if (element) {
|
||||
is = isName(element);
|
||||
|
||||
if (!is)
|
||||
element = element.querySelector('[data-menu-path]');
|
||||
}
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
function isName(element) {
|
||||
var itIs;
|
||||
|
||||
if (element)
|
||||
itIs = element.hasAttribute('data-menu-path');
|
||||
|
||||
return itIs;
|
||||
}
|
||||
|
||||
function isItem(element) {
|
||||
var itIs = checkElementsName(element, 'js-menu-item');
|
||||
|
||||
return itIs;
|
||||
}
|
||||
|
||||
function isMenu(element) {
|
||||
var itIs = checkElementsName(element, 'js-menu');
|
||||
|
||||
return itIs;
|
||||
}
|
||||
|
||||
function checkElementsName(element, nameElement, attribute) {
|
||||
var itIs, name;
|
||||
|
||||
if (!attribute)
|
||||
attribute = 'data-name';
|
||||
|
||||
if (element) {
|
||||
name = element.getAttribute(attribute);
|
||||
|
||||
if (name === nameElement)
|
||||
itIs = true;
|
||||
}
|
||||
|
||||
return itIs;
|
||||
}
|
||||
|
||||
function isSubMenu(element) {
|
||||
var itIs, item,
|
||||
attribute = 'data-menu',
|
||||
value = 'js-submenu';
|
||||
|
||||
item = getItem(element);
|
||||
itIs = checkElementsName(item, value, attribute);
|
||||
|
||||
return itIs;
|
||||
}
|
||||
}
|
||||
|
||||
function exec(callback) {
|
||||
var ret,
|
||||
args = [].slice.call(arguments, 1);
|
||||
|
||||
if (typeof callback === 'function')
|
||||
ret = callback.apply(null, args);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function rendy(templ, data) {
|
||||
var str, regExp, expr,
|
||||
result = templ;
|
||||
|
||||
Object
|
||||
.keys(data)
|
||||
.forEach(function(param) {
|
||||
str = data[param];
|
||||
expr = '{{\\s' + param + '\\s}}';
|
||||
regExp = RegExp(expr, 'g');
|
||||
result = result.replace(regExp, str);
|
||||
});
|
||||
|
||||
if (~result.indexOf('{{'))
|
||||
result = result.replace(/{{\s.*\s}}/, '');
|
||||
|
||||
return result;
|
||||
}
|
||||
})(window);
|
||||
1
modules/menu/menu-io.min.css
vendored
1
modules/menu/menu-io.min.css
vendored
|
|
@ -1 +0,0 @@
|
|||
.menu-hidden{display:none}.menu{position:absolute;z-index:2;padding:0;font-size:14px;list-style:none;color:#222;background:#fff;background:rgba(255,255,255,.9);border-color:#317bf9;border-color:rgba(49,123,249,.4);border-style:solid;border-width:1px;border-radius:5px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.menu-button{background:#fff;border:0}.menu-item{position:relative;padding:3px 20px;white-space:pre}.menu-item::after{content:attr(data-key);float:right}.menu-item:hover{background-color:#e3f2ff}.menu-item>.menu{top:0;left:100%;display:none}.menu-item:hover>.menu{display:block}.menu-submenu>label:after{display:block;float:right;width:0;height:0;margin-top:3px;margin-right:-10px;border-color:transparent;border-left-color:#317bf9;border-style:solid;border-width:5px 0 5px 5px;content:" "}
|
||||
1
modules/menu/menu-io.min.js
vendored
1
modules/menu/menu-io.min.js
vendored
|
|
@ -1 +0,0 @@
|
|||
var MenuIO;!function(e){"use strict";function t(){function e(e){var t;return e&&(t=n(e),t&&(e=e.parentElement)),e}function t(e){var t;return e&&(t=n(e),t||(e=e.querySelector("[data-menu-path]"))),e}function n(e){var t;return e&&(t=e.hasAttribute("data-menu-path")),t}function a(e){var t=i(e,"js-menu-item");return t}function u(e){var t=i(e,"js-menu");return t}function i(e,t,n){var a,u;return n||(n="data-name"),e&&(u=e.getAttribute(n),u===t&&(a=!0)),a}function r(t){var n,a,u="data-menu",r="js-submenu";return a=e(t),n=i(a,r,u)}this.getItem=e,this.getName=t,this.isName=n,this.isItem=a,this.isMenu=u,this.isSubMenu=r}function n(e){var t,n=[].slice.call(arguments,1);return"function"==typeof e&&(t=e.apply(null,n)),t}function a(e,t){var n,a,u,i=e;return Object.keys(t).forEach(function(e){n=t[e],u="{{\\s"+e+"\\s}}",a=RegExp(u,"g"),i=i.replace(a,n)}),~i.indexOf("{{")&&(i=i.replace(/{{\s.*\s}}/,"")),i}MenuIO=function(u,i,r){function s(){var e,t="object"==typeof r;t||(e=r,r={},r[e]=null),v=m(r),I.addEventListener("click",o),I.addEventListener("contextmenu",l)}function m(e){var t,n="",u=function(e,t){var n='data-menu="js-submenu"',i="data-key=",r="";return t?t+=".":t="",Object.keys(e).forEach(function(s){var m,c="",o="",l="",f="",d=t+s,b=e[s],h="object"==typeof b;h?(o=a(N.MAIN,{items:u(b,d)}),l=" menu-submenu",f=" "+n):x[d]=b,M.icon&&(m=s.replace(/\(|\)/g,"").replace(/\s/g,"-").toLowerCase(),l+=" icon icon-"+m),M.keys&&(c=M.keys[s],c&&(f=" "+i+c)),r+=a(N.ITEM,{name:s,subitems:o,className:l,attribute:f,path:d})}),r};return n=u(e),t=document.createElement("ul"),t.setAttribute("data-name","js-menu"),t.className="menu menu-hidden",t.innerHTML=n,y.appendChild(t),t}function c(e,t){var n,a=j.getItem(e),u=j.isName(a),i=j.isItem(a),r=j.isSubMenu(a);return u&&i||(a=document.elementFromPoint(t.x,t.y),r=j.isSubMenu(a),u=j.isName(a),i=j.isItem(a)),n={name:u,item:i,sub:r}}function o(e,t){var a,u,i=M.afterClick,r=M.beforeClick,s=M.name,m=e.target,o=t||c(m,{x:e.clientX,y:e.clientY});u=n(r,s),o.sub?e.preventDefault():(b(),u||!o.name&&!o.item||(a=h(m),n(a),n(i)))}function l(e){var t=e.target,n=e.clientX,a=e.clientY,u=c(t,{x:n,y:a});u.name||u.item||u.sub?o(e,u):(b(),d(n,a)),e.preventDefault()}function f(t,n){var a="number"==typeof t,u="number"==typeof n,i=p(),r=e.innerHeight;i+n>r&&(n-=i),a&&(v.style.left=t+"px"),u&&(v.style.top=n-14+"px")}function d(e,t){var a=M.beforeShow,u=M.name,i={x:e,y:t,name:u},r=n(a,i);r||(v.classList.remove("menu-hidden"),f(i.x,i.y))}function b(){var e=n(M.beforeClose);e||v.classList.add("menu-hidden")}function h(e){var t,n;return e=j.getName(e),e&&(t=e.getAttribute("data-menu-path")),n=x[t]}function p(){var e,t;return g||(e=getComputedStyle(v),t=e.height,g=parseInt(t,10)),g}if(!(this instanceof MenuIO))return new MenuIO(u,i,r);var v,y,g,I,M={},j=new t,x={},N={MAIN:'<ul data-name="js-menu" class="menu menu-hidden">{{ items }}</ul>',ITEM:'<li data-name="js-menu-item" class="menu-item{{ className }}"{{ attribute }}><label data-menu-path="{{ path }}">{{ name }}</label>{{ subitems }}</li>'};r?(y=I=u,M=i):i?(y=I=u,r=i):(y=document.body,I=e,r=u),this.show=d,this.hide=b,s()}}(window);
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
"name": "menu",
|
||||
"private": true,
|
||||
"version": "0.7.8",
|
||||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
||||
"description": "Simple css-based multillevel context menu",
|
||||
"homepage": "http://coderaiser.github.io/menu",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/coderaiser/menu-io.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "gulp default"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp": "~3.8.8",
|
||||
"gulp-rename": "~1.2.0",
|
||||
"gulp-minify-css": "~0.3.1",
|
||||
"gulp-uglify": "~0.2.1",
|
||||
"gulp-concat": "~2.2.0",
|
||||
"gulp-jshint": "~1.5.3",
|
||||
"gulp-recess": "~0.3.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.4.x"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue