diff --git a/src/static/jquery-svg3dtagcloud-plugin-master/LICENSE b/src/static/jquery-svg3dtagcloud-plugin-master/LICENSE deleted file mode 100644 index 9b0c25a..0000000 --- a/src/static/jquery-svg3dtagcloud-plugin-master/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Niklas - -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/src/static/jquery-svg3dtagcloud-plugin-master/README.md b/src/static/jquery-svg3dtagcloud-plugin-master/README.md deleted file mode 100644 index aee41c6..0000000 --- a/src/static/jquery-svg3dtagcloud-plugin-master/README.md +++ /dev/null @@ -1,270 +0,0 @@ -# SVG 3D Tag Cloud jQuery plugin -(jquery-svg3dtagcloud-plugin) - -## Preview - -![Alt text](https://user-images.githubusercontent.com/10435486/31490134-3dc7ef7a-af43-11e7-8acf-4e2c6aca3721.png "Preview") - -## Description - -A very small and CSS-less jQuery plugin for drawing a 3D, interactive, SVG based and fully customizable sphere tag cloud from an array of html links. - -## Examples - -### JSFiddle - -* - -### More Examples - -* -* -* -* - -## Installation - -Coming soon. - -## Example Usage - -### HTML - -```html - - - - -``` - -### Define entries (text tags): -```js -var entries = [ - - { label: 'Dev Blog', url: 'http://niklasknaack.blogspot.de/', target: '_top' }, - { label: 'Flashforum', url: 'http://www.flashforum.de/', target: '_top' }, - { label: 'jQueryScript.net', url: 'http://www.jqueryscript.net/', target: '_top' }, - { label: 'Javascript-Forum', url: 'http://forum.jswelt.de/', target: '_top' }, - { label: 'JSFiddle', url: 'https://jsfiddle.net/user/NiklasKnaack/fiddles/', target: '_top' }, - { label: 'CodePen', url: 'http://codepen.io/', target: '_top' }, - { label: 'three.js', url: 'http://threejs.org/', target: '_top' }, - { label: 'WebGLStudio.js', url: 'http://webglstudio.org/', target: '_top' }, - { label: 'JS Compress', url: 'http://jscompress.com/', target: '_top' }, - { label: 'TinyPNG', url: 'https://tinypng.com/', target: '_top' }, - { label: 'Can I Use', url: 'http://caniuse.com/', target: '_top' }, - { label: 'URL shortener', url: 'https://goo.gl/', target: '_top' }, - { label: 'HTML Encoder', url: 'http://www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/Encode.aspx', target: '_top' }, - { label: 'Twitter', url: 'https://twitter.com/niklaswebdev', target: '_top' }, - { label: 'deviantART', url: 'http://nkunited.deviantart.com/', target: '_top' }, - { label: 'Gulp', url: 'http://gulpjs.com/', target: '_top' }, - { label: 'Browsersync', url: 'https://www.browsersync.io/', target: '_top' }, - { label: 'GitHub', url: 'https://github.com/', target: '_top' }, - { label: 'Shadertoy', url: 'https://www.shadertoy.com/', target: '_top' }, - { label: 'Starling', url: 'http://gamua.com/starling/', target: '_top' }, - { label: 'jsPerf', url: 'http://jsperf.com/', target: '_top' }, - { label: 'Foundation', url: 'http://foundation.zurb.com/', target: '_top' }, - { label: 'CreateJS', url: 'http://createjs.com/', target: '_top' }, - { label: 'Velocity.js', url: 'http://julian.com/research/velocity/', target: '_top' }, - { label: 'TweenLite', url: 'https://greensock.com/docs/#/HTML5/GSAP/TweenLite/', target: '_top' }, - { label: 'jQuery', url: 'https://jquery.com/', target: '_top' }, - { label: 'jQuery Rain', url: 'http://www.jqueryrain.com/', target: '_top' }, - { label: 'jQuery Plugins', url: 'http://jquery-plugins.net/', target: '_top' }, - -]; -``` - -### Define entries (text tags with tooltips): -```js -var entries = [ - - { label: 'Dev Blog', url: 'http://niklasknaack.blogspot.de/', target: '_top', tooltip: 'Lorem ipsum' }, - { label: 'Flashforum', url: 'http://www.flashforum.de/', target: '_top', tooltip: 'Dolor sit amet' }, - { label: 'jQueryScript.net', url: 'http://www.jqueryscript.net/', target: '_top', tooltip: 'Consetetur sadipscing' }, - { label: 'Javascript-Forum', url: 'http://forum.jswelt.de/', target: '_top', tooltip: 'Sed diam' }, - { label: 'JSFiddle', url: 'https://jsfiddle.net/user/NiklasKnaack/fiddles/', target: '_top' }, - { label: 'CodePen', url: 'http://codepen.io/', target: '_top', tooltip: 'At vero' }, - { label: 'three.js', url: 'http://threejs.org/', target: '_top', tooltip: 'Nonumy eirmod' }, - { label: 'WebGLStudio.js', url: 'http://webglstudio.org/', target: '_top', tooltip: 'Stet clita' }, - { label: 'JS Compress', url: 'http://jscompress.com/', target: '_top', tooltip: 'Justo duo' }, - { label: 'TinyPNG', url: 'https://tinypng.com/', target: '_top', tooltip: 'Ut wisi enim' }, - { label: 'Can I Use', url: 'http://caniuse.com/', target: '_top', tooltip: 'Minim veniam' }, - { label: 'URL shortener', url: 'https://goo.gl/', target: '_top', tooltip: 'Quis nostrud' }, - { label: 'HTML Encoder', url: 'http://www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/Encode.aspx', target: '_top' }, - { label: 'Twitter', url: 'https://twitter.com/niklaswebdev', target: '_top', tooltip: 'Veniam isictus' }, - { label: 'deviantART', url: 'http://nkunited.deviantart.com/', target: '_top', tooltip: 'Autem insto' }, - { label: 'Gulp', url: 'http://gulpjs.com/', target: '_top', tooltip: 'Officia dolor' }, - { label: 'Browsersync', url: 'https://www.browsersync.io/', target: '_top', tooltip: 'Digi tal' }, - { label: 'GitHub', url: 'https://github.com/', target: '_top', tooltip: 'Amet et quam' }, - { label: 'Shadertoy', url: 'https://www.shadertoy.com/', target: '_top', tooltip: 'Meno equox' }, - { label: 'Starling', url: 'http://gamua.com/starling/', target: '_top', tooltip: 'Duis autem' }, - { label: 'jsPerf', url: 'http://jsperf.com/', target: '_top', tooltip: 'Soluta nobis' }, - { label: 'Foundation', url: 'http://foundation.zurb.com/', target: '_top', tooltip: 'Blandit praesent' }, - { label: 'CreateJS', url: 'http://createjs.com/', target: '_top', tooltip: 'Dignissim qui' }, - { label: 'Velocity.js', url: 'http://julian.com/research/velocity/', target: '_top', tooltip: 'Et iusto odio' }, - { label: 'TweenLite', url: 'https://greensock.com/docs/#/HTML5/GSAP/TweenLite/', target: '_top', tooltip: 'Facilisis at vero' }, - { label: 'jQuery', url: 'https://jquery.com/', target: '_top', tooltip: 'Dolore eu' }, - { label: 'jQuery Rain', url: 'http://www.jqueryrain.com/', target: '_top', tooltip: 'In vulputate' }, - { label: 'jQuery Plugins', url: 'http://jquery-plugins.net/', target: '_top', tooltip: 'In vulputate' } - -]; -``` - -### Define entries (image tags): -```js -var entries = [ - - { image: './img/Basket.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Briefcase.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Brush.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Calendar.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Camera.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Cassette.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Clock.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Cloud_Download.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Cloud_Upload.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Coffee.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Comments.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Credit_Card.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Diary.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Document.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Envelope.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Eraser.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/File_Browser.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Games.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Headphones.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Heart.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Home.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/ID.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/iPod.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Key.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Location.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Location_Map.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Map.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Megaphone.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Message.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Microphone.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Mobile.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Money.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Padlock.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Pencil.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Photo.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Polaroid.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Printer.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Record.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Save.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Scissors.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Spanner.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Toolbox.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' }, - { image: './img/Umbrella.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top' } - -]; -``` - -### Define entries (image tags with tooltips): -```js -var entries = [ - - { image: './img/Basket.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Lorem ipsum' }, - { image: './img/Briefcase.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Dolor sit amet' }, - { image: './img/Brush.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Consetetur sadipscing' }, - { image: './img/Calendar.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Sed diam' }, - { image: './img/Camera.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'At vero' }, - { image: './img/Cassette.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Nonumy eirmod' }, - { image: './img/Clock.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Stet clita' }, - { image: './img/Cloud_Download.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Justo duo' }, - { image: './img/Cloud_Upload.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Ut wisi enim' }, - { image: './img/Coffee.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Minim veniam' }, - { image: './img/Comments.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Quis nostrud' }, - { image: './img/Credit_Card.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Exerci tation' }, - { image: './img/Diary.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Duis autem' }, - { image: './img/Document.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Vel eum iriure' }, - { image: './img/Envelope.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Dolor in hendrerit' }, - { image: './img/Eraser.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'In vulputate' }, - { image: './img/File_Browser.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Velit esse' }, - { image: './img/Games.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Molestie consequat' }, - { image: './img/Headphones.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Vel illum' }, - { image: './img/Heart.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Dolore eu' }, - { image: './img/Home.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Feugiat nulla' }, - { image: './img/ID.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Facilisis at vero' }, - { image: './img/iPod.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Eros et accumsa' }, - { image: './img/Key.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Et iusto odio' }, - { image: './img/Location.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Dignissim qui' }, - { image: './img/Location_Map.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Blandit praesent' }, - { image: './img/Map.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Nam liber' }, - { image: './img/Megaphone.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Soluta nobis' }, - { image: './img/Message.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Magna aliquam' }, - { image: './img/Microphone.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Duis autem' }, - { image: './img/Mobile.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Lori novis' }, - { image: './img/Money.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Meno eqiam' }, - { image: './img/Padlock.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Meno equox' }, - { image: './img/Pencil.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Iri orem' }, - { image: './img/Photo.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Orel pas' }, - { image: './img/Polaroid.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Psi sit' }, - { image: './img/Printer.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Amet et quam' }, - { image: './img/Record.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Molare cons' }, - { image: './img/Save.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Digi tal' }, - { image: './img/Scissors.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Felenope liber' }, - { image: './img/Spanner.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Officia dolor' }, - { image: './img/Toolbox.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Autem insto' }, - { image: './img/Umbrella.png', width: '50', height: '50', url: 'http://niklasknaack.de/', target: '_top', tooltip: 'Veniam isictus' } - -]; - -``` - -### Define settings: -```js -var settings = { - - entries: entries, - width: 480, - height: 480, - radius: '65%', - radiusMin: 75, - bgDraw: true, - bgColor: '#111', - opacityOver: 1.00, - opacityOut: 0.05, - opacitySpeed: 6, - fov: 800, - speed: 2, - fontFamily: 'Oswald, Arial, sans-serif', - fontSize: '15', - fontColor: '#fff', - fontWeight: 'normal',//bold - fontStyle: 'normal',//italic - fontStretch: 'normal',//wider, narrower, ultra-condensed, extra-condensed, condensed, semi-condensed, semi-expanded, expanded, extra-expanded, ultra-expanded - fontToUpperCase: true, - tooltipFontFamily: 'Oswald, Arial, sans-serif', - tooltipFontSize: '11', - tooltipFontColor: '#fff', - tooltipFontWeight: 'normal',//bold - tooltipFontStyle: 'normal',//italic - tooltipFontStretch: 'normal',//wider, narrower, ultra-condensed, extra-condensed, condensed, semi-condensed, semi-expanded, expanded, extra-expanded, ultra-expanded - tooltipFontToUpperCase: false, - tooltipTextAnchor: 'left', - tooltipDiffX: 0, - tooltipDiffY: 10 - -}; -``` - -### jQuery: - -```js -$( '#holder' ).svg3DTagCloud( settings ); -``` - -### JS: - -```js -var svg3DTagCloud = new SVG3DTagCloud( document.getElementById( 'holder' ), settings ); -``` - -## License - -This plugin is available under [the MIT license](http://mths.be/mit). - -## Author - -_– [Niklas](http://niklasknaack.de/)_ \ No newline at end of file diff --git a/src/static/jquery-svg3dtagcloud-plugin-master/example1.html b/src/static/jquery-svg3dtagcloud-plugin-master/example1.html deleted file mode 100644 index 69cc8b3..0000000 --- a/src/static/jquery-svg3dtagcloud-plugin-master/example1.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - SVG3DTagCloud - Example 1 - - - - - - - - - - - - - -
- - \ No newline at end of file diff --git a/src/static/jquery-svg3dtagcloud-plugin-master/example2.html b/src/static/jquery-svg3dtagcloud-plugin-master/example2.html deleted file mode 100644 index d0750be..0000000 --- a/src/static/jquery-svg3dtagcloud-plugin-master/example2.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - SVG3DTagCloud - Example 2 - - - - - - - - - - - - - -
- - \ No newline at end of file diff --git a/src/static/jquery-svg3dtagcloud-plugin-master/example3.html b/src/static/jquery-svg3dtagcloud-plugin-master/example3.html deleted file mode 100644 index 99df981..0000000 --- a/src/static/jquery-svg3dtagcloud-plugin-master/example3.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - SVG3DTagCloud - Example 3 - - - - - - - - - - - - - -
- - \ No newline at end of file diff --git a/src/static/jquery-svg3dtagcloud-plugin-master/example4.html b/src/static/jquery-svg3dtagcloud-plugin-master/example4.html deleted file mode 100644 index c7d519e..0000000 --- a/src/static/jquery-svg3dtagcloud-plugin-master/example4.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - SVG3DTagCloud - Example 4 - - - - - - - - - - - - - -
- - \ No newline at end of file diff --git a/src/static/jquery-svg3dtagcloud-plugin-master/js/jquery.svg3dtagcloud.js b/src/static/jquery-svg3dtagcloud-plugin-master/js/jquery.svg3dtagcloud.js deleted file mode 100644 index 9885a4a..0000000 --- a/src/static/jquery-svg3dtagcloud-plugin-master/js/jquery.svg3dtagcloud.js +++ /dev/null @@ -1,671 +0,0 @@ -/* -Copyright (c) 2017 Niklas Knaack - -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. -*/ - -( function() { - - function SVG3DTagCloud( element, params ) { - - var settings = { - - entries: [], - width: 480, - height: 480, - radius: '70%', - radiusMin: 75, - bgDraw: true, - bgColor: '#000', - opacityOver: 1.00, - opacityOut: 0.05, - opacitySpeed: 6, - fov: 800, - speed: 2, - fontFamily: 'Arial, sans-serif', - fontSize: '15', - hoverFontSize:'25', - fontColor: '#fff', - fontWeight: 'normal',//bold - fontStyle: 'normal',//italic - fontStretch: 'normal',//wider, narrower, ultra-condensed, extra-condensed, condensed, semi-condensed, semi-expanded, expanded, extra-expanded, ultra-expanded - fontToUpperCase: false, - tooltipFontFamily: 'Arial, sans-serif', - tooltipFontSize: '15', - tooltipFontColor: '#fff', - tooltipFontWeight: 'normal',//bold - tooltipFontStyle: 'normal',//italic - tooltipFontStretch: 'normal',//wider, narrower, ultra-condensed, extra-condensed, condensed, semi-condensed, semi-expanded, expanded, extra-expanded, ultra-expanded - tooltipFontToUpperCase: false, - tooltipTextAnchor: 'left', - tooltipDiffX: 0, - tooltipDiffY: 10 - - }; - - //--- - - if ( params !== undefined ) - for ( var prop in params ) - if ( params.hasOwnProperty( prop ) && settings.hasOwnProperty( prop ) ) - settings[ prop ] = params[ prop ]; - - //--- - - if ( !settings.entries.length ) - return false; - - //--- - - var entryHolder = []; - var tooltip; - - var radius; - var diameter; - - var mouseReact = true; - var mousePos = { x: 0, y: 0 }; - - var center2D; - var center3D = { x: 0, y: 0, z: 0 }; - - var speed = { x: 0, y: 0 }; - - var position = { sx: 0, cx: 0, sy: 0, cy: 0 }; - - var MATHPI180 = Math.PI / 180; - - var svg; - var svgNS = 'http://www.w3.org/2000/svg'; - - var bg; - - //--- - - function init() { - - svg = document.createElementNS( svgNS, 'svg' ); - svg.addEventListener( 'mousemove', mouseMoveHandler ); - - element.appendChild( svg ); - - if ( settings.bgDraw ) { - - bg = document.createElementNS( svgNS, 'rect' ); - bg.setAttribute( 'x', 0 ); - bg.setAttribute( 'y', 0 ); - bg.setAttribute( 'fill', settings.bgColor ); - - svg.appendChild( bg ); - - } - - //--- - - addEntries(); - reInit(); - animloop(); - //--- - - window.addEventListener( 'resize', resizeHandler ); - - }; - - function reInit() { - - var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; - var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; - - var svgWidth = windowWidth; - var svgHeight = windowHeight; - - if ( settings.width.toString().indexOf( '%' ) > 0 || settings.height.toString().indexOf( '%' ) > 0 ) { - - svgWidth = Math.round( element.offsetWidth / 100 * parseInt( settings.width ) ); - svgHeight = Math.round( svgWidth / 100 * parseInt( settings.height ) ); - - } else { - - svgWidth = parseInt( settings.width ); - svgHeight = parseInt( settings.height ); - - } - - if ( windowWidth <= svgWidth ) - svgWidth = windowWidth; - - if ( windowHeight <= svgHeight ) - svgHeight = windowHeight; - - //--- - - center2D = { x: svgWidth / 2, y: svgHeight / 2 }; - - speed.x = settings.speed / center2D.x; - speed.y = settings.speed / center2D.y; - - if ( svgWidth >= svgHeight ) - diameter = svgHeight / 100 * parseInt( settings.radius ); - else - diameter = svgWidth / 100 * parseInt( settings.radius ); - - if ( diameter < 1 ) - diameter = 1; - - radius = diameter / 2; - - if ( radius < settings.radiusMin ) { - - radius = settings.radiusMin; - diameter = radius * 2; - - } - - //--- - - svg.setAttribute( 'width', svgWidth ); - svg.setAttribute( 'height', svgHeight ); - - if ( settings.bgDraw ) { - - bg.setAttribute( 'width', svgWidth ); - bg.setAttribute( 'height', svgHeight ); - - } - - //--- - - setEntryPositions( radius ); - - }; - - //--- - - function setEntryPositions( radius ) { - - for ( var i = 0, l = entryHolder.length; i < l; i++ ) { - - setEntryPosition( entryHolder[ i ], radius ); - - } - - }; - - function setEntryPosition( entry, radius ) { - - var dx = entry.vectorPosition.x - center3D.x; - var dy = entry.vectorPosition.y - center3D.y; - var dz = entry.vectorPosition.z - center3D.z; - - var length = Math.sqrt( dx * dx + dy * dy + dz * dz ); - - entry.vectorPosition.x /= length; - entry.vectorPosition.y /= length; - entry.vectorPosition.z /= length; - - entry.vectorPosition.x *= radius; - entry.vectorPosition.y *= radius; - entry.vectorPosition.z *= radius; - - }; - - function addEntry( index, entryObj, x, y, z ) { - - var entry = {}; - - if ( typeof entryObj.label != 'undefined' ) { - - entry.element = document.createElementNS( svgNS, 'text' ); - entry.element.setAttribute( 'x', 0 ); - entry.element.setAttribute( 'y', 0 ); - entry.element.setAttribute( 'fill', settings.fontColor ); - entry.element.setAttribute( 'font-family', settings.fontFamily ); - entry.element.setAttribute( 'font-size', settings.fontSize ); - entry.element.setAttribute( 'font-weight', settings.fontWeight ); - entry.element.setAttribute( 'font-style', settings.fontStyle ); - entry.element.setAttribute( 'font-stretch', settings.fontStretch ); - entry.element.setAttribute( 'text-anchor', 'middle' ); - entry.element.textContent = settings.fontToUpperCase ? entryObj.label.toUpperCase() : entryObj.label; - - } else if ( typeof entryObj.image != 'undefined' ) { - - entry.element = document.createElementNS( svgNS, 'image' ); - entry.element.setAttribute( 'x', 0 ); - entry.element.setAttribute( 'y', 0 ); - entry.element.setAttribute( 'width', entryObj.width ); - entry.element.setAttribute( 'height', entryObj.height ); - entry.element.setAttribute( 'id', 'image_' + index ); - entry.element.setAttributeNS( 'http://www.w3.org/1999/xlink','href', entryObj.image ); - - entry.diffX = entryObj.width / 2; - entry.diffY = entryObj.height / 2; - - } - - entry.link = document.createElementNS( svgNS, 'a' ); - entry.link.setAttributeNS( 'http://www.w3.org/1999/xlink', 'xlink:href', entryObj.url ); - entry.link.setAttribute( 'target', entryObj.target ); - entry.link.setAttribute( 'data-uid', entryObj.uid ); - entry.link.setAttribute( 'data-role', entryObj.role ); - entry.link.setAttribute( 'data-index', index ); - // entry.link.addEventListener( 'mouseover', mouseOverHandler, true ); - // entry.link.addEventListener( 'mouseout', mouseOutHandler, true ); - entry.link.appendChild( entry.element ); - - if ( typeof entryObj.tooltip != 'undefined' ) { - - entry.tooltip = true; - entry.tooltipLabel = settings.tooltipFontToUpperCase ? entryObj.tooltip.toUpperCase() : entryObj.tooltip;; - - } else { - - entry.tooltip = false; - - } - - entry.index = index; - entry.uid = entryObj.uid; - entry.mouseOver = false; - - entry.vectorPosition = { x:x, y:y, z:z }; - entry.vector2D = { x:0, y:0 }; - - svg.appendChild( entry.link ); - - return entry; - - }; - - function addEntries() { - - var tooltip = false; - - for ( var i = 1, l = settings.entries.length + 1; i < l; i++ ) { - - var phi = Math.acos( -1 + ( 2 * i ) / l ); - var theta = Math.sqrt( l * Math.PI ) * phi; - - var x = Math.cos( theta ) * Math.sin( phi ); - var y = Math.sin( theta ) * Math.sin( phi ); - var z = Math.cos( phi ); - - var entry = addEntry( i - 1, settings.entries[ i - 1 ], x, y, z ); - - entryHolder.push( entry ); - - if ( typeof settings.entries[ i - 1 ].tooltip != 'undefined' ) { - - tooltip = true; - - } - - } - - if ( tooltip ) { - - addTooltip(); - - } - - }; - - function addTooltip() { - - tooltip = document.createElementNS( svgNS, 'text' ); - tooltip.setAttribute( 'x', 0 ); - tooltip.setAttribute( 'y', 0 ); - tooltip.setAttribute( 'fill', settings.tooltipFontColor ); - tooltip.setAttribute( 'font-family', settings.tooltipFontFamily ); - tooltip.setAttribute( 'font-size', settings.tooltipFontSize ); - tooltip.setAttribute( 'font-weight', settings.tooltipFontWeight ); - tooltip.setAttribute( 'font-style', settings.tooltipFontStyle ); - tooltip.setAttribute( 'font-stretch', settings.tooltipFontStretch ); - tooltip.setAttribute( 'text-anchor', settings.tooltipTextAnchor ); - tooltip.textContent = ''; - - svg.appendChild( tooltip ); - - }; - - function getEntryByElement( element ) { - - for ( var i = 0, l = entryHolder.length; i < l; i++ ) { - - var entry = entryHolder[ i ]; - - if ( entry.element.getAttribute( 'x' ) === element.getAttribute( 'x' ) && - entry.element.getAttribute( 'y' ) === element.getAttribute( 'y' ) ) { - - return entry; - - } - - } - - return; - - }; - - function highlightEntry( entry ) { - // debugger - for ( var i = 0, l = entryHolder.length; i < l; i++ ) { - - var e = entryHolder[ i ]; - - if ( e.index === entry.index ) { - - e.mouseOver = true; - - } else { - - e.mouseOver = false; - - } - - } - - }; - - //--- - - function showTooltip( entry ) { - - if ( entry.tooltip ) { - - tooltip.setAttribute( 'x', entry.vector2D.x - settings.tooltipDiffX ); - tooltip.setAttribute( 'y', entry.vector2D.y - settings.tooltipDiffY ); - - tooltip.textContent = settings.tooltipFontToUpperCase ? entry.tooltipLabel.toUpperCase() : entry.tooltipLabel; - - tooltip.setAttribute( 'opacity', 1.0 ); - - } - - }; - - function hideTooltip( entry ) { - - tooltip.setAttribute( 'opacity', 0.0 ); - - }; - - //--- - - function render() { - - var fx = speed.x * mousePos.x - settings.speed; - var fy = settings.speed - speed.y * mousePos.y; - - var angleX = fx * MATHPI180; - var angleY = fy * MATHPI180; - - position.sx = Math.sin( angleX ); - position.cx = Math.cos( angleX ); - position.sy = Math.sin( angleY ); - position.cy = Math.cos( angleY ); - - //--- - - for ( var i = 0, l = entryHolder.length; i < l; i++ ) { - - var entry = entryHolder[ i ]; - - //--- - - if ( mouseReact ) { - - var rx = entry.vectorPosition.x; - var rz = entry.vectorPosition.y * position.sy + entry.vectorPosition.z * position.cy; - - entry.vectorPosition.x = rx * position.cx + rz * position.sx; - entry.vectorPosition.y = entry.vectorPosition.y * position.cy + entry.vectorPosition.z * -position.sy; - entry.vectorPosition.z = rx * -position.sx + rz * position.cx; - - } - - //--- - - var scale = settings.fov / ( settings.fov + entry.vectorPosition.z ); - - entry.vector2D.x = entry.vectorPosition.x * scale + center2D.x; - entry.vector2D.y = entry.vectorPosition.y * scale + center2D.y; - - //--- - - if ( entry.diffX && entry.diffY ) { - - entry.vector2D.x -= entry.diffX; - entry.vector2D.y -= entry.diffY; - - } - - //--- - - entry.element.setAttribute( 'x', entry.vector2D.x ); - entry.element.setAttribute( 'y', entry.vector2D.y ); - - //--- - - var opacity,fontSize = settings.fontSize; - if ( mouseReact ) { - - opacity = ( radius - entry.vectorPosition.z ) / diameter; - - if ( opacity < settings.opacityOut ) { - - opacity = settings.opacityOut; - - } - fontSize = settings.fontSize; - - } else { - opacity = parseFloat( entry.element.getAttribute( 'opacity' ) ); - fontSize = parseFloat( entry.element.getAttribute( 'font-size' ) ); - if ( entry.mouseOver ) { - opacity += ( settings.opacityOver - opacity ) / settings.opacitySpeed; - fontSize = settings.hoverFontSize; - } else { - opacity += ( settings.opacityOut - opacity ) / settings.opacitySpeed; - fontSize = settings.fontSize; - - } - - } - entry.element.setAttribute( 'font-size', fontSize); - entry.element.setAttribute( 'opacity', opacity ); - - } - - //--- - - entryHolder = entryHolder.sort( function( a, b ) { - - return ( b.vectorPosition.z - a.vectorPosition.z ); - - } ); - - }; - - //--- - - window.requestAnimFrame = ( function() { - - return window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.mozRequestAnimationFrame || - function( callback ) { - window.setTimeout( callback, 1000 / 60 ); - }; - - } )(); - - function animloop() { - - requestAnimFrame( animloop ); - - render(); - - }; - - //--- - - function mouseOverHandler( event ) { - - mouseReact = false; - - //--- - - var entry = getEntryByElement( event.target ); - console.log(entry) - - highlightEntry( entry ); - - if ( entry.tooltip ) { - - showTooltip( entry ); - - } - - }; - - function mouseOutHandler( event ) { - - mouseReact = true; - - //--- - - var entry = getEntryByElement( event.target ); - - if ( entry.tooltip ) { - - hideTooltip( entry ); - - } - - }; - - //--- - - function mouseMoveHandler( event ) { - - mousePos = getMousePos( svg, event ); - - }; - - function getMousePos( svg, event ) { - - var rect = svg.getBoundingClientRect(); - - return { - - x: event.clientX - rect.left, - y: event.clientY - rect.top - - }; - - }; - - //--- - - function resizeHandler( event ) { - reInit(); - }; - - //--- - - init(); - - function choseToOverState( entry ) { - // debugger - for ( var i = 0, l = entryHolder.length; i < l; i++ ) { - - var e = entryHolder[ i ]; - - if ( e.index === entry.index ) { - e.mouseOver = true; - } - } - }; - function resetToNotOver() { - for ( var i = 0, l = entryHolder.length; i < l; i++ ) { - var e = entryHolder[ i ]; - e.mouseOver = false; - } - mouseReact = true; - } - - this.speed = function (sp) { - console.log(settings); - settings.speed=sp; - } - this.chose = function (target) { - // var entry = getEntryByElement(target); - mouseReact = false; - target.forEach(function(val){ - choseToOverState(val); - }) - } - this.reset = function () { - resetToNotOver(); - } - - - }; - - window.SVG3DTagCloud = SVG3DTagCloud; - -} () ); - -if ( typeof jQuery !== 'undefined' ) { - - ( function( $ ) { - - $.fn.svg3DTagCloud = function( params ) { - - var args = arguments; - - return this.each( function() { - - if ( !$.data( this, 'plugin_SVG3DTagCloud' ) ) { - - $.data( this, 'plugin_SVG3DTagCloud', new SVG3DTagCloud( this, params ) ); - - } else { - - var plugin = $.data( this, 'plugin_SVG3DTagCloud' ); - - if ( plugin[ params ] ) { - - plugin[ params ].apply( this, Array.prototype.slice.call( args, 1 ) ); - - } else { - - $.error( 'Method ' + params + ' does not exist on jQuery.svg3DTagCloud' ); - - } - - } - - } ); - - }; - - } ( jQuery ) ); - -} \ No newline at end of file diff --git a/src/static/jquery-svg3dtagcloud-plugin-master/js/jquery.svg3dtagcloud.min.js b/src/static/jquery-svg3dtagcloud-plugin-master/js/jquery.svg3dtagcloud.min.js deleted file mode 100644 index df5dd04..0000000 --- a/src/static/jquery-svg3dtagcloud-plugin-master/js/jquery.svg3dtagcloud.min.js +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright (c) 2017 Niklas Knaack - -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. -*/ - -!function(){function t(t,e){function o(){F=document.createElementNS(N,"svg"),F.addEventListener("mousemove",v),t.appendChild(F),x.bgDraw&&(D=document.createElementNS(N,"rect"),D.setAttribute("x",0),D.setAttribute("y",0),D.setAttribute("fill",x.bgColor),F.appendChild(D)),a(),i(),h(),window.addEventListener("resize",b)}function i(){var e=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,o=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,i=e,r=o;x.width.toString().indexOf("%")>0||x.height.toString().indexOf("%")>0?(i=Math.round(t.offsetWidth/100*parseInt(x.width)),r=Math.round(i/100*parseInt(x.height))):(i=parseInt(x.width),r=parseInt(x.height)),i>=e&&(i=e),r>=o&&(r=o),P={x:i/2,y:r/2},E.x=x.speed/P.x,E.y=x.speed/P.y,S=i>=r?r/100*parseInt(x.radius):i/100*parseInt(x.radius),1>S&&(S=1),C=S/2,Ce;e++)r(z[e],t)}function r(t,e){var o=t.vectorPosition.x-O.x,i=t.vectorPosition.y-O.y,n=t.vectorPosition.z-O.z,r=Math.sqrt(o*o+i*i+n*n);t.vectorPosition.x/=r,t.vectorPosition.y/=r,t.vectorPosition.z/=r,t.vectorPosition.x*=e,t.vectorPosition.y*=e,t.vectorPosition.z*=e}function s(t,e,o,i,n){var r={};return"undefined"!=typeof e.label?(r.element=document.createElementNS(N,"text"),r.element.setAttribute("x",0),r.element.setAttribute("y",0),r.element.setAttribute("fill",x.fontColor),r.element.setAttribute("font-family",x.fontFamily),r.element.setAttribute("font-size",x.fontSize),r.element.setAttribute("font-weight",x.fontWeight),r.element.setAttribute("font-style",x.fontStyle),r.element.setAttribute("font-stretch",x.fontStretch),r.element.setAttribute("text-anchor","middle"),r.element.textContent=x.fontToUpperCase?e.label.toUpperCase():e.label):"undefined"!=typeof e.image&&(r.element=document.createElementNS(N,"image"),r.element.setAttribute("x",0),r.element.setAttribute("y",0),r.element.setAttribute("width",e.width),r.element.setAttribute("height",e.height),r.element.setAttribute("id","image_"+t),r.element.setAttributeNS("http://www.w3.org/1999/xlink","href",e.image),r.diffX=e.width/2,r.diffY=e.height/2),r.link=document.createElementNS(N,"a"),r.link.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e.url),r.link.setAttribute("target",e.target),r.link.addEventListener("mouseover",m,!0),r.link.addEventListener("mouseout",y,!0),r.link.appendChild(r.element),"undefined"!=typeof e.tooltip?(r.tooltip=!0,r.tooltipLabel=x.tooltipFontToUpperCase?e.tooltip.toUpperCase():e.tooltip):r.tooltip=!1,r.index=t,r.mouseOver=!1,r.vectorPosition={x:o,y:i,z:n},r.vector2D={x:0,y:0},F.appendChild(r.link),r}function a(){for(var t=!1,e=1,o=x.entries.length+1;o>e;e++){var i=Math.acos(-1+2*e/o),n=Math.sqrt(o*Math.PI)*i,r=Math.cos(n)*Math.sin(i),a=Math.sin(n)*Math.sin(i),u=Math.cos(i),c=s(e-1,x.entries[e-1],r,a,u);z.push(c),"undefined"!=typeof x.entries[e-1].tooltip&&(t=!0)}t&&l()}function l(){w=document.createElementNS(N,"text"),w.setAttribute("x",0),w.setAttribute("y",0),w.setAttribute("fill",x.tooltipFontColor),w.setAttribute("font-family",x.tooltipFontFamily),w.setAttribute("font-size",x.tooltipFontSize),w.setAttribute("font-weight",x.tooltipFontWeight),w.setAttribute("font-style",x.tooltipFontStyle),w.setAttribute("font-stretch",x.tooltipFontStretch),w.setAttribute("text-anchor",x.tooltipTextAnchor),w.textContent="",F.appendChild(w)}function u(t){for(var e=0,o=z.length;o>e;e++){var i=z[e];if(i.element.getAttribute("x")===t.getAttribute("x")&&i.element.getAttribute("y")===t.getAttribute("y"))return i}}function c(t){for(var e=0,o=z.length;o>e;e++){var i=z[e];i.index===t.index?i.mouseOver=!0:i.mouseOver=!1}}function f(t){t.tooltip&&(w.setAttribute("x",t.vector2D.x-x.tooltipDiffX),w.setAttribute("y",t.vector2D.y-x.tooltipDiffY),w.textContent=x.tooltipFontToUpperCase?t.tooltipLabel.toUpperCase():t.tooltipLabel,w.setAttribute("opacity",1))}function d(t){w.setAttribute("opacity",0)}function p(){var t=E.x*T.x-x.speed,e=x.speed-E.y*T.y,o=t*I,i=e*I;k.sx=Math.sin(o),k.cx=Math.cos(o),k.sy=Math.sin(i),k.cy=Math.cos(i);for(var n=0,r=z.length;r>n;n++){var s=z[n];if(M){var a=s.vectorPosition.x,l=s.vectorPosition.y*k.sy+s.vectorPosition.z*k.cy;s.vectorPosition.x=a*k.cx+l*k.sx,s.vectorPosition.y=s.vectorPosition.y*k.cy+s.vectorPosition.z*-k.sy,s.vectorPosition.z=a*-k.sx+l*k.cx}var u=x.fov/(x.fov+s.vectorPosition.z);s.vector2D.x=s.vectorPosition.x*u+P.x,s.vector2D.y=s.vectorPosition.y*u+P.y,s.diffX&&s.diffY&&(s.vector2D.x-=s.diffX,s.vector2D.y-=s.diffY),s.element.setAttribute("x",s.vector2D.x),s.element.setAttribute("y",s.vector2D.y);var c;M?(c=(C-s.vectorPosition.z)/S,c"]; + $(this.entries).each(function(i, val) { + var color = val.award_id ? "yellow" : "white"; + html.push( + '
  • ' + + val.name + + "
  • " + ); + // html.push(`
  • ' + item.name + '
  • `); + }); + html.push(""); + return html.join(""); + } + }, + { + key: "createCanvas", + value: function createCanvas() { + var canvas = document.createElement("canvas"); + canvas.id = this.id; + canvas.width = 1024; + canvas.height = 600; + document.getElementById("holder").appendChild(canvas); + this.canvas = canvas; + canvas.innerHTML = this.createHTML(); + TagCanvas.Start("myCanvas", "", { + textColour: null, + initial: Tag.speed(), + dragControl: 1, + textHeight: 14 + }); + } + }, + { + key: "markYellow", + value: function markYellow(users) { + var color = "yellow"; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for ( + var _iterator = users[Symbol.iterator](), _step; + !(_iteratorNormalCompletion = (_step = _iterator.next()).done); + _iteratorNormalCompletion = true + ) { + var user = _step.value; + + $(this.canvas) + .find("[data-uid=" + user.uid + "]") + .css("color", color); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + TagCanvas.Reload(this.id); + } + }, + { + key: "fast", + value: function fast() { + TagCanvas.SetSpeed(this.id, [5, 1]); + } + }, + { + key: "stop", + value: function stop() { + TagCanvas.SetSpeed(this.id, Tag.speed()); + TagCanvas.Reload(this.id); + } + } + ], + [ + { + key: "speed", + value: function speed() { + return [0.1 * Math.random() + 0.01, -(0.1 * Math.random() + 0.01)]; + } + } + ] + ); + + return Tag; +})(); + +var Index = (function() { + function Index() { + var _this = this; + + _classCallCheck(this, Index); + + this.running = false; + this.currentAward = ""; + this.entries = []; + this.buildCloud().then(function() { + _this.canvas3DTagCloud = new Tag(_this.entries); + }); + this.bindEvent(); + this.initVisualSocket(); + } + + _createClass(Index, [ + { + key: "buildCloud", + value: function buildCloud() { + var _this2 = this; + + return BS.getUsers().then(function(resp) { + console.log(resp); + _this2.entries = resp.data; + }); + } + }, + { + key: "initVisualSocket", + value: function initVisualSocket() { + var _this3 = this; + + var tempAwardId = ""; + setInterval(function() { + tempAwardId = localStorage.getItem("current_award"); + if (_this3.currentAward !== tempAwardId) { + /*change*/ + // window.location.reload(1); + _this3.currentAward = tempAwardId; + _this3.refreshCurrentAward(); + } + }, 1000); + } + }, + { + key: "refreshCurrentAward", + value: function refreshCurrentAward() { + if (this.currentAward === "") return; + BS.getAward(this.currentAward).then(function(resp) { + console.log(resp); + if (resp.status === 200) { + var awardInfo = resp.data; + $("#currentAwardName").html(awardInfo.award_name); + $("#currentTimes").html(awardInfo.award_capacity); + } + }); + } + }, + { + key: "bindEvent", + value: function bindEvent() { + var _this4 = this; + + $("#start").click(function() { + if (_this4.running) { + alert("正在抽奖"); + return; + } + _this4.canvas3DTagCloud.fast(); + BS.run().then(function(resp) { + console.log(resp); + _this4.running = true; + }); + }); + $("#end").click(function() { + if (!_this4.running) { + return; + } + console.log("click"); + BS.stopAndResult(_this4.currentAward).then(function(resp) { + console.log(resp); + if (resp.status === 200) { + _this4.stopLottery(resp.data); + _this4.running = false; + } else { + _this4.running = false; + _this4.canvas3DTagCloud.stop(); + layer.alert(resp.msg); + } + }); + }); + $(document).on("click", function() { + $("#result").hide(); + $(".holder").removeClass("mask"); + }); + $("#luckyUsers").click(function() { + _this4.list(); + }); + } + }, + { + key: "stopLottery", + value: function stopLottery(data) { + this.canvas3DTagCloud.stop(); + this.currentlist(data); + this.canvas3DTagCloud.markYellow(data); + } + + /** + * 当前轮结果 + * @param data + */ + }, + { + key: "currentlist", + value: function currentlist(data) { + // let offset = $(".holder").offset(); + var DOM = ""; + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; + + try { + for ( + var _iterator2 = data[Symbol.iterator](), _step2; + !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); + _iteratorNormalCompletion2 = true + ) { + var user = _step2.value; + + DOM += + '' + + user.name + + "
    " + + user.uid + + "
    "; + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } + + DOM += ""; + $("#result") + .show() + .html(DOM); + setTimeout(function() { + $(".holder").addClass("mask"); + }, 10); + } + + /** + * 所有结果 + */ + }, + { + key: "list", + value: function list() { + var offset = $(".holder").offset(); + var awards = {}; + var load = layer.load(2); + BS.getAwards() + .then(function(resp) { + resp.data.map(function(val) { + console.log(val); + if (typeof awards[val.award_id] === "undefined") { + awards[val.award_id] = {}; + } + awards[val.award_id].name = val.award_name; + awards[val.award_id].data = []; + }); + }) + .then(function() { + return BS.getLuckyUsers().then(function(resp) { + resp.data.map(function(val) { + awards[val.award_id].data.push(val); + }); + }); + }) + .then(function() { + layer.close(load); + console.log(awards); + var content = ""; + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = undefined; + + try { + for ( + var _iterator3 = Object.keys(awards)[Symbol.iterator](), _step3; + !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()) + .done); + _iteratorNormalCompletion3 = true + ) { + var key = _step3.value; + + var award = awards[key]; + var lisArray = award.data.map(function(data) { + return ( + '
  • ' + + data.name + + "\u3010" + + data.uid + + "\u3011
  • " + ); + }); + if (lisArray.length !== 0) { + content += + "\n
    \n
    " + + award.name + + "
    \n
      \n " + + lisArray.join("") + + "\n
    \n
    \n "; + } + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } + } + } + + layer.open({ + type: 1, + area: ["1024px", "600px"], + skin: "layui-layer-lan", //样式类名 + offset: [offset.top, offset.left], + closeBtn: 1, //不显示关闭按钮 + anim: 3, + title: "所有中奖名单", + shadeClose: false, //开启遮罩关闭 + content: '\n
    ' + content + "\n
    " + }); + }); + } + } + ]); + + return Index; +})(); diff --git a/src/static/js/manage.min.js b/src/static/js/manage.min.js new file mode 100644 index 0000000..b3180dd --- /dev/null +++ b/src/static/js/manage.min.js @@ -0,0 +1,178 @@ +"use strict"; + +var _createClass = (function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +})(); + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +/** + * Created by zuowenqi on 2018/2/2 0002 + */ +var BS = (function() { + function BS() { + _classCallCheck(this, BS); + } + + _createClass(BS, null, [ + { + key: "fetch", + value: function fetch(url, data, type) { + return new Promise(function(resolve) { + $.ajax({ + type: type ? type : "GET", + data: data ? data : {}, + url: url, + success: function success(resp) { + resolve(resp); + } + }); + }); + } + }, + { + key: "addAwards", + value: function addAwards(award_name, award_capacity) { + award_capacity *= 1; + return this.fetch("/add_award", { + award_name: award_name, + award_capacity: award_capacity + }); + } + }, + { + key: "removeAwards", + value: function removeAwards(award_id) { + return this.fetch("/remove_award", { + award_id: award_id + }); + } + }, + { + key: "getAwards", + value: function getAwards() { + return this.fetch("/awards"); + } + }, + { + key: "setCurrent", + value: function setCurrent(id) { + return new Promise(function(resolve) { + var prev = localStorage.getItem("current_award") || ""; + localStorage.setItem("prev_award", prev); + localStorage.setItem("current_award", id); + resolve(localStorage.getItem("current_award")); + }); + } + }, + { + key: "getCurrent", + value: function getCurrent() { + return localStorage.getItem("current_award"); + } + } + ]); + + return BS; +})(); + +$(function() { + $("#add").click(function(e) { + layer.open({ + title: "增加", + content: + '\n
    \u5956\u54C1\u540D
    \n
    \u6570 \u91CF
    \n', + yes: function yes(index) { + var name = $("#addname").val(); + var num = $("#addnum").val(); + BS.addAwards(name, num).then(function(resp) { + console.log(resp); + flushAwards(); + if (resp.status === 200) { + layer.close(index); + } else { + alert(resp.msg); + } + }); + } + }); + }); + $("#reset").click(function(e) { + layer.confirm("确定要重置吗", function(index) { + BS.fetch("/reset").then(function(resp) { + if (resp.status === 200) { + layer.close(index); + window.location.reload(1); + } + }); + }); + }); + $(document) + .on("click", ".js-set", function(e) { + var aid = $(e.target).data("aid"); + var $lis = $("#awardList").find("li"); + BS.setCurrent(aid).then(function() { + $lis.removeClass("cur"); + $(e.target) + .closest("li") + .addClass("cur"); + }); + }) + .on("click", ".js-remove", function(e) { + layer.confirm("确认要删除该项?", function() { + var aid = $(e.target).data("aid"); + var loadIndex = layer.load(2); + BS.removeAwards(aid).then(function(resp) { + if (resp.status === 200) { + flushAwards(); + layer.close(loadIndex); + } else { + layer.close(loadIndex); + layer.alert(resp.msg); + } + }); + }); + }); + flushAwards(); +}); + +function flushAwards() { + var currentAward = BS.getCurrent(); + BS.getAwards().then(function(resp) { + console.log(resp); + var ul = ""; + resp.data.forEach(function(val) { + var list = + ' \n
  • \n \n
    \n \u5956\u9879\u540D\u79F0\uFF1A' + + val.award_name + + "\uFF0C\u6570\u91CF\uFF1A" + + val.award_capacity + + "\n
    \n
  • "; + ul += list; + }); + $("#awardList").html(ul); + }); +} diff --git a/src/static/script.js b/src/static/script.js deleted file mode 100644 index f09d225..0000000 --- a/src/static/script.js +++ /dev/null @@ -1,242 +0,0 @@ -var ALL_USERS = []; -var ALL_AWARDS = []; -var g_Interval = 50; -var g_Timer; // 抽奖程序定时器 -var g_winner = null; -var g_award = null; -var running = false; - -//跑马灯音效 -var runingmic = document.getElementById("runingmic"); -runingmic.volume = 0.5; - -//中奖音效 -var pausemic = document.getElementById("pausemic"); -pausemic.volume = 1.0; - -UpdateUserList(); // 更新抽奖名单 -UpdateAwardList(); // 更新奖品列表 -UpdateWinnerList(); // 更新中奖名单 - - -function beginRndNum(trigger) { - if (running) { - running = false; - runingmic.pause(); // 停止抽奖音乐 - pausemic.play(); // 播放庆祝音乐 - clearTimeout(g_Timer); // 停止抽奖滚动条 - $(trigger).val("开始"); - $('#ResultNum').css('color', 'red'); - - WinAward(g_winner.name, g_award.tag); // 提交中奖名单 - UpdateUserList(); // 更新抽奖名单 - UpdateAwardList(); // 更新奖品列表 - UpdateWinnerList(); // 更新中奖名单 - UpdateCurrentAward(g_award.tag); // 更新当前奖品 - - } - else { - if (g_award == null) { - layer.alert('老板,奖品都没选,这是要干啥了?', {icon: 5}); - return GameOver(); - } - else if (ALL_USERS.length == 0) { - layer.alert("所有人都中奖了,老板还要继续抽奖吗?", {icon: 5}); - return GameOver(); - } - else if (g_award.count <= 0) { - layer.alert("老板,奖品都没了,还要继续吗?", {icon: 5}); - return GameOver(); - } - pausemic.pause(); // 停止庆祝音乐 - runingmic.play(); // 开始抽奖音乐 - running = true; - $('#ResultNum').css('color', 'black'); - $(trigger).val("停止"); - beginTimer(); - } -} - -// 关键地方 -function UpdateName() { - var g_PersonCount = ALL_USERS.length; //参加抽奖人数 - var num = Math.floor(Math.random() * g_PersonCount); - g_winner = ALL_USERS[num]; - $('#ResultNum').html(g_winner.name); -} - -function beginTimer() { - g_Timer = setTimeout(beat, g_Interval); -} - -function beat() { - g_Timer = setTimeout(beat, g_Interval); - UpdateName(); -} - -// 关闭异步 -function UpdateUserList() { - $.ajax({ - url: "/users", - type: "GET", - async: false, - success: function (result) { - ALL_USERS = result.data; - }, - error: function (XMLHttpRequest, textStatus, errorThrown) { - }, - complete: function (XMLHttpRequest, textStatus) { - } - }) -} -// 关闭异步 -function UpdateWinnerList() { - $.ajax({ - url: "/winner", - type: "GET", - async: false, - success: function (result) { - var winners = result.data; - var winner_list = $("#winner-list"); - winner_list.find('a').remove(); - for (var i = 0; i < winners.length; i++) { - var w = winners[i]; - var content = '' + w.name + '' + w.awards + ''; - winner_list.append(content); - } - }, - error: function (XMLHttpRequest, textStatus, errorThrown) { - }, - complete: function (XMLHttpRequest, textStatus) { - } - }) -} - - -function UpdateAwardList() { - $.ajax({ - url: "/awards", - type: "GET", - async: false, - success: function (result) { - var awards_list = $("#awards-list"); - awards_list.find('a').remove(); - ALL_AWARDS = result.data; - for (var i = 0; i < ALL_AWARDS.length; i++) { - var w = ALL_AWARDS[i]; - var content = '' + w.tag + '' + w.count + ''; - awards_list.append(content); - } - }, - error: function (XMLHttpRequest, textStatus, errorThrown) { - }, - complete: function (XMLHttpRequest, textStatus) { - } - }) -} - -$("#awards-list").on("click", 'a', function () { - var name = $(this).attr("name"); - UpdateCurrentAward(name); -}); - -$("#winner-list").on("click", 'a', function () { - var name = $(this).attr("name"); - layer.confirm('撤销奖品???', { - icon: 0, - btn: ['确定', '取消'] //按钮 - }, function () { - layer.msg('悲催!!!!', {icon: 0}); - Revoke(name); //撤销奖项 - }, function () { - layer.msg('吓死宝宝了!!!!', {icon: 1}) - }); -}); - - -$(document).bind("keydown", function (ev) { - if (ev.keyCode == 13) { // 按回车 - $('#btn').click(); - } - else if (ev.keyCode == 49) { // 按1 - $('#myModal').modal('toggle'); - } - - else if (ev.keyCode == 48) { // 按0 - layer.confirm('确定要重置数据???',{ - icon: 1, - btn: ['确定', '取消'] //按钮 - }, function () { - Reset(); //数据重置 - }, function () { - }); - - } -}); - - -function UpdateCurrentAward(tag) { - var result = null; - for (var i = 0; i < ALL_AWARDS.length; i++) { - var w = ALL_AWARDS[i]; - if (w.tag == tag) { - result = w; - break - } - } - g_award = result; - - $("#award-tag").text(g_award.tag); - $("#award-count").text(g_award.count); -} - - -function WinAward(name, awards) { - $.ajax({ - url: "/win", - type: "POST", - data: {"name": name, "awards": awards}, - success: function (result) { - }, - error: function (XMLHttpRequest, textStatus, errorThrown) { - }, - complete: function (XMLHttpRequest, textStatus) { - } - }) -} - -// 恢复出厂数据 -function Revoke(name) { - $.ajax({ - url: "/revoke", - type: "POST", - data: {"name": name}, - success: function (result) { - }, - error: function (XMLHttpRequest, textStatus, errorThrown) { - }, - complete: function (XMLHttpRequest, textStatus) { - window.location.reload();//刷新当前页面. - } - }) -} - -// 恢复出厂数据 -function Reset() { - $.ajax({ - url: "/reset", - type: "GET", - success: function (result) { - }, - error: function (XMLHttpRequest, textStatus, errorThrown) { - }, - complete: function (XMLHttpRequest, textStatus) { - window.location.reload();//刷新当前页面. - } - }) -} - -function GameOver() { - $('#ResultNum').css('color', 'black'); - $('#ResultNum').html("*****"); -} \ No newline at end of file diff --git a/src/templates/index.html b/src/templates/index.html index 54a251a..a41179b 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -28,9 +28,8 @@ - - + \ No newline at end of file diff --git a/src/templates/manage.html b/src/templates/manage.html index 6844ae2..2d5d751 100644 --- a/src/templates/manage.html +++ b/src/templates/manage.html @@ -16,6 +16,6 @@ - + \ No newline at end of file