From 83400033a3b7a91ad072a5d306355c9cd5a80d82 Mon Sep 17 00:00:00 2001 From: PliablePixels Date: Fri, 24 Jul 2015 15:48:01 -0400 Subject: integrated event scrubbing with direct image access - need to clean up code --- www/lib/angular-tooltips/.bower.json | 37 +++ www/lib/angular-tooltips/Gruntfile.js | 157 +++++++++ www/lib/angular-tooltips/Readme.md | 210 ++++++++++++ www/lib/angular-tooltips/assets/js/index.js | 21 ++ www/lib/angular-tooltips/bower.json | 27 ++ www/lib/angular-tooltips/config/csslintrc.json | 37 +++ www/lib/angular-tooltips/config/eslint.json | 153 +++++++++ .../angular-tooltips/dist/angular-tooltips.min.css | 1 + .../angular-tooltips/dist/angular-tooltips.min.js | 14 + .../dist/angular-tooltips.sourcemap.map | 1 + www/lib/angular-tooltips/index.html | 122 +++++++ www/lib/angular-tooltips/package.json | 40 +++ www/lib/angular-tooltips/semantic-ui.html | 120 +++++++ .../angular-tooltips/src/css/angular-tooltips.css | 124 +++++++ .../angular-tooltips/src/js/angular-tooltips.js | 357 +++++++++++++++++++++ www/lib/angular-tooltips/twitter-bootstrap.html | 98 ++++++ www/lib/angular-tooltips/views/index.html | 6 + 17 files changed, 1525 insertions(+) create mode 100644 www/lib/angular-tooltips/.bower.json create mode 100644 www/lib/angular-tooltips/Gruntfile.js create mode 100644 www/lib/angular-tooltips/Readme.md create mode 100644 www/lib/angular-tooltips/assets/js/index.js create mode 100644 www/lib/angular-tooltips/bower.json create mode 100644 www/lib/angular-tooltips/config/csslintrc.json create mode 100644 www/lib/angular-tooltips/config/eslint.json create mode 100644 www/lib/angular-tooltips/dist/angular-tooltips.min.css create mode 100644 www/lib/angular-tooltips/dist/angular-tooltips.min.js create mode 100644 www/lib/angular-tooltips/dist/angular-tooltips.sourcemap.map create mode 100644 www/lib/angular-tooltips/index.html create mode 100644 www/lib/angular-tooltips/package.json create mode 100644 www/lib/angular-tooltips/semantic-ui.html create mode 100644 www/lib/angular-tooltips/src/css/angular-tooltips.css create mode 100644 www/lib/angular-tooltips/src/js/angular-tooltips.js create mode 100644 www/lib/angular-tooltips/twitter-bootstrap.html create mode 100644 www/lib/angular-tooltips/views/index.html (limited to 'www/lib/angular-tooltips') diff --git a/www/lib/angular-tooltips/.bower.json b/www/lib/angular-tooltips/.bower.json new file mode 100644 index 00000000..b8170005 --- /dev/null +++ b/www/lib/angular-tooltips/.bower.json @@ -0,0 +1,37 @@ +{ + "name": "angular-tooltips", + "version": "0.1.14", + "description": "A tooltips directive for angularjs.", + "authors": [ + "Filippo Oretti " + ], + "keywords": [ + "tooltip", + "tooltips", + "angularjs" + ], + "main": [ + "./dist/angular-tooltips.min.js", + "./dist/angular-tooltips.min.css" + ], + "license": "MIT", + "homepage": "http://720kb.github.io/angular-tooltips", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "_release": "0.1.14", + "_resolution": { + "type": "version", + "tag": "0.1.14", + "commit": "e2f3358f9bd9f7c94826a684ca749972820040c8" + }, + "_source": "git://github.com/720kb/angular-tooltips.git", + "_target": "~0.1.14", + "_originalSource": "angular-tooltips", + "_direct": true +} diff --git a/www/lib/angular-tooltips/Gruntfile.js b/www/lib/angular-tooltips/Gruntfile.js new file mode 100644 index 00000000..4271aa1b --- /dev/null +++ b/www/lib/angular-tooltips/Gruntfile.js @@ -0,0 +1,157 @@ +/*global module, require*/ +(function setUp(module, require) { + 'use strict'; + + var banner = ['/*!', + ' * Angular Tooltips v<%= pkg.version %>', + ' *', + ' * Released under the MIT license', + ' * www.opensource.org/licenses/MIT', + ' *', + ' * Brought to you by 720kb.net', + ' *', + ' * <%= grunt.template.today("yyyy-mm-dd") %>', + ' */\n\n'].join('\n') + , modRewrite = require('connect-modrewrite'); + + module.exports = function doGrunt(grunt) { + + grunt.initConfig({ + 'pkg': grunt.file.readJSON('package.json'), + 'confs': { + 'dist': 'dist', + 'config': 'config', + 'css': 'src/css', + 'js': 'src/js', + 'serverPort': 8000 + }, + 'csslint': { + 'options': { + 'csslintrc': '<%= confs.config %>/csslintrc.json' + }, + 'strict': { + 'src': [ + '<%= confs.css %>/**/*.css' + ] + } + }, + 'eslint': { + 'options': { + 'config': '<%= confs.config %>/eslint.json' + }, + 'target': [ + 'Gruntfile.js', + '<%= confs.js %>/**/*.js' + ] + }, + 'uglify': { + 'options': { + 'sourceMap': true, + 'sourceMapName': '<%= confs.dist %>/angular-tooltips.sourcemap.map', + 'preserveComments': false, + 'report': 'gzip', + 'banner': banner + }, + 'minifyTarget': { + 'files': { + '<%= confs.dist %>/angular-tooltips.min.js': [ + '<%= confs.js %>/angular-tooltips.js' + ] + } + } + }, + 'cssmin': { + 'options': { + 'report': 'gzip', + 'banner': banner + }, + 'minifyTarget': { + 'files': { + '<%= confs.dist %>/angular-tooltips.min.css': [ + '<%= confs.css %>/angular-tooltips.css' + ] + } + } + }, + 'connect': { + 'server': { + 'options': { + 'port': '<%= confs.serverPort %>', + 'base': '.', + 'keepalive': true, + 'middleware': function manageMiddlewares(connect, options) { + var middlewares = [] + , directory = options.directory || options.base[options.base.length - 1]; + + // enable Angular's HTML5 mode + middlewares.push(modRewrite(['!\\.html|\\.js|\\.svg|\\.css|\\.png|\\.gif$ /index.html [L]'])); + + if (!Array.isArray(options.base)) { + options.base = [options.base]; + } + options.base.forEach(function forEachOption(base) { + // Serve static files. + middlewares.push(connect.static(base)); + }); + + // Make directory browse-able. + middlewares.push(connect.directory(directory)); + + return middlewares; + } + } + } + }, + 'watch': { + 'dev': { + 'files': [ + 'Gruntfile.js', + '<%= confs.css %>/**/*.css', + '<%= confs.js %>/**/*.js' + ], + 'tasks': [ + 'csslint', + 'eslint' + ], + 'options': { + 'spawn': false + } + } + }, + 'concurrent': { + 'dev': { + 'tasks': [ + 'connect:server', + 'watch:dev' + ], + 'options': { + 'limit': '<%= concurrent.dev.tasks.length %>', + 'logConcurrentOutput': true + } + } + } + }); + + grunt.loadNpmTasks('grunt-contrib-csslint'); + grunt.loadNpmTasks('grunt-eslint'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-cssmin'); + + grunt.loadNpmTasks('grunt-concurrent'); + grunt.loadNpmTasks('grunt-contrib-connect'); + grunt.loadNpmTasks('grunt-contrib-watch'); + + grunt.registerTask('default', [ + 'csslint', + 'eslint', + 'concurrent:dev' + ]); + + grunt.registerTask('prod', [ + 'csslint', + 'eslint', + 'cssmin', + 'uglify' + ]); + }; +}(module, require)); diff --git a/www/lib/angular-tooltips/Readme.md b/www/lib/angular-tooltips/Readme.md new file mode 100644 index 00000000..cba42b0f --- /dev/null +++ b/www/lib/angular-tooltips/Readme.md @@ -0,0 +1,210 @@ +Angular Tooltips +================== + +[![Join the chat at https://gitter.im/720kb/angular-tooltips](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/720kb/angular-tooltips?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + + +Angular Tooltips is an angularjs directive that generates a tooltip on your element. + + +The angular tooltips is developed by [720kb](http://720kb.net). + +##Requirements + + +AngularJS v1.2+ + +##Screen +![Angular tooltips](http://i.imgur.com/2rOwAbQ.png) + +###Browser support + + +Chrome ![ok](http://i.imgur.com/CK8qxk1.png) + +Firefox ![ok](http://i.imgur.com/CK8qxk1.png) + +Safari ![ok](http://i.imgur.com/CK8qxk1.png) + +Opera ![ok](http://i.imgur.com/CK8qxk1.png) + +IE ![mmm](http://i.imgur.com/iAIwqCL.png) + + +## Load + +To use the directive, include the angular tooltips's javascript and css files in your web page: + +```html + + + + + + + //..... + + + +``` + +##Install + +###Bower installation + +``` +$ bower install angular-tooltips --save +``` + +_then load the js files in your html_ + +###Add module dependency + +Add the 720kb.tooltips module dependency + +```js +angular.module('app', [ + '720kb.tooltips' + ]); +``` + + +Call the directive wherever you want in your html page + +```html + +Tooltip me + +``` +##Options +Angular tooltips allows you to use some options via `attribute` data + +####Tooltip position +You can set your tooltip to show on `left` or `right` or `top` or `bottom` position +using the `tooltip-side=""` attribute +```html +Tooltip me +Tooltip me +Tooltip me +Tooltip me +``` + +####Tooltip title +You can set your tooltip title (text/html doesn't matter) +using the `tooltip-title=""` attribute or simply via `title=""` html attribute + +```html +Tooltip me +Tooltip me +``` + +####Tooltip content +You can set your tooltip content +using the `tooltip-content=""` attribute + +```html +Tooltip me +``` + +####Tooltip HTML content +You can set your tooltip html content +using the `tooltip-html=""` attribute + +```html +Tooltip me +``` + +####Tooltip size +You can set your tooltip size (small || medium || large) +using the `tooltip-size=""` attribute + +```html +Tooltip me +Tooltip me +Tooltip me +``` +####Tooltip speed +You can set the tooltip transition speed ('fast' || 'medium' || 'slow' || int(milliseconds)) +using the `tooltip-speed=""` attribute + +```html +Tooltip fast +Tooltip medium +Tooltip slow +Tooltip custom +``` +####Tooltip delay +You can set the tooltip transition delay (ms) +using the `tooltip-delay=""` attribute + +```html +Tooltip in 800ms +``` +####Tooltip try +If space is not available for tooltip , it will automatically search for a similar alternative position to show. You can set tooltip try (1 || 0) +using the `tooltip-try=""` attribute + +```html +Tooltip me +Tooltip me +``` +####Tooltip lazy +If you don't want to re-init the tooltip position everytime the tooltip trigger events are fired, you can set tooltip lazy mode (true || false) +using the `tooltip-lazy=""` attribute + +```html + +I will re-init my position everytime the mouseover event is fired + + +I will init my position on mouseover only the first time event is fired + +``` + +####Tooltip triggers +You can set your tooltip to show/hide on specific event/events, you can use the `tooltip-show-trigger=""` and the `tooltip-hide-trigger=""` attribute for this scope +```html +Show tooltip only on click +Hide tooltip only on click +Show tooltip on click and mouseover and hide tooltip only on click +``` + +_**Close button**_ + +If you want to hide on click, you can configure a close button using text or HTML. This allows your users to click the button inside the tooltip instead of clicking on the original trigger. +```html +Show tooltip on click and mouseover and hide tooltip only on click, with option to click on the X +Show tooltip on click and mouseover and hide tooltip only on click, with option to click on HTML button +``` + +####Tooltip CSS class +You can set a custom CSS class or a set of, using the `tooltip-class=""` attribute: +```html + +I will show a tooltip with class="tooltip-custom tooltip-for-me" + +``` + +## Example + +###[Live demo](https://720kb.github.io/angular-tooltips) + +##Theming +You can edit the default Css file `angular-tooltips.css` if you want to make a new theme for the tooltips. + +##Contributing + +We will be much grateful if you help us making this project to grow up. +Feel free to contribute by forking, opening issues, pull requests etc. + +## License + +The MIT License (MIT) + +Copyright (c) 2014 Filippo Oretti, Dario Andrei + +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. diff --git a/www/lib/angular-tooltips/assets/js/index.js b/www/lib/angular-tooltips/assets/js/index.js new file mode 100644 index 00000000..d0809df3 --- /dev/null +++ b/www/lib/angular-tooltips/assets/js/index.js @@ -0,0 +1,21 @@ +/*global angular*/ + +(function withAngular(angular) { + 'use strict'; + + angular.module('720kb', [ + 'ngRoute', + '720kb.tooltips' + ]) + .controller('Ctrl', [ + '$scope', + '$timeout', + function ($scope, $timeout) { + + $scope.items = ['1','2','4','5']; + $timeout(function () { + $scope.items.push('7'); + $scope.items.push('9'); + }, 5000); + }]); +}(angular)); diff --git a/www/lib/angular-tooltips/bower.json b/www/lib/angular-tooltips/bower.json new file mode 100644 index 00000000..e6524656 --- /dev/null +++ b/www/lib/angular-tooltips/bower.json @@ -0,0 +1,27 @@ +{ + "name": "angular-tooltips", + "version": "0.1.14", + "description": "A tooltips directive for angularjs.", + "authors": [ + "Filippo Oretti " + ], + "keywords": [ + "tooltip", + "tooltips", + "angularjs" + ], + "main": [ + "./dist/angular-tooltips.min.js", + "./dist/angular-tooltips.min.css" + ], + "license": "MIT", + "homepage": "http://720kb.github.io/angular-tooltips", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/www/lib/angular-tooltips/config/csslintrc.json b/www/lib/angular-tooltips/config/csslintrc.json new file mode 100644 index 00000000..be56338d --- /dev/null +++ b/www/lib/angular-tooltips/config/csslintrc.json @@ -0,0 +1,37 @@ +{ + "important": true, + "adjoining-classes": false, + "known-properties": false, + "box-sizing": false, + "box-model": false, + "overqualified-elements": false, + "display-property-grouping": false, + "bulletproof-font-face": false, + "compatible-vendor-prefixes": true, + "regex-selectors": false, + "errors": true, + "duplicate-background-images": true, + "duplicate-properties": true, + "empty-rules": true, + "selector-max-approaching": false, + "gradients": true, + "fallback-colors": false, + "font-sizes": false, + "font-faces": false, + "floats": false, + "star-property-hack": false, + "outline-none": false, + "import": true, + "ids": false, + "underscore-property-hack": true, + "rules-count": true, + "qualified-headings": false, + "selector-max": false, + "shorthand": false, + "text-indent": false, + "unique-headings": false, + "universal-selector": false, + "unqualified-attributes": true, + "vendor-prefix": true, + "zero-units": true +} diff --git a/www/lib/angular-tooltips/config/eslint.json b/www/lib/angular-tooltips/config/eslint.json new file mode 100644 index 00000000..27b3ca70 --- /dev/null +++ b/www/lib/angular-tooltips/config/eslint.json @@ -0,0 +1,153 @@ +//http://eslint.org/docs/rules/ +{ + "rules": { + "no-cond-assign": 2, + "no-constant-condition": 2, + "no-comma-dangle": 2, + "no-control-regex": 2, + "no-debugger": 2, + "no-dupe-keys": 2, + "no-empty": 2, + "no-extra-semi": 2, + "no-inner-declarations": 2, + "no-invalid-regexp": 2, + "no-negated-in-lhs": 2, + "no-obj-calls": 2, + "no-regex-spaces": 2, + "no-sparse-arrays": 2, + "no-unreachable": 2, + "use-isnan": 2, + "valid-typeof": 2, + "camelcase": 2, + "eqeqeq": 2, + "no-plusplus": 2, + "no-bitwise": 2, + "block-scoped-var": 2, + "consistent-return": 2, + "curly": [ + 2, + "all" + ], + "default-case": 2, + "dot-notation": 2, + "no-caller": 2, + "no-div-regex": 2, + "no-else-return": 2, + "no-empty-label": 2, + "no-eq-null": 2, + "no-eval": 2, + "no-extend-native": 2, + "no-fallthrough": 2, + "no-floating-decimal": 2, + "no-implied-eval": 2, + "no-labels": 2, + "no-iterator": 2, + "no-lone-blocks": 2, + "no-loop-func": 2, + "no-multi-str": 2, + "no-native-reassign": 2, + "no-new": 2, + "no-new-func": 2, + "no-new-wrappers": 2, + "no-octal": 2, + "no-octal-escape": 2, + "no-proto": 2, + "no-redeclare": 2, + "no-return-assign": 2, + "no-script-url": 2, + "no-self-compare": 2, + "no-sequences": 2, + "no-unused-expressions": 2, + "no-with": 2, + "yoda": 2, + "radix": 2, + "wrap-iife": [ + 2, + "outside" + ], + "global-strict": [2, "never"], + "no-extra-strict": 2, + "strict": 2, + "no-catch-shadow": 2, + "no-delete-var": 2, + "no-label-var": 2, + "no-shadow": 2, + "no-shadow-restricted-names": 2, + "no-undef": 2, + "no-undef-init": 2, + "no-unused-vars": [ + 2, + { + "vars": "all", + "args": "after-used" + } + ], + "no-use-before-define": 2, + "brace-style": [ + 2, + "1tbs" + ], + "consistent-this": [ + 2, + "that" + ], + "new-cap": 2, + "new-parens": 2, + "no-nested-ternary": 2, + "no-array-constructor": 2, + "no-lonely-if": 2, + "no-new-object": 2, + "no-spaced-func": 2, + "no-space-before-semi": 2, + "no-underscore-dangle": 2, + "no-wrap-func": 2, + "quotes": [ + 2, + "single", + "avoid-escape" + ], + "quote-props": 2, + "semi": [ + 2, + "always" + ], + "space-after-keywords": [ + 2, + "always" + ], + "space-in-brackets": [ + 2, + "never" + ], + "space-infix-ops": 2, + "space-return-throw-case": 2, + "space-unary-ops": 2, + "one-var": 2, + "wrap-regex": 2, + + "no-extra-boolean-cast": 1, + "no-console": 1, + "no-alert": 1, + "no-empty-class": 1, + "no-ex-assign": 1, + "no-func-assign": 1, + "valid-jsdoc": 1, + "guard-for-in": 1, + "no-warning-comments": [ + 1, + { + "terms": ["todo", "fixme", "xxx"], + "location": "anywhere" + } + ], + "func-style": [ + 1, + "expression" + ], + "no-extra-parens": 1, + "func-names": 1, + + "no-ternary": 0, + "sort-vars": 0 + } +} diff --git a/www/lib/angular-tooltips/dist/angular-tooltips.min.css b/www/lib/angular-tooltips/dist/angular-tooltips.min.css new file mode 100644 index 00000000..aeaf5ef9 --- /dev/null +++ b/www/lib/angular-tooltips/dist/angular-tooltips.min.css @@ -0,0 +1 @@ +._720kb-tooltip{background:rgba(0,0,0,.8);color:#fff;position:absolute;z-index:9;padding:.4% 1%;opacity:0;visibility:hidden;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;left:-200%;top:0}._720kb-tooltip-title{color:rgba(255,255,255,.95);font-weight:500;width:100%;clear:both}._720kb-tooltip-caret:after,._720kb-tooltip-caret:before{content:'';position:absolute;width:0;height:0}._720kb-tooltip._720kb-tooltip-small{padding:4.5px 10px;font-size:12px}._720kb-tooltip._720kb-tooltip-medium{padding:7px 15px;font-size:13.5px}._720kb-tooltip._720kb-tooltip-large{padding:10px 20px;font-size:14px}._720kb-tooltip._720kb-tooltip-open{visibility:visible;visibility:initial;opacity:1}._720kb-tooltip-caret:before{border:6px solid rgba(0,0,0,.8)}._720kb-tooltip-caret:after{border:5px solid transparent}._720kb-tooltip-left ._720kb-tooltip-caret:after,._720kb-tooltip-left ._720kb-tooltip-caret:before,._720kb-tooltip-right ._720kb-tooltip-caret:after,._720kb-tooltip-right ._720kb-tooltip-caret:before{top:50%;border-top-color:transparent;border-bottom-color:transparent}._720kb-tooltip-left ._720kb-tooltip-caret:before{left:100%;margin-left:0;margin-top:-6px;border-right-width:0}._720kb-tooltip-left ._720kb-tooltip-caret:after{left:100%;margin-left:0;margin-top:-5px;border-right-width:0}._720kb-tooltip-right ._720kb-tooltip-caret:before{left:0;margin-left:-6px;margin-top:-6px;border-left-width:0}._720kb-tooltip-right ._720kb-tooltip-caret:after{left:0;margin-left:-5px;margin-top:-5px;border-left-width:0}._720kb-tooltip-top ._720kb-tooltip-caret:after,._720kb-tooltip-top ._720kb-tooltip-caret:before{left:50%;border-right-color:transparent;border-left-color:transparent;top:100%;border-bottom-width:0}._720kb-tooltip-top ._720kb-tooltip-caret:before{margin-left:-6px;margin-bottom:-6px}._720kb-tooltip-top ._720kb-tooltip-caret:after{margin-left:-5px;margin-bottom:-5px}._720kb-tooltip-bottom ._720kb-tooltip-caret:before{bottom:100%;left:50%;margin-left:-6px;border-right-color:transparent;border-left-color:transparent;border-top-width:0}._720kb-tooltip-bottom ._720kb-tooltip-caret:after{bottom:100%;left:50%;margin-left:-5px;border-right-color:transparent;border-left-color:transparent;border-top-width:0}._720kb-tooltip-close-button{float:right} diff --git a/www/lib/angular-tooltips/dist/angular-tooltips.min.js b/www/lib/angular-tooltips/dist/angular-tooltips.min.js new file mode 100644 index 00000000..53f288fb --- /dev/null +++ b/www/lib/angular-tooltips/dist/angular-tooltips.min.js @@ -0,0 +1,14 @@ +/*! + * Angular Tooltips v0.1.14 + * + * Released under the MIT license + * www.opensource.org/licenses/MIT + * + * Brought to you by 720kb.net + * + * 2015-07-14 + */ + + +!function(a){"use strict";a.module("720kb.tooltips",[]).directive("tooltips",["$window","$compile","$interpolate",function(b,c,d){var e=8,f=9,g=10,h="_720kb-tooltip-",i=d.startSymbol(),j=d.endSymbol();return{restrict:"A",scope:{},link:function(d,k,l){function m(){M&&x||(x=!0,d.initTooltip(G)),I&&d.tooltipTryPosition(),d.showTooltip()}function n(){d.hideTooltip()}function o(){d.hideTooltip(),d.initTooltip(F)}var p,q,r,s,t,u,v,w,x=!1,y=a.element(k[0]),z=a.element(b.document.getElementsByTagName("body")[0]),A=l.tooltipTitle||l.title||"",B=l.tooltipContent||"",C=l.tooltipHtml||"",D=l.tooltipShowTrigger||"mouseover",E=l.tooltipHideTrigger||"mouseleave",F=l.tooltipSide||"top",G=F,H=l.tooltipSize||"medium",I="undefined"!=typeof l.tooltipTry&&null!==l.tooltipTry?d.$eval(l.tooltipTry):!0,J=l.tooltipClass||"",K=(l.tooltipSpeed||"medium").toLowerCase(),L=l.tooltipDelay||0,M="undefined"!=typeof l.tooltipLazy&&null!==l.tooltipLazy?d.$eval(l.tooltipLazy):!0,N="undefined"!=typeof l.tooltipCloseButton&&null!==l.tooltipCloseButton,O=l.tooltipCloseButton||"",P='
';N&&(P=P+' '+O+" "),l.tooltipView&&(P=l.tooltipViewCtrl?P+'
":P+"
"),P=P+'
'+i+"title"+j+"
"+i+"content"+j+C+'
',d.title=A,d.content=B,d.html=C,d.parseSpeed=function(){switch(K){case"fast":K=100;break;case"medium":K=450;break;case"slow":K=800;break;default:K=Number(K)}},p=c(P)(d),p.addClass(J),z.append(p),d.isTooltipEmpty=function(){return d.title||d.content||d.html?void 0:!0},d.initTooltip=function(a){d.isTooltipEmpty()?p.css("visibility","hidden"):(p.css("visibility",""),t=y[0].offsetHeight,u=y[0].offsetWidth,v=d.getRootOffsetTop(y[0],0),w=d.getRootOffsetLeft(y[0],0),q=p[0].offsetHeight,r=p[0].offsetWidth,d.parseSpeed(),d.tooltipPositioning(a))},d.getRootOffsetTop=function(a,b){return a.offsetParent?d.getRootOffsetTop(a.offsetParent,b+a.offsetTop-a.scrollTop):b+a.offsetTop},d.getRootOffsetLeft=function(a,b){return a.offsetParent?d.getRootOffsetLeft(a.offsetParent,b+a.offsetLeft-a.scrollLeft):b+a.offsetLeft},d.bindShowTriggers=function(){y.bind(D,m)},d.bindHideTriggers=function(){y.bind(E,n)},d.clearTriggers=function(){y.unbind(D,m),y.unbind(E,n)},d.bindShowTriggers(),d.showTooltip=function(){p.addClass(h+"open"),p.css("transition","opacity "+K+"ms linear"),L&&p.css("transition-delay",L+"ms"),d.clearTriggers(),d.bindHideTriggers()},d.hideTooltip=function(){p.removeClass(h+"open"),p.css("transition",""),d.clearTriggers(),d.bindShowTriggers()},d.removePosition=function(){p.removeClass(h+"left").removeClass(h+"right").removeClass(h+"top").removeClass(h+"bottom ")},d.tooltipPositioning=function(a){d.removePosition();var b,c;"small"===H?s=e:"medium"===H?s=f:"large"===H&&(s=g),"left"===a&&(b=v+t/2-q/2,c=w-(r+s),p.css("top",b+"px"),p.css("left",c+"px"),p.addClass(h+"left")),"right"===a&&(b=v+t/2-q/2,c=w+u+s,p.css("top",b+"px"),p.css("left",c+"px"),p.addClass(h+"right")),"top"===a&&(b=v-s-q,c=w+u/2-r/2,p.css("top",b+"px"),p.css("left",c+"px"),p.addClass(h+"top")),"bottom"===a&&(b=v+t+s,c=w+u/2-r/2,p.css("top",b+"px"),p.css("left",c+"px"),p.addClass(h+"bottom"))},d.tooltipTryPosition=function(){var a=p[0].offsetHeight,c=p[0].offsetWidth,e=p[0].offsetTop,f=p[0].offsetLeft,g=b.outerWidth,h=b.outerHeight,i=g-(c+f),j=h-(a+e),k=y[0].offsetHeight,l=y[0].offsetWidth,m=y[0].offsetLeft,n=y[0].offsetTop,o=g-(m+l),q=h-(k+n),r={left:f,top:e,bottom:j,right:i},s={left:m,right:o,top:n,bottom:q},t=Object.keys(s).reduce(function(a,b){return s[a]>s[b]?a:b}),u=Object.keys(r).reduce(function(a,b){return r[a] + + + + + + Angularjs Tooltips + + +
+ + + + + + + + diff --git a/www/lib/angular-tooltips/package.json b/www/lib/angular-tooltips/package.json new file mode 100644 index 00000000..4c0fb2d0 --- /dev/null +++ b/www/lib/angular-tooltips/package.json @@ -0,0 +1,40 @@ +{ + "name": "angular-tooltips", + "version": "0.1.14", + "description": "A tooltips directive for angularjs.", + "homepage": "http://720kb.github.io/angular-tooltips", + "main": "dist/angular-tooltips.min.js", + "keywords": [ + "date", + "tooltips", + "input" + ], + "repository": { + "type": "git", + "url": "https://github.com/720kb/angular-tooltips.git" + }, + "license": "MIT", + "devDependencies": { + "connect-modrewrite": "*", + "grunt": "*", + "grunt-concurrent": "*", + "grunt-contrib-connect": "*", + "grunt-contrib-csslint": "*", + "grunt-contrib-cssmin": "*", + "grunt-contrib-uglify": "*", + "grunt-contrib-watch": "*", + "grunt-eslint": "*" + }, + "author": { + "name": "Filippo Oretti", + "email": "filippo.oretti@gmail.com", + "url": "https://github.com/45kb" + }, + "contributors": [ + { + "name": "Dario Andrei", + "email": "wouldgo84@gmail.com", + "url": "https://github.com/wouldgo" + } + ] +} diff --git a/www/lib/angular-tooltips/semantic-ui.html b/www/lib/angular-tooltips/semantic-ui.html new file mode 100644 index 00000000..52eb1825 --- /dev/null +++ b/www/lib/angular-tooltips/semantic-ui.html @@ -0,0 +1,120 @@ + + + + + + + Semantic-UI Tooltips + + +
+
+
+ Small left +
+
+ +
+ Medium left +
+ +
+
+ Large left +
+ +
+
+ Small right +
+
+ +
+ Medium right +
+ +
+ +
+ Large right +
+ + + +
+
+ Small top +
+
+ +
+ Medium top +
+ +
+
+ Large top +
+ +
+
+ Small bottom +
+
+ +
+ Medium bottom +
+ +
+
+ Large bottom +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
posval1val2val3
top111222333
bottom111222333
left111222333
right111222333
+ + + + + + + + + diff --git a/www/lib/angular-tooltips/src/css/angular-tooltips.css b/www/lib/angular-tooltips/src/css/angular-tooltips.css new file mode 100644 index 00000000..6d3f4712 --- /dev/null +++ b/www/lib/angular-tooltips/src/css/angular-tooltips.css @@ -0,0 +1,124 @@ +._720kb-tooltip { + background: rgba(0, 0, 0, 0.8); + color:white; + position:absolute; + z-index:9; + padding:0.4% 1%; + opacity:0; + visibility: hidden; + -webkit-border-radius:3px; + -moz-border-radius:3px; + border-radius:3px; + left: -200%; + top: 0; +} +._720kb-tooltip-title{ + color:rgba(255,255,255,0.95); + font-weight: 500; + width: 100%; + clear:both; +} +._720kb-tooltip._720kb-tooltip-small { + padding:4.5px 10px; + font-size: 12px; +} +._720kb-tooltip._720kb-tooltip-medium { + padding:7px 15px; + font-size: 13.5px; +} +._720kb-tooltip._720kb-tooltip-large { + padding:10px 20px; + font-size: 14px; +} +._720kb-tooltip._720kb-tooltip-open { + visibility: visible; + visibility: initial; + opacity: 1; +} +._720kb-tooltip-caret:before { + content:''; + position: absolute; + width: 0; + height: 0; + border: 6px solid rgba(0, 0, 0, 0.8); +} +._720kb-tooltip-caret:after { + content:''; + position: absolute; + width: 0; + height: 0; + border: 5px solid transparent; +} +._720kb-tooltip-left ._720kb-tooltip-caret:before { + top: 50%; + left: 100%; + margin-left:0; + margin-top: -6px; + border-top-color: transparent; + border-bottom-color: transparent; + border-right-width: 0; +} +._720kb-tooltip-left ._720kb-tooltip-caret:after { + top: 50%; + left: 100%; + margin-left:0; + margin-top: -5px; + border-top-color: transparent; + border-bottom-color: transparent; + border-right-width: 0; +} +._720kb-tooltip-right ._720kb-tooltip-caret:before { + top: 50%; + left:0; + margin-left:-6px; + margin-top: -6px; + border-top-color: transparent; + border-bottom-color: transparent; + border-left-width: 0; +} +._720kb-tooltip-right ._720kb-tooltip-caret:after { + top: 50%; + left:0; + margin-left:-5px; + margin-top: -5px; + border-top-color: transparent; + border-bottom-color: transparent; + border-left-width: 0; +} +._720kb-tooltip-top ._720kb-tooltip-caret:before { + top: 100%; + left: 50%; + margin-left: -6px; + margin-bottom:-6px; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-width: 0; +} +._720kb-tooltip-top ._720kb-tooltip-caret:after { + top: 100%; + left: 50%; + margin-left: -5px; + margin-bottom:-5px; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-width: 0; +} +._720kb-tooltip-bottom ._720kb-tooltip-caret:before { + bottom: 100%; + left: 50%; + margin-left: -6px; + border-right-color: transparent; + border-left-color: transparent; + border-top-width: 0; +} +._720kb-tooltip-bottom ._720kb-tooltip-caret:after { + bottom: 100%; + left: 50%; + margin-left: -5px; + border-right-color: transparent; + border-left-color: transparent; + border-top-width: 0; +} +._720kb-tooltip-close-button { + float: right; +} diff --git a/www/lib/angular-tooltips/src/js/angular-tooltips.js b/www/lib/angular-tooltips/src/js/angular-tooltips.js new file mode 100644 index 00000000..5ad62199 --- /dev/null +++ b/www/lib/angular-tooltips/src/js/angular-tooltips.js @@ -0,0 +1,357 @@ +/*global angular*/ + +(function withAngular(angular) { + 'use strict'; + + angular.module('720kb.tooltips', []) + .directive('tooltips', ['$window', '$compile', '$interpolate', + function manageDirective($window, $compile, $interpolate) { + + var TOOLTIP_SMALL_MARGIN = 8 //px + , TOOLTIP_MEDIUM_MARGIN = 9 //px + , TOOLTIP_LARGE_MARGIN = 10 //px + , CSS_PREFIX = '_720kb-tooltip-' + , INTERPOLATE_START_SYM = $interpolate.startSymbol() + , INTERPOLATE_END_SYM = $interpolate.endSymbol(); + return { + 'restrict': 'A', + 'scope': {}, + 'link': function linkingFunction($scope, element, attr) { + + var initialized = false + , thisElement = angular.element(element[0]) + , body = angular.element($window.document.getElementsByTagName('body')[0]) + , theTooltip + , theTooltipHeight + , theTooltipWidth + , theTooltipMargin //used both for margin top left right bottom + , height + , width + , offsetTop + , offsetLeft + , title = attr.tooltipTitle || attr.title || '' + , content = attr.tooltipContent || '' + , html = attr.tooltipHtml || '' + , showTriggers = attr.tooltipShowTrigger || 'mouseover' + , hideTriggers = attr.tooltipHideTrigger || 'mouseleave' + , originSide = attr.tooltipSide || 'top' + , side = originSide + , size = attr.tooltipSize || 'medium' + , tryPosition = typeof attr.tooltipTry !== 'undefined' && attr.tooltipTry !== null ? $scope.$eval(attr.tooltipTry) : true + , className = attr.tooltipClass || '' + , speed = (attr.tooltipSpeed || 'medium').toLowerCase() + , delay = attr.tooltipDelay || 0 + , lazyMode = typeof attr.tooltipLazy !== 'undefined' && attr.tooltipLazy !== null ? $scope.$eval(attr.tooltipLazy) : true + , hasCloseButton = typeof attr.tooltipCloseButton !== 'undefined' && attr.tooltipCloseButton !== null + , closeButtonContent = attr.tooltipCloseButton || '' + , htmlTemplate = '
'; + + if (hasCloseButton) { + + htmlTemplate = htmlTemplate + ' ' + closeButtonContent + ' '; + } + if (attr.tooltipView) { + if (attr.tooltipViewCtrl) { + + htmlTemplate = htmlTemplate + '
'; + } else { + + htmlTemplate = htmlTemplate + '
'; + } + } + + + htmlTemplate = htmlTemplate + '
' + INTERPOLATE_START_SYM + 'title' + INTERPOLATE_END_SYM + '
' + + INTERPOLATE_START_SYM + 'content' + INTERPOLATE_END_SYM + html + ' ' + + '
'; + + $scope.title = title; + $scope.content = content; + $scope.html = html; + //parse the animation speed of tooltips + $scope.parseSpeed = function parseSpeed () { + + switch (speed) { + case 'fast': + speed = 100; + break; + case 'medium': + speed = 450; + break; + case 'slow': + speed = 800; + break; + default: + speed = Number(speed); + } + }; + //create the tooltip + theTooltip = $compile(htmlTemplate)($scope); + + theTooltip.addClass(className); + + body.append(theTooltip); + + $scope.isTooltipEmpty = function checkEmptyTooltip () { + + if (!$scope.title && !$scope.content && !$scope.html) { + + return true; + } + }; + + $scope.initTooltip = function initTooltip (tooltipSide) { + if (!$scope.isTooltipEmpty()) { + theTooltip.css('visibility', ''); + + height = thisElement[0].offsetHeight; + width = thisElement[0].offsetWidth; + offsetTop = $scope.getRootOffsetTop(thisElement[0], 0); + offsetLeft = $scope.getRootOffsetLeft(thisElement[0], 0); + //get tooltip dimension + theTooltipHeight = theTooltip[0].offsetHeight; + theTooltipWidth = theTooltip[0].offsetWidth; + + $scope.parseSpeed(); + $scope.tooltipPositioning(tooltipSide); + } else { + theTooltip.css('visibility', 'hidden'); + } + }; + + $scope.getRootOffsetTop = function getRootOffsetTop (elem, val){ + + if (!elem.offsetParent){ + + return val + elem.offsetTop; + } + + return $scope.getRootOffsetTop(elem.offsetParent, val + elem.offsetTop - elem.scrollTop); + }; + + $scope.getRootOffsetLeft = function getRootOffsetLeft (elem, val){ + + if (!elem.offsetParent){ + + return val + elem.offsetLeft; + } + + return $scope.getRootOffsetLeft(elem.offsetParent, val + elem.offsetLeft - elem.scrollLeft); + }; + + function onMouseEnterAndMouseOver() { + if (!lazyMode || !initialized) { + + initialized = true; + $scope.initTooltip(side); + } + if (tryPosition) { + + $scope.tooltipTryPosition(); + } + $scope.showTooltip(); + } + + $scope.bindShowTriggers = function() { + thisElement.bind(showTriggers, onMouseEnterAndMouseOver); + }; + + function onMouseLeaveAndMouseOut() { + $scope.hideTooltip(); + } + + $scope.bindHideTriggers = function() { + thisElement.bind(hideTriggers, onMouseLeaveAndMouseOut); + }; + + $scope.clearTriggers = function() { + thisElement.unbind(showTriggers, onMouseEnterAndMouseOver); + thisElement.unbind(hideTriggers, onMouseLeaveAndMouseOut); + }; + + $scope.bindShowTriggers(); + + $scope.showTooltip = function showTooltip () { + theTooltip.addClass(CSS_PREFIX + 'open'); + theTooltip.css('transition', 'opacity ' + speed + 'ms linear'); + + if (delay) { + + theTooltip.css('transition-delay', delay + 'ms' ); + + } + + $scope.clearTriggers(); + $scope.bindHideTriggers(); + }; + + $scope.hideTooltip = function hideTooltip () { + theTooltip.removeClass(CSS_PREFIX + 'open'); + theTooltip.css('transition', ''); + $scope.clearTriggers(); + $scope.bindShowTriggers(); + }; + + $scope.removePosition = function removeTooltipPosition () { + + theTooltip + .removeClass(CSS_PREFIX + 'left') + .removeClass(CSS_PREFIX + 'right') + .removeClass(CSS_PREFIX + 'top') + .removeClass(CSS_PREFIX + 'bottom '); + }; + + $scope.tooltipPositioning = function tooltipPositioning (tooltipSide) { + + $scope.removePosition(); + + var topValue + , leftValue; + + if (size === 'small') { + + theTooltipMargin = TOOLTIP_SMALL_MARGIN; + + } else if (size === 'medium') { + + theTooltipMargin = TOOLTIP_MEDIUM_MARGIN; + + } else if (size === 'large') { + + theTooltipMargin = TOOLTIP_LARGE_MARGIN; + } + + if (tooltipSide === 'left') { + + topValue = offsetTop + height / 2 - theTooltipHeight / 2; + leftValue = offsetLeft - (theTooltipWidth + theTooltipMargin); + + theTooltip.css('top', topValue + 'px'); + theTooltip.css('left', leftValue + 'px'); + theTooltip.addClass(CSS_PREFIX + 'left'); + } + + if (tooltipSide === 'right') { + + topValue = offsetTop + height / 2 - theTooltipHeight / 2; + leftValue = offsetLeft + width + theTooltipMargin; + + theTooltip.css('top', topValue + 'px'); + theTooltip.css('left', leftValue + 'px'); + theTooltip.addClass(CSS_PREFIX + 'right'); + } + + if (tooltipSide === 'top') { + + topValue = offsetTop - theTooltipMargin - theTooltipHeight; + leftValue = offsetLeft + width / 2 - theTooltipWidth / 2; + + theTooltip.css('top', topValue + 'px'); + theTooltip.css('left', leftValue + 'px'); + theTooltip.addClass(CSS_PREFIX + 'top'); + } + + if (tooltipSide === 'bottom') { + + topValue = offsetTop + height + theTooltipMargin; + leftValue = offsetLeft + width / 2 - theTooltipWidth / 2; + theTooltip.css('top', topValue + 'px'); + theTooltip.css('left', leftValue + 'px'); + theTooltip.addClass(CSS_PREFIX + 'bottom'); + } + }; + + $scope.tooltipTryPosition = function tooltipTryPosition () { + + + var theTooltipH = theTooltip[0].offsetHeight + , theTooltipW = theTooltip[0].offsetWidth + , topOffset = theTooltip[0].offsetTop + , leftOffset = theTooltip[0].offsetLeft + , winWidth = $window.outerWidth + , winHeight = $window.outerHeight + , rightOffset = winWidth - (theTooltipW + leftOffset) + , bottomOffset = winHeight - (theTooltipH + topOffset) + //element OFFSETS (not tooltip offsets) + , elmHeight = thisElement[0].offsetHeight + , elmWidth = thisElement[0].offsetWidth + , elmOffsetLeft = thisElement[0].offsetLeft + , elmOffsetTop = thisElement[0].offsetTop + , elmOffsetRight = winWidth - (elmOffsetLeft + elmWidth) + , elmOffsetBottom = winHeight - (elmHeight + elmOffsetTop) + , offsets = { + 'left': leftOffset, + 'top': topOffset, + 'bottom': bottomOffset, + 'right': rightOffset + } + , posix = { + 'left': elmOffsetLeft, + 'right': elmOffsetRight, + 'top': elmOffsetTop, + 'bottom': elmOffsetBottom + } + , bestPosition = Object.keys(posix).reduce(function (best, key) { + + return posix[best] > posix[key] ? best : key; + }) + , worstOffset = Object.keys(offsets).reduce(function (worst, key) { + + return offsets[worst] < offsets[key] ? worst : key; + }); + + if (originSide !== bestPosition && offsets[worstOffset] < 20) { + + side = bestPosition; + + $scope.tooltipPositioning(side); + $scope.initTooltip(bestPosition); + } + }; + + function onResize() { + $scope.hideTooltip(); + $scope.initTooltip(originSide); + } + + angular.element($window).bind('resize', onResize); + + // destroy the tooltip when the directive is destroyed + // unbind all dom event handlers + $scope.$on('$destroy', function() { + angular.element($window).unbind('resize', onResize); + $scope.clearTriggers(); + theTooltip.remove(); + }); + + if (attr.tooltipTitle) { + attr.$observe('tooltipTitle', function(val) { + $scope.title = val; + $scope.initTooltip(side); + }); + } + + if (attr.title) { + attr.$observe('title', function(val) { + $scope.title = val; + $scope.initTooltip(side); + }); + } + + if (attr.tooltipContent) { + attr.$observe('tooltipContent', function(val) { + $scope.content = val; + $scope.initTooltip(side); + }); + } + + if (attr.tooltipHtml) { + attr.$observe('tooltipHtml', function(val) { + $scope.html = val; + $scope.initTooltip(side); + }); + } + } + }; + }]); +}(angular)); diff --git a/www/lib/angular-tooltips/twitter-bootstrap.html b/www/lib/angular-tooltips/twitter-bootstrap.html new file mode 100644 index 00000000..ac54d69d --- /dev/null +++ b/www/lib/angular-tooltips/twitter-bootstrap.html @@ -0,0 +1,98 @@ + + + + + + + Angularjs Tooltips + + +
+
+ + + + + + + diff --git a/www/lib/angular-tooltips/views/index.html b/www/lib/angular-tooltips/views/index.html new file mode 100644 index 00000000..8efcf770 --- /dev/null +++ b/www/lib/angular-tooltips/views/index.html @@ -0,0 +1,6 @@ +

+Hello view.html +

+
+{{$index}} +
-- cgit v1.2.3