From 6bd33bf4155e47153f2d532ac753539bc430dd34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Kervella?= Date: Tue, 10 Oct 2017 18:28:21 +0000 Subject: [PATCH] Ajout des licenses des modules JS --- static/js/handlebars/LICENSE | 19 ++ static/js/{ => handlebars}/handlebars.js | 0 static/js/konami/LICENSE.md | 21 ++ static/js/konami/konami.js | 139 +++++++++++ static/js/sapphire.js | 297 +++++++++++++++++++++++ static/js/typeahead/LICENSE | 19 ++ static/js/{ => typeahead}/typeahead.js | 0 templates/base.html | 6 +- 8 files changed, 499 insertions(+), 2 deletions(-) create mode 100644 static/js/handlebars/LICENSE rename static/js/{ => handlebars}/handlebars.js (100%) create mode 100644 static/js/konami/LICENSE.md create mode 100644 static/js/konami/konami.js create mode 100644 static/js/sapphire.js create mode 100644 static/js/typeahead/LICENSE rename static/js/{ => typeahead}/typeahead.js (100%) diff --git a/static/js/handlebars/LICENSE b/static/js/handlebars/LICENSE new file mode 100644 index 00000000..b802d14e --- /dev/null +++ b/static/js/handlebars/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2011-2017 by Yehuda Katz + +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/static/js/handlebars.js b/static/js/handlebars/handlebars.js similarity index 100% rename from static/js/handlebars.js rename to static/js/handlebars/handlebars.js diff --git a/static/js/konami/LICENSE.md b/static/js/konami/LICENSE.md new file mode 100644 index 00000000..ee46fc71 --- /dev/null +++ b/static/js/konami/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Snaptortoise + +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/static/js/konami/konami.js b/static/js/konami/konami.js new file mode 100644 index 00000000..0fcaab2c --- /dev/null +++ b/static/js/konami/konami.js @@ -0,0 +1,139 @@ +/* + * Konami-JS ~ + * :: Now with support for touch events and multiple instances for + * :: those situations that call for multiple easter eggs! + * Code: https://github.com/snaptortoise/konami-js + * Examples: http://www.snaptortoise.com/konami-js + * Copyright (c) 2009 George Mandis (georgemandis.com, snaptortoise.com) + * Version: 1.5.1 (9/4/2017) + * Licensed under the MIT License (http://opensource.org/licenses/MIT) + * Tested in: Safari 4+, Google Chrome 4+, Firefox 3+, IE7+, Mobile Safari 2.2.1+ and Android + */ + +var Konami = function (callback) { + var konami = { + addEvent: function (obj, type, fn, ref_obj) { + if (obj.addEventListener) + obj.addEventListener(type, fn, false); + else if (obj.attachEvent) { + // IE + obj["e" + type + fn] = fn; + obj[type + fn] = function () { + obj["e" + type + fn](window.event, ref_obj); + } + obj.attachEvent("on" + type, obj[type + fn]); + } + }, + removeEvent: function (obj, eventName, eventCallback) { + if (obj.removeEventListener) { + obj.removeEventListener(eventName, eventCallback); + } else if (obj.attachEvent) { + obj.detachEvent(eventName); + } + }, + input: "", + pattern: "38384040373937396665", + keydownHandler: function (e, ref_obj) { + if (ref_obj) { + konami = ref_obj; + } // IE + konami.input += e ? e.keyCode : event.keyCode; + if (konami.input.length > konami.pattern.length) { + konami.input = konami.input.substr((konami.input.length - konami.pattern.length)); + } + if (konami.input === konami.pattern) { + konami.code(this._currentlink); + konami.input = ''; + e.preventDefault(); + return false; + } + }, + load: function (link) { + this.addEvent(document, "keydown", this.keydownHandler, this); + this.iphone.load(link); + }, + unload: function () { + this.removeEvent(document, 'keydown', this.keydownHandler); + this.iphone.unload(); + }, + code: function (link) { + window.location = link + }, + iphone: { + start_x: 0, + start_y: 0, + stop_x: 0, + stop_y: 0, + tap: false, + capture: false, + orig_keys: "", + keys: ["UP", "UP", "DOWN", "DOWN", "LEFT", "RIGHT", "LEFT", "RIGHT", "TAP", "TAP"], + input: [], + code: function (link) { + konami.code(link); + }, + touchmoveHandler: function (e) { + if (e.touches.length === 1 && konami.iphone.capture === true) { + var touch = e.touches[0]; + konami.iphone.stop_x = touch.pageX; + konami.iphone.stop_y = touch.pageY; + konami.iphone.tap = false; + konami.iphone.capture = false; + konami.iphone.check_direction(); + } + }, + toucheendHandler: function () { + if (konami.iphone.tap === true) { + konami.iphone.check_direction(this._currentLink); + } + }, + touchstartHandler: function (e) { + konami.iphone.start_x = e.changedTouches[0].pageX; + konami.iphone.start_y = e.changedTouches[0].pageY; + konami.iphone.tap = true; + konami.iphone.capture = true; + }, + load: function (link) { + this.orig_keys = this.keys; + konami.addEvent(document, "touchmove", this.touchmoveHandler); + konami.addEvent(document, "touchend", this.toucheendHandler, false); + konami.addEvent(document, "touchstart", this.touchstartHandler); + }, + unload: function () { + konami.removeEvent(document, 'touchmove', this.touchmoveHandler); + konami.removeEvent(document, 'touchend', this.toucheendHandler); + konami.removeEvent(document, 'touchstart', this.touchstartHandler); + }, + check_direction: function () { + x_magnitude = Math.abs(this.start_x - this.stop_x); + y_magnitude = Math.abs(this.start_y - this.stop_y); + x = ((this.start_x - this.stop_x) < 0) ? "RIGHT" : "LEFT"; + y = ((this.start_y - this.stop_y) < 0) ? "DOWN" : "UP"; + result = (x_magnitude > y_magnitude) ? x : y; + result = (this.tap === true) ? "TAP" : result; + return result; + } + } + } + + typeof callback === "string" && konami.load(callback); + if (typeof callback === "function") { + konami.code = callback; + konami.load(); + } + + return konami; +}; + + +if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { + module.exports = Konami; +} else { + if (typeof define === 'function' && define.amd) { + define([], function() { + return Konami; + }); + } else { + window.Konami = Konami; + } +} diff --git a/static/js/sapphire.js b/static/js/sapphire.js new file mode 100644 index 00000000..d5e0f897 --- /dev/null +++ b/static/js/sapphire.js @@ -0,0 +1,297 @@ +// Re2o est un logiciel d'administration développé initiallement au rezometz. Il +// se veut agnostique au réseau considéré, de manière à être installable en +// quelques clics. +// +// Copyright © 2017 Maël Kervella +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +// General options +//===================================== +// Times the canvas is refreshed a second +var FPS = 30; +// Determine the length of the trail (0=instant disappear, maximum=window.innerHeight=no disappear) +var TRAIL_TIME = 5; +// The color of the characters +var RAIN_COLOR = "#00F"; +// The characters displayed +var CHARACTERS = "田由甲申甴电甶男甸甹町画甼甽甾甿畀畁畂畃畄畅畆畇畈畉畊畋界畍畎畏畐畑".split(""); +// The font size used to display the characters +var FONT_SIZE = 10; +// The maximum number of characters displayed by column +var MAX_CHAR = 7; + +var Sapphire = function () { + var sapphire = { + triggerHandle: undefined, + activated: false, + runOnce: false, + + getClass: function(elt, main, name) { elt.obj = main.getElementsByClassName(name); }, + getTag: function(elt, main, name) { elt.obj = main.getElementsByTagName(name); }, + + getProp: function(elt) { + for (var i=0 ; i sapphire.canvas.height && Math.random() > 0.975) + drops[i][j] = 0; + drops[i][j]++; + } + } + } + + function drawEverything() { + attenuateBackground(); + drawMatrixRainDrop(); + } + + sapphire.triggerHandle = setInterval(drawEverything, 1000/FPS); + }, + stop: function() { + sapphire.canvas.parentNode.removeChild(sapphire.canvas); + clearInterval(sapphire.triggerHandle); + }, + + alterElts: function() { for (var e in sapphire.elts) { sapphire.elts[e].alter(main); } }, + revertElts: function() { for (var e in sapphire.elts) { sapphire.elts[e].revert(main); } }, + + activate: function() { + if (!sapphire.runOnce) { + sapphire.runOnce = true; + sapphire.init(); + } + if (!sapphire.activated) { + sapphire.activated = true; + sapphire.alterElts(); + sapphire.run() + } + else { + sapphire.activated = false; + sapphire.stop(); + sapphire.revertElts(); + } + } + } + + return sapphire; +} + +var s = Sapphire(); +Konami(s.activate); + diff --git a/static/js/typeahead/LICENSE b/static/js/typeahead/LICENSE new file mode 100644 index 00000000..83817bac --- /dev/null +++ b/static/js/typeahead/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013-2014 Twitter, Inc + +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/static/js/typeahead.js b/static/js/typeahead/typeahead.js similarity index 100% rename from static/js/typeahead.js rename to static/js/typeahead/typeahead.js diff --git a/templates/base.html b/templates/base.html index bd1a4bb1..42505b23 100644 --- a/templates/base.html +++ b/templates/base.html @@ -35,8 +35,10 @@ with this program; if not, write to the Free Software Foundation, Inc., {% bootstrap_javascript %} - - + + + + {{ site_name }} : {% block title %}Accueil{% endblock %}