mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-13 11:41:31 +00:00
Build modified streamline images
The official image from streamline does not currently work for the arm64 platform. As a temporary measure, the source code and docker build scripts have been lifted from the official images and are used to build locally. Some additional modifications are made to reduce overall image size, these are documented in docker/README.md
This commit is contained in:
+45
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "metisMenu",
|
||||
"version": "1.1.3",
|
||||
"homepage": "https://github.com/onokumus/metisMenu",
|
||||
"authors": [
|
||||
"onokumus <onokumus@gmail.com>"
|
||||
],
|
||||
"description": "Easy menu jQuery plugin for Twitter Bootstrap 3",
|
||||
"main": [
|
||||
"dist/metisMenu.js",
|
||||
"dist/metisMenu.css"
|
||||
],
|
||||
"keywords": [
|
||||
"twitter",
|
||||
"bootstrap",
|
||||
"twbs",
|
||||
"jquery",
|
||||
"menu",
|
||||
"accordion",
|
||||
"toggle",
|
||||
"metis",
|
||||
"metisMenu"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"dependencies": {
|
||||
"bootstrap": "~3.3.0"
|
||||
},
|
||||
"_release": "1.1.3",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "1.1.3",
|
||||
"commit": "8e179d59f60a593203667c092119779dc36f5171"
|
||||
},
|
||||
"_source": "git://github.com/onokumus/metisMenu.git",
|
||||
"_target": "~1.1.3",
|
||||
"_originalSource": "metisMenu",
|
||||
"_direct": true
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function(grunt) {
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON("package.json"),
|
||||
|
||||
banner: "/*\n" +
|
||||
" * <%= pkg.title || pkg.name %> - v<%= pkg.version %>\n" +
|
||||
" * <%= pkg.description %>\n" +
|
||||
" * <%= pkg.homepage %>\n" +
|
||||
" *\n" +
|
||||
" * Made by <%= pkg.author.name %>\n" +
|
||||
" * Under <%= pkg.license %> License\n" +
|
||||
" */\n",
|
||||
|
||||
jshint: {
|
||||
options: {
|
||||
jshintrc: ".jshintrc"
|
||||
},
|
||||
all: [
|
||||
"Gruntfile.js",
|
||||
"src/metisMenu.js"
|
||||
]
|
||||
},
|
||||
concat: {
|
||||
plugin: {
|
||||
src: ["src/metisMenu.js"],
|
||||
dest: "dist/metisMenu.js"
|
||||
},
|
||||
css: {
|
||||
src: ["src/metisMenu.css"],
|
||||
dest: "dist/metisMenu.css"
|
||||
},
|
||||
options: {
|
||||
banner: "<%= banner %>"
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
plugin: {
|
||||
src: ["dist/metisMenu.js"],
|
||||
dest: "dist/metisMenu.min.js"
|
||||
},
|
||||
options: {
|
||||
banner: "<%= banner %>"
|
||||
}
|
||||
},
|
||||
cssmin: {
|
||||
options: {
|
||||
banner: "<%= banner %>"
|
||||
},
|
||||
menucss: {
|
||||
src: ["src/metisMenu.css"],
|
||||
dest: "dist/metisMenu.min.css"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks("grunt-contrib-jshint");
|
||||
grunt.loadNpmTasks("grunt-contrib-concat");
|
||||
grunt.loadNpmTasks("grunt-contrib-uglify");
|
||||
grunt.loadNpmTasks("grunt-contrib-cssmin");
|
||||
|
||||
grunt.registerTask("travis", ["jshint"]);
|
||||
grunt.registerTask("default", ["jshint", "concat", "uglify", "cssmin"]);
|
||||
};
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Osman Nuri Okumuş
|
||||
|
||||
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.
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
# metisMenu [](https://travis-ci.org/onokumus/metisMenu)
|
||||
|
||||
> Easy menu jQuery plugin for Twitter Bootstrap 3
|
||||
|
||||
> Now support cdnjs & jsdelivr
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
* [npm](http://npmjs.org/)
|
||||
|
||||
```bash
|
||||
npm install metismenu
|
||||
```
|
||||
|
||||
* [Bower](http://bower.io)
|
||||
|
||||
```bash
|
||||
bower install metisMenu
|
||||
```
|
||||
|
||||
* [Download](https://github.com/onokumus/metisMenu/archive/master.zip)
|
||||
|
||||
## Usage
|
||||
|
||||
1. Include Twitter Bootstrap StyleSheet
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.0/css/bootstrap.min.css">
|
||||
```
|
||||
|
||||
2. Include metisMenu StyleSheet
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/bootstrap.metismenu/1.1.2/css/metismenu.min.css">
|
||||
```
|
||||
|
||||
3. Include jQuery
|
||||
|
||||
```html
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
||||
```
|
||||
|
||||
4. Include Twitter Bootstrap Script
|
||||
|
||||
```html
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.0/js/bootstrap.min.js"></script>
|
||||
```
|
||||
|
||||
5. Include metisMenu plugin's code
|
||||
|
||||
```html
|
||||
<script src="//cdn.jsdelivr.net/bootstrap.metismenu/1.1.2/js/metismenu.min.js"></script>
|
||||
```
|
||||
|
||||
6. Call the plugin:
|
||||
|
||||
```javascript
|
||||
$("#menu").metisMenu();
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
#### toggle
|
||||
Type: `Boolean`
|
||||
Default: `true`
|
||||
|
||||
For auto collapse support.
|
||||
|
||||
```javascript
|
||||
$("#menu").metisMenu({
|
||||
toggle: false
|
||||
});
|
||||
```
|
||||
|
||||
#### doubleTapToGo
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
For double tap support.
|
||||
|
||||
```javascript
|
||||
$("#menu").metisMenu({
|
||||
doubleTapToGo: true
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
### [DEMO](http://demo.onokumus.com/metisMenu/)
|
||||
|
||||
Contains a simple HTML file to demonstrate metisMenu plugin.
|
||||
|
||||
### Release History
|
||||
**DATE** **VERSION** **CHANGES**
|
||||
* 2014-11-01 v1.1.3 Bootstrap 3.3.0
|
||||
* 2014-07-07 v1.1.0 Add double tap functionality
|
||||
* 2014-06-24 v1.0.3 cdnjs support & rename plugin
|
||||
* 2014-06-18 v1.0.3 Create grunt task
|
||||
* 2014-06-10 v1.0.2 Fixed for IE8 & IE9
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
metisMenu was made with love by these guys and a bunch of awesome [contributors](https://github.com/onokumus/metisMenu/graphs/contributors).
|
||||
|
||||
[](http://onokumus.com) |
|
||||
--- | --- | --- | --- | --- | --- | ---
|
||||
[Osman Nuri Okumuş](http://onokumus.com) |
|
||||
|
||||
|
||||
## License
|
||||
|
||||
[MIT License](https://github.com/onokumus/metisMenu/blob/master/LICENSE)
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "metisMenu",
|
||||
"version": "1.1.3",
|
||||
"homepage": "https://github.com/onokumus/metisMenu",
|
||||
"authors": [
|
||||
"onokumus <onokumus@gmail.com>"
|
||||
],
|
||||
"description": "Easy menu jQuery plugin for Twitter Bootstrap 3",
|
||||
"main": [
|
||||
"dist/metisMenu.js",
|
||||
"dist/metisMenu.css"
|
||||
],
|
||||
"keywords": [
|
||||
"twitter",
|
||||
"bootstrap",
|
||||
"twbs",
|
||||
"jquery",
|
||||
"menu",
|
||||
"accordion",
|
||||
"toggle",
|
||||
"metis",
|
||||
"metisMenu"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"dependencies": {
|
||||
"bootstrap": "~3.3.0"
|
||||
}
|
||||
}
|
||||
Vendored
Executable
+64
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* metismenu - v1.1.3
|
||||
* Easy menu jQuery plugin for Twitter Bootstrap 3
|
||||
* https://github.com/onokumus/metisMenu
|
||||
*
|
||||
* Made by Osman Nuri Okumus
|
||||
* Under MIT License
|
||||
*/
|
||||
.arrow {
|
||||
float: right;
|
||||
line-height: 1.42857;
|
||||
}
|
||||
|
||||
.glyphicon.arrow:before {
|
||||
content: "\e079";
|
||||
}
|
||||
|
||||
.active > a > .glyphicon.arrow:before {
|
||||
content: "\e114";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Require Font-Awesome
|
||||
* http://fortawesome.github.io/Font-Awesome/
|
||||
*/
|
||||
|
||||
|
||||
.fa.arrow:before {
|
||||
content: "\f104";
|
||||
}
|
||||
|
||||
.active > a > .fa.arrow:before {
|
||||
content: "\f107";
|
||||
}
|
||||
|
||||
.plus-times {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.fa.plus-times:before {
|
||||
content: "\f067";
|
||||
}
|
||||
|
||||
.active > a > .fa.plus-times {
|
||||
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
|
||||
-webkit-transform: rotate(45deg);
|
||||
-moz-transform: rotate(45deg);
|
||||
-ms-transform: rotate(45deg);
|
||||
-o-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.plus-minus {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.fa.plus-minus:before {
|
||||
content: "\f067";
|
||||
}
|
||||
|
||||
.active > a > .fa.plus-minus:before {
|
||||
content: "\f068";
|
||||
}
|
||||
Vendored
Executable
+120
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* metismenu - v1.1.3
|
||||
* Easy menu jQuery plugin for Twitter Bootstrap 3
|
||||
* https://github.com/onokumus/metisMenu
|
||||
*
|
||||
* Made by Osman Nuri Okumus
|
||||
* Under MIT License
|
||||
*/
|
||||
;(function($, window, document, undefined) {
|
||||
|
||||
var pluginName = "metisMenu",
|
||||
defaults = {
|
||||
toggle: true,
|
||||
doubleTapToGo: false
|
||||
};
|
||||
|
||||
function Plugin(element, options) {
|
||||
this.element = $(element);
|
||||
this.settings = $.extend({}, defaults, options);
|
||||
this._defaults = defaults;
|
||||
this._name = pluginName;
|
||||
this.init();
|
||||
}
|
||||
|
||||
Plugin.prototype = {
|
||||
init: function() {
|
||||
|
||||
var $this = this.element,
|
||||
$toggle = this.settings.toggle,
|
||||
obj = this;
|
||||
|
||||
if (this.isIE() <= 9) {
|
||||
$this.find("li.active").has("ul").children("ul").collapse("show");
|
||||
$this.find("li").not(".active").has("ul").children("ul").collapse("hide");
|
||||
} else {
|
||||
$this.find("li.active").has("ul").children("ul").addClass("collapse in");
|
||||
$this.find("li").not(".active").has("ul").children("ul").addClass("collapse");
|
||||
}
|
||||
|
||||
//add the "doubleTapToGo" class to active items if needed
|
||||
if (obj.settings.doubleTapToGo) {
|
||||
$this.find("li.active").has("ul").children("a").addClass("doubleTapToGo");
|
||||
}
|
||||
|
||||
$this.find("li").has("ul").children("a").on("click" + "." + pluginName, function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
//Do we need to enable the double tap
|
||||
if (obj.settings.doubleTapToGo) {
|
||||
|
||||
//if we hit a second time on the link and the href is valid, navigate to that url
|
||||
if (obj.doubleTapToGo($(this)) && $(this).attr("href") !== "#" && $(this).attr("href") !== "") {
|
||||
e.stopPropagation();
|
||||
document.location = $(this).attr("href");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$(this).parent("li").toggleClass("active").children("ul").collapse("toggle");
|
||||
|
||||
if ($toggle) {
|
||||
$(this).parent("li").siblings().removeClass("active").children("ul.in").collapse("hide");
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
isIE: function() { //https://gist.github.com/padolsey/527683
|
||||
var undef,
|
||||
v = 3,
|
||||
div = document.createElement("div"),
|
||||
all = div.getElementsByTagName("i");
|
||||
|
||||
while (
|
||||
div.innerHTML = "<!--[if gt IE " + (++v) + "]><i></i><![endif]-->",
|
||||
all[0]
|
||||
) {
|
||||
return v > 4 ? v : undef;
|
||||
}
|
||||
},
|
||||
|
||||
//Enable the link on the second click.
|
||||
doubleTapToGo: function(elem) {
|
||||
var $this = this.element;
|
||||
|
||||
//if the class "doubleTapToGo" exists, remove it and return
|
||||
if (elem.hasClass("doubleTapToGo")) {
|
||||
elem.removeClass("doubleTapToGo");
|
||||
return true;
|
||||
}
|
||||
|
||||
//does not exists, add a new class and return false
|
||||
if (elem.parent().children("ul").length) {
|
||||
//first remove all other class
|
||||
$this.find(".doubleTapToGo").removeClass("doubleTapToGo");
|
||||
//add the class on the current element
|
||||
elem.addClass("doubleTapToGo");
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
this.element.off("." + pluginName);
|
||||
this.element.removeData(pluginName);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$.fn[pluginName] = function(options) {
|
||||
this.each(function () {
|
||||
var el = $(this);
|
||||
if (el.data(pluginName)) {
|
||||
el.data(pluginName).remove();
|
||||
}
|
||||
el.data(pluginName, new Plugin(this, options));
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
})(jQuery, window, document);
|
||||
Vendored
Executable
+10
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* metismenu - v1.1.3
|
||||
* Easy menu jQuery plugin for Twitter Bootstrap 3
|
||||
* https://github.com/onokumus/metisMenu
|
||||
*
|
||||
* Made by Osman Nuri Okumus
|
||||
* Under MIT License
|
||||
*/
|
||||
|
||||
.arrow{float:right;line-height:1.42857}.glyphicon.arrow:before{content:"\e079"}.active>a>.glyphicon.arrow:before{content:"\e114"}.fa.arrow:before{content:"\f104"}.active>a>.fa.arrow:before{content:"\f107"}.plus-times{float:right}.fa.plus-times:before{content:"\f067"}.active>a>.fa.plus-times{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.plus-minus{float:right}.fa.plus-minus:before{content:"\f067"}.active>a>.fa.plus-minus:before{content:"\f068"}
|
||||
Vendored
Executable
+9
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* metismenu - v1.1.3
|
||||
* Easy menu jQuery plugin for Twitter Bootstrap 3
|
||||
* https://github.com/onokumus/metisMenu
|
||||
*
|
||||
* Made by Osman Nuri Okumus
|
||||
* Under MIT License
|
||||
*/
|
||||
!function(a,b,c){function d(b,c){this.element=a(b),this.settings=a.extend({},f,c),this._defaults=f,this._name=e,this.init()}var e="metisMenu",f={toggle:!0,doubleTapToGo:!1};d.prototype={init:function(){var b=this.element,d=this.settings.toggle,f=this;this.isIE()<=9?(b.find("li.active").has("ul").children("ul").collapse("show"),b.find("li").not(".active").has("ul").children("ul").collapse("hide")):(b.find("li.active").has("ul").children("ul").addClass("collapse in"),b.find("li").not(".active").has("ul").children("ul").addClass("collapse")),f.settings.doubleTapToGo&&b.find("li.active").has("ul").children("a").addClass("doubleTapToGo"),b.find("li").has("ul").children("a").on("click."+e,function(b){return b.preventDefault(),f.settings.doubleTapToGo&&f.doubleTapToGo(a(this))&&"#"!==a(this).attr("href")&&""!==a(this).attr("href")?(b.stopPropagation(),void(c.location=a(this).attr("href"))):(a(this).parent("li").toggleClass("active").children("ul").collapse("toggle"),void(d&&a(this).parent("li").siblings().removeClass("active").children("ul.in").collapse("hide")))})},isIE:function(){for(var a,b=3,d=c.createElement("div"),e=d.getElementsByTagName("i");d.innerHTML="<!--[if gt IE "+ ++b+"]><i></i><![endif]-->",e[0];)return b>4?b:a},doubleTapToGo:function(a){var b=this.element;return a.hasClass("doubleTapToGo")?(a.removeClass("doubleTapToGo"),!0):a.parent().children("ul").length?(b.find(".doubleTapToGo").removeClass("doubleTapToGo"),a.addClass("doubleTapToGo"),!1):void 0},remove:function(){this.element.off("."+e),this.element.removeData(e)}},a.fn[e]=function(b){return this.each(function(){var c=a(this);c.data(e)&&c.data(e).remove(),c.data(e,new d(this,b))}),this}}(jQuery,window,document);
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "metismenu",
|
||||
"version": "1.1.3",
|
||||
"description": "Easy menu jQuery plugin for Twitter Bootstrap 3",
|
||||
"main": "./dist/metisMenu.js",
|
||||
"scripts": {
|
||||
"test": "grunt travis --verbose"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/onokumus/metisMenu.git"
|
||||
},
|
||||
"keywords": [
|
||||
"twitter",
|
||||
"bootstrap",
|
||||
"twbs",
|
||||
"jquery",
|
||||
"menu",
|
||||
"accordion",
|
||||
"toggle",
|
||||
"metis",
|
||||
"metisMenu"
|
||||
],
|
||||
"author": {
|
||||
"name": "Osman Nuri Okumus",
|
||||
"email": "onokumus@gmail.com",
|
||||
"url": " http://onokumus.com/"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/onokumus/metisMenu/issues"
|
||||
},
|
||||
"homepage": "https://github.com/onokumus/metisMenu",
|
||||
"devDependencies": {
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-contrib-concat": "^0.5.0",
|
||||
"grunt-contrib-cssmin": "^0.10.0",
|
||||
"grunt-contrib-jshint": "^0.10.0",
|
||||
"grunt-contrib-uglify": "^0.6.0"
|
||||
}
|
||||
}
|
||||
Vendored
Executable
+56
@@ -0,0 +1,56 @@
|
||||
.arrow {
|
||||
float: right;
|
||||
line-height: 1.42857;
|
||||
}
|
||||
|
||||
.glyphicon.arrow:before {
|
||||
content: "\e079";
|
||||
}
|
||||
|
||||
.active > a > .glyphicon.arrow:before {
|
||||
content: "\e114";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Require Font-Awesome
|
||||
* http://fortawesome.github.io/Font-Awesome/
|
||||
*/
|
||||
|
||||
|
||||
.fa.arrow:before {
|
||||
content: "\f104";
|
||||
}
|
||||
|
||||
.active > a > .fa.arrow:before {
|
||||
content: "\f107";
|
||||
}
|
||||
|
||||
.plus-times {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.fa.plus-times:before {
|
||||
content: "\f067";
|
||||
}
|
||||
|
||||
.active > a > .fa.plus-times {
|
||||
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
|
||||
-webkit-transform: rotate(45deg);
|
||||
-moz-transform: rotate(45deg);
|
||||
-ms-transform: rotate(45deg);
|
||||
-o-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.plus-minus {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.fa.plus-minus:before {
|
||||
content: "\f067";
|
||||
}
|
||||
|
||||
.active > a > .fa.plus-minus:before {
|
||||
content: "\f068";
|
||||
}
|
||||
Vendored
Executable
+112
@@ -0,0 +1,112 @@
|
||||
;(function($, window, document, undefined) {
|
||||
|
||||
var pluginName = "metisMenu",
|
||||
defaults = {
|
||||
toggle: true,
|
||||
doubleTapToGo: false
|
||||
};
|
||||
|
||||
function Plugin(element, options) {
|
||||
this.element = $(element);
|
||||
this.settings = $.extend({}, defaults, options);
|
||||
this._defaults = defaults;
|
||||
this._name = pluginName;
|
||||
this.init();
|
||||
}
|
||||
|
||||
Plugin.prototype = {
|
||||
init: function() {
|
||||
|
||||
var $this = this.element,
|
||||
$toggle = this.settings.toggle,
|
||||
obj = this;
|
||||
|
||||
if (this.isIE() <= 9) {
|
||||
$this.find("li.active").has("ul").children("ul").collapse("show");
|
||||
$this.find("li").not(".active").has("ul").children("ul").collapse("hide");
|
||||
} else {
|
||||
$this.find("li.active").has("ul").children("ul").addClass("collapse in");
|
||||
$this.find("li").not(".active").has("ul").children("ul").addClass("collapse");
|
||||
}
|
||||
|
||||
//add the "doubleTapToGo" class to active items if needed
|
||||
if (obj.settings.doubleTapToGo) {
|
||||
$this.find("li.active").has("ul").children("a").addClass("doubleTapToGo");
|
||||
}
|
||||
|
||||
$this.find("li").has("ul").children("a").on("click" + "." + pluginName, function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
//Do we need to enable the double tap
|
||||
if (obj.settings.doubleTapToGo) {
|
||||
|
||||
//if we hit a second time on the link and the href is valid, navigate to that url
|
||||
if (obj.doubleTapToGo($(this)) && $(this).attr("href") !== "#" && $(this).attr("href") !== "") {
|
||||
e.stopPropagation();
|
||||
document.location = $(this).attr("href");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$(this).parent("li").toggleClass("active").children("ul").collapse("toggle");
|
||||
|
||||
if ($toggle) {
|
||||
$(this).parent("li").siblings().removeClass("active").children("ul.in").collapse("hide");
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
isIE: function() { //https://gist.github.com/padolsey/527683
|
||||
var undef,
|
||||
v = 3,
|
||||
div = document.createElement("div"),
|
||||
all = div.getElementsByTagName("i");
|
||||
|
||||
while (
|
||||
div.innerHTML = "<!--[if gt IE " + (++v) + "]><i></i><![endif]-->",
|
||||
all[0]
|
||||
) {
|
||||
return v > 4 ? v : undef;
|
||||
}
|
||||
},
|
||||
|
||||
//Enable the link on the second click.
|
||||
doubleTapToGo: function(elem) {
|
||||
var $this = this.element;
|
||||
|
||||
//if the class "doubleTapToGo" exists, remove it and return
|
||||
if (elem.hasClass("doubleTapToGo")) {
|
||||
elem.removeClass("doubleTapToGo");
|
||||
return true;
|
||||
}
|
||||
|
||||
//does not exists, add a new class and return false
|
||||
if (elem.parent().children("ul").length) {
|
||||
//first remove all other class
|
||||
$this.find(".doubleTapToGo").removeClass("doubleTapToGo");
|
||||
//add the class on the current element
|
||||
elem.addClass("doubleTapToGo");
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
this.element.off("." + pluginName);
|
||||
this.element.removeData(pluginName);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$.fn[pluginName] = function(options) {
|
||||
this.each(function () {
|
||||
var el = $(this);
|
||||
if (el.data(pluginName)) {
|
||||
el.data(pluginName).remove();
|
||||
}
|
||||
el.data(pluginName, new Plugin(this, options));
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
})(jQuery, window, document);
|
||||
Reference in New Issue
Block a user