From 27d2aaa8ce8ef80be09ba25e5e4a0bebe36a616f Mon Sep 17 00:00:00 2001 From: Fluffy Jenkins Date: Wed, 8 Jan 2020 00:17:54 +0000 Subject: [PATCH] Added formatting and grid chat and mute and god knows send help please --- scripts/communityModules/chat/FloofChat.html | 389 ++-- scripts/communityModules/chat/FloofChat.js | 279 ++- .../{FloofChat2.html => FloofChat_OLD.html} | 176 +- .../communityModules/chat/emoticons/COPYING | 67 - .../communityModules/chat/emoticons/README | 12 - .../chat/emoticons/face-angel.png | Bin 992 -> 0 bytes .../chat/emoticons/face-crying.png | Bin 936 -> 0 bytes .../chat/emoticons/face-devilish.png | Bin 855 -> 0 bytes .../chat/emoticons/face-glasses.png | Bin 949 -> 0 bytes .../chat/emoticons/face-grin.png | Bin 905 -> 0 bytes .../chat/emoticons/face-kiss.png | Bin 919 -> 0 bytes .../chat/emoticons/face-monkey.png | Bin 784 -> 0 bytes .../chat/emoticons/face-plain.png | Bin 894 -> 0 bytes .../chat/emoticons/face-sad.png | Bin 918 -> 0 bytes .../chat/emoticons/face-smile-big.png | Bin 896 -> 0 bytes .../chat/emoticons/face-smile.png | Bin 919 -> 0 bytes .../chat/emoticons/face-surprise.png | Bin 917 -> 0 bytes .../chat/emoticons/face-wink.png | Bin 914 -> 0 bytes scripts/communityModules/chat/js/jscolor.js | 1855 +++++++++++++++++ 19 files changed, 2402 insertions(+), 376 deletions(-) rename scripts/communityModules/chat/{FloofChat2.html => FloofChat_OLD.html} (76%) delete mode 100644 scripts/communityModules/chat/emoticons/COPYING delete mode 100644 scripts/communityModules/chat/emoticons/README delete mode 100644 scripts/communityModules/chat/emoticons/face-angel.png delete mode 100644 scripts/communityModules/chat/emoticons/face-crying.png delete mode 100644 scripts/communityModules/chat/emoticons/face-devilish.png delete mode 100644 scripts/communityModules/chat/emoticons/face-glasses.png delete mode 100644 scripts/communityModules/chat/emoticons/face-grin.png delete mode 100644 scripts/communityModules/chat/emoticons/face-kiss.png delete mode 100644 scripts/communityModules/chat/emoticons/face-monkey.png delete mode 100644 scripts/communityModules/chat/emoticons/face-plain.png delete mode 100644 scripts/communityModules/chat/emoticons/face-sad.png delete mode 100644 scripts/communityModules/chat/emoticons/face-smile-big.png delete mode 100644 scripts/communityModules/chat/emoticons/face-smile.png delete mode 100644 scripts/communityModules/chat/emoticons/face-surprise.png delete mode 100644 scripts/communityModules/chat/emoticons/face-wink.png create mode 100644 scripts/communityModules/chat/js/jscolor.js diff --git a/scripts/communityModules/chat/FloofChat.html b/scripts/communityModules/chat/FloofChat.html index b0a746ea5c..b9b5540a9e 100644 --- a/scripts/communityModules/chat/FloofChat.html +++ b/scripts/communityModules/chat/FloofChat.html @@ -5,44 +5,20 @@ Title + + + + + + - - - +
-
-
-
- - - +
+ + + +
+
-
-
-
- -
-
-
+ + + Redock
+
+
+
+ -
-
- -
-
- -
- -
+ + \ No newline at end of file diff --git a/scripts/communityModules/chat/FloofChat.js b/scripts/communityModules/chat/FloofChat.js index e1642d6a14..f1942a0097 100644 --- a/scripts/communityModules/chat/FloofChat.js +++ b/scripts/communityModules/chat/FloofChat.js @@ -22,8 +22,23 @@ var chatBar; var chatHistory; var historyLog = []; + var visible = false; var historyVisible = false; +var settingsRoot = "FloofChat"; + +var muted = Settings.getValue(settingsRoot + "/muted", {"Local": false, "Domain": false, "Grid": false}); + +var ws; +var wsReady = false; +var webSocketURL = "ws://gridchat.darlingvr.club:8090"; +var shutdownBool = false; + +var defaultColour = {red: 255, green: 255, blue: 255}; +var colours = {}; +colours["localChatColour"] = Settings.getValue(settingsRoot + "/localChatColour", defaultColour); +colours["domainChatColour"] = Settings.getValue(settingsRoot + "/domainChatColour", defaultColour); +colours["gridChatColour"] = Settings.getValue(settingsRoot + "/gridChatColour", defaultColour); init(); @@ -31,7 +46,7 @@ function init() { Messages.subscribe("Chat"); historyLog = []; try { - historyLog = JSON.parse(Settings.getValue("HistoryLog", "[]")); + historyLog = JSON.parse(Settings.getValue(settingsRoot + "/HistoryLog", "[]")); } catch (e) { // } @@ -39,7 +54,6 @@ function init() { setupHistoryWindow(false); chatBar = new OverlayWindow({ - // source: "http://localhost:8000/fluffytest.qml", source: Paths.defaultScripts + '/communityModules/chat/FloofChat.qml?' + Date.now(), width: 360, height: 180 @@ -50,34 +64,81 @@ function init() { chatBar.sendToQml(JSON.stringify({visible: false})); Controller.keyPressEvent.connect(keyPressEvent); Messages.messageReceived.connect(messageReceived); + + connectWebSocket(); } -function setupHistoryWindow(popout) { - if (!popout) { - chatHistory = new OverlayWebWindow({ - title: 'Chat History', - source: ROOT + "FloofChat2.html?appUUID=" + appUUID + "&" + Date.now(), - width: 900, - height: 700, - visible: false - }); - chatHistory.setPosition({x: 0, y: Window.innerHeight - 700}); - chatHistory.webEventReceived.connect(onWebEventReceived); - chatHistory.closed.connect(toggleChatHistory); +function connectWebSocket(timeout) { + ws = new WebSocket(webSocketURL); + ws.onmessage = function incoming(_data) { + var message = _data.data; + var cmd = {FAILED: true}; + try { + cmd = JSON.parse(message); + } catch (e) { + // + } + if (!cmd.FAILED) { + addToLog(cmd.message, cmd.displayName, cmd.colour, cmd.channel); + if (!muted["Grid"]) { + Messages.sendLocalMessage("Floof-Notif", JSON.stringify({ + sender: "(G) " + cmd.displayName, + text: replaceFormatting(cmd.message), + colour: {text: cmd.colour} + })); + } + } + }; + + ws.onopen = function open() { + wsReady = true; + }; + + ws.onclose = function close() { + wsReady = false; + console.log('disconnected'); + + timeout = timeout | 0; + if (!shutdownBool && timeout < (30 * 1000)) { + Script.setTimeout(function () { + connectWebSocket(timeout); + }, timeout + 1000); + } else { + wsReady = -1; + } + }; +} + + +function sendWS(msg, timeout) { + if (wsReady === true) { + ws.send(JSON.stringify(msg)); } else { - chatHistory = Desktop.createWindow(Paths.defaultScripts + '/communityModules/chat/webview.qml?' + Date.now(), { - title: "Chat History", - additionalFlags: Desktop.CLOSE_BUTTON_HIDES, - presentationMode: Desktop.PresentationMode.NATIVE, - visible: false, - size: {x: 900, y: 700}, - position: {x: 0, y: Window.innerHeight - 700} - }); - chatHistory.webEventReceived.connect(onWebEventReceived); - chatHistory.closed.connect(toggleChatHistory); + timeout = timeout | 0; + if (!shutdownBool && timeout < (30 * 1000)) { + Script.setTimeout(function () { + if (wsReady === -1) { + connectWebSocket(); + } + sendWS(msg, timeout); + }, timeout + 1000); + } } } +function setupHistoryWindow() { + chatHistory = new OverlayWebWindow({ + title: 'Chat History', + source: ROOT + "FloofChat.html?appUUID=" + appUUID + "&" + Date.now(), + width: 900, + height: 700, + visible: false + }); + chatHistory.setPosition({x: 0, y: Window.innerHeight - 700}); + chatHistory.webEventReceived.connect(onWebEventReceived); + chatHistory.closed.connect(toggleChatHistory); +} + function emitScriptEvent(obj) { obj.appUUID = appUUID; tablet.emitScriptEvent(JSON.stringify(obj)); @@ -89,19 +150,35 @@ function toggleChatHistory() { chatHistory.visible = historyVisible; } +function chatColour(tab) { + if (tab === "Local") { + return colours["localChatColour"]; + } else if (tab === "Domain") { + return colours["domainChatColour"]; + } else if (tab === "Grid") { + return colours["gridChatColour"]; + } else { + return defaultColour; + } +} + function onWebEventReceived(event) { - console.log("event " + event); event = JSON.parse(event); if (event.type === "ready") { - chatHistory.emitScriptEvent(JSON.stringify(historyLog)); + chatHistory.emitScriptEvent(JSON.stringify({type: "MSG", data: historyLog})); + chatHistory.emitScriptEvent(JSON.stringify({type: "CMD", cmd: "MUTED", muted: muted})); } if (event.type === "CMD") { + if (event.cmd === "MUTED") { + muted = event.muted; + Settings.setValue(settingsRoot + "/muted", muted); + } + if (event.cmd === "COLOUR") { + Settings.setValue(settingsRoot + "/" + event.colourType + "Colour", event.colour); + colours[event.colourType] = event.colour; + } if (event.cmd === "REDOCK") { - if(popout){ - - }else{ - chatHistory.setPosition({x: 0, y: Window.innerHeight - 700}); - } + chatHistory.setPosition({x: 0, y: Window.innerHeight - 700}); } if (event.cmd === "GOTO") { var result = Window.confirm("Do you want to goto " + event.url.split("/")[2] + " ?"); @@ -122,13 +199,24 @@ function onWebEventReceived(event) { Window.copyToClipboard(event.url); } } + if (event.type === "WEBMSG") { + if (event.message === "") return; + sendWS({ + uuid: "", + type: "WebChat", + channel: event.tab, + colour: chatColour(event.tab), + message: event.message, + displayName: MyAvatar.displayName + }); + } if (event.type === "MSG") { if (event.message === "") return; Messages.sendMessage("Chat", JSON.stringify({ type: "TransmitChatMessage", position: MyAvatar.position, channel: event.tab, - colour: {red: 222, green: 222, blue: 222}, + colour: chatColour(event.tab), message: event.message, displayName: MyAvatar.displayName })); @@ -136,9 +224,68 @@ function onWebEventReceived(event) { } } -function messageReceived(channel, message, sender, local) { - if (channel === "Chat" || channel === "Support") { +function replaceFormatting(text) { + var found = false; + if (text.indexOf("**") !== -1) { + var firstMatch = text.indexOf("**") + 2; + var secondMatch = text.indexOf("**", firstMatch); + if (firstMatch !== -1 && secondMatch !== -1) { + found = true; + var part1 = text.substring(0, firstMatch - 2); + var part2 = text.substring(firstMatch, secondMatch); + var part3 = text.substring(secondMatch + 2); + text = part1 + "" + part2 + "" + part3; + } + } else if (text.indexOf("*") !== -1) { + var firstMatch = text.indexOf("*") + 1; + var secondMatch = text.indexOf("*", firstMatch); + if (firstMatch !== -1 && secondMatch !== -1) { + found = true; + var part1 = text.substring(0, firstMatch - 1); + var part2 = text.substring(firstMatch, secondMatch); + var part3 = text.substring(secondMatch + 1); + text = part1 + "" + part2 + "" + part3; + } + } else if (text.indexOf("__") !== -1) { + var firstMatch = text.indexOf("__") + 2; + var secondMatch = text.indexOf("__", firstMatch); + if (firstMatch !== -1 && secondMatch !== -1) { + found = true; + var part1 = text.substring(0, firstMatch - 2); + var part2 = text.substring(firstMatch, secondMatch); + var part3 = text.substring(secondMatch + 2); + text = part1 + "" + part2 + "" + part3; + } + } else if (text.indexOf("_") !== -1) { + var firstMatch = text.indexOf("_") + 1; + var secondMatch = text.indexOf("_", firstMatch); + if (firstMatch !== -1 && secondMatch !== -1) { + found = true; + var part1 = text.substring(0, firstMatch - 1); + var part2 = text.substring(firstMatch, secondMatch); + var part3 = text.substring(secondMatch + 1); + text = part1 + "" + part2 + "" + part3; + } + } else if (text.indexOf("~~") !== -1) { + var firstMatch = text.indexOf("~~") + 2; + var secondMatch = text.indexOf("~~", firstMatch); + if (firstMatch !== -1 && secondMatch !== -1) { + found = true; + var part1 = text.substring(0, firstMatch - 2); + var part2 = text.substring(firstMatch, secondMatch); + var part3 = text.substring(secondMatch + 2); + text = part1 + "" + part2 + "" + part3; + } + } + if (found) { + return replaceFormatting(text); + } else { + return text; + } +} +function messageReceived(channel, message) { + if (channel === "Chat") { var cmd = {FAILED: true}; try { cmd = JSON.parse(message); @@ -153,20 +300,44 @@ function messageReceived(channel, message, sender, local) { if (!cmd.hasOwnProperty("colour")) { cmd.colour = {red: 222, green: 222, blue: 222}; } + if (cmd.message.indexOf("/me") === 0) { + cmd.message = cmd.message.replace("/me", cmd.displayName); + cmd.displayName = ""; + } if (cmd.channel === "Local") { if (Vec3.withinEpsilon(MyAvatar.position, cmd.position, 20)) { addToLog(cmd.message, cmd.displayName, cmd.colour, cmd.channel); + if (!muted["Local"]) { + Messages.sendLocalMessage("Floof-Notif", JSON.stringify({ + sender: "(L) " + cmd.displayName, + text: replaceFormatting(cmd.message), + colour: {text: cmd.colour} + })); + } + } + } else if (cmd.channel === "Domain") { + addToLog(cmd.message, cmd.displayName, cmd.colour, cmd.channel); + if (!muted["Domain"]) { Messages.sendLocalMessage("Floof-Notif", JSON.stringify({ - sender: "L " + cmd.displayName, - text: cmd.message, + sender: "(D) " + cmd.displayName, + text: replaceFormatting(cmd.message), + colour: {text: cmd.colour} + })); + } + } else if (cmd.channel === "Grid") { + addToLog(cmd.message, cmd.displayName, cmd.colour, cmd.channel); + if (!muted["Grid"]) { + Messages.sendLocalMessage("Floof-Notif", JSON.stringify({ + sender: "(G) " + cmd.displayName, + text: replaceFormatting(cmd.message), colour: {text: cmd.colour} })); } } else { addToLog(cmd.message, cmd.displayName, cmd.colour, cmd.channel); Messages.sendLocalMessage("Floof-Notif", JSON.stringify({ - sender: ((cmd.channel === "Domain") ? "D " : "") + cmd.displayName, - text: cmd.message, + sender: cmd.displayName, + text: replaceFormatting(cmd.message), colour: {text: cmd.colour} })); } @@ -189,13 +360,16 @@ function time() { function addToLog(msg, dp, colour, tab) { historyLog.push([time(), msg, dp, colour, tab]); - chatHistory.emitScriptEvent(JSON.stringify([[time(), msg, dp, colour, tab]])); + chatHistory.emitScriptEvent(JSON.stringify({type: "MSG", data: [[time(), msg, dp, colour, tab]]})); if (historyLog.length > 500) { historyLog.pop(); } - Settings.setValue("HistoryLog", JSON.stringify(historyLog)) + Settings.setValue(settingsRoot + "/HistoryLog", JSON.stringify(historyLog)) } +const CONTROL = 67108864; +const SHIFT = 33554432; + function fromQml(message) { var cmd = {FAILED: true}; try { @@ -204,21 +378,29 @@ function fromQml(message) { // } if (!cmd.FAILED) { - console.log(JSON.stringify(cmd.event)); if (cmd.type === "MSG") { if (cmd.message !== "") { - if (cmd.event.modifiers === 67108864) { + if (cmd.event.modifiers === CONTROL) { Messages.sendMessage("Chat", JSON.stringify({ - type: "TransmitChatMessage", channel: "Domain", colour: {red: 222, green: 222, blue: 222}, + type: "TransmitChatMessage", channel: "Domain", colour: chatColour("Domain"), message: cmd.message, displayName: MyAvatar.displayName })); + } else if (cmd.event.modifiers === CONTROL + SHIFT) { + sendWS({ + uuid: "", + type: "WebChat", + channel: "Grid", + colour: chatColour("Grid"), + message: cmd.message, + displayName: MyAvatar.displayName + }); } else { Messages.sendMessage("Chat", JSON.stringify({ type: "TransmitChatMessage", channel: "Local", position: MyAvatar.position, - colour: {red: 222, green: 222, blue: 222}, + colour: chatColour("Local"), message: cmd.message, displayName: MyAvatar.displayName })); @@ -229,13 +411,6 @@ function fromQml(message) { if (cmd.cmd === "Clicked") { toggleChatHistory() } - - /* - Messages.sendLocalMessage("Floof-Notif", JSON.stringify({ - sender: "Chat", - text: msg, - colour: {text: {red: 200, green: 200, blue: 200}} - }));*/ } } } @@ -254,7 +429,6 @@ function setVisible(_visible) { })); chatBar.sendToQml(JSON.stringify({visible: false})); } - visible = _visible; } @@ -270,7 +444,6 @@ function keyPressEvent(event) { } } - function shutdown() { try { Messages.messageReceived.disconnect(messageReceived); diff --git a/scripts/communityModules/chat/FloofChat2.html b/scripts/communityModules/chat/FloofChat_OLD.html similarity index 76% rename from scripts/communityModules/chat/FloofChat2.html rename to scripts/communityModules/chat/FloofChat_OLD.html index 6d886aaeca..b0a746ea5c 100644 --- a/scripts/communityModules/chat/FloofChat2.html +++ b/scripts/communityModules/chat/FloofChat_OLD.html @@ -5,12 +5,6 @@ Title - - - - - - @@ -20,6 +14,34 @@ height: 100%; } + /* Style the tab */ + div.tab { + overflow: hidden; + border: 1px solid #ccc; + background-color: #f1f1f1; + } + + /* Style the buttons inside the tab */ + div.tab button { + background-color: inherit; + float: left; + border: none; + outline: none; + cursor: pointer; + padding: 14px 16px; + transition: 0.3s; + } + + /* Change background color of buttons on hover */ + div.tab button:hover { + background-color: #ddd; + } + + /* Create an active/current tablink class */ + div.tab button.active { + background-color: #ccc; + } + div.dockButton { @@ -75,15 +97,25 @@ min-height: 100vh; font-size: 20px; width: 100%; - height: 100%; + display: flex; + flex-direction: column; } + .TopBar { + height: 40px; + background: linear-gradient(#2b2b2b, #1e1e1e); + font-weight: bold; + padding: 10px 10px 10px 10px; + display: flex; + align-items: center; + width: 100vw; + font-size: 28px; + } .ChatLog { - height: calc(100vh - 128px); - /*height: calc(100vh - 103px); - width: calc(100vw - 40px);*/ - padding: 20px !important; + height: calc(100vh - 169px); + width: calc(100vw - 40px); + padding: 20px; font-size: 20px; color: white; background-color: black; @@ -105,7 +137,6 @@ .LogLogLine { margin-bottom: 15px; - padding: 10px !important; } .LogLogLineMessage { @@ -114,17 +145,15 @@ .ChatInput { color: #252525; - background: #252525; + /*background: linear-gradient(#575757 20%, #252525 100%);*/ height: 60px !important; } .ChatInputText { - padding: 5px !important; - height: 50px !important; + padding: 5px 0px 0px 5px; + height: 60px !important; width: 100vw; font-size: 20px !important; - background-color: white !important; - border: white !important; } .responsive { @@ -133,10 +162,6 @@ height: auto; } - .row .col { - padding: 0; - } - @@ -144,28 +169,37 @@ -
- -
- - - Redock +
+
+
+ + + +
+
+
+
+ +
-
Test 1
-
Test 2
-
Test 3
- +
+
+ +
+
+ +
+
+ +
+ +
- - \ No newline at end of file diff --git a/scripts/communityModules/chat/emoticons/COPYING b/scripts/communityModules/chat/emoticons/COPYING deleted file mode 100644 index e709d0c050..0000000000 --- a/scripts/communityModules/chat/emoticons/COPYING +++ /dev/null @@ -1,67 +0,0 @@ -Creative Commons Attribution-ShareAlike 2.5 License Agreement - -CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE. - -License - -THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. - -BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. - -1. Definitions - - 1. "Collective Work" means a work, such as a periodical issue, anthology or encyclopedia, in which the Work in its entirety in unmodified form, along with a number of other contributions, constituting separate and independent works in themselves, are assembled into a collective whole. A work that constitutes a Collective Work will not be considered a Derivative Work (as defined below) for the purposes of this License. - 2. "Derivative Work" means a work based upon the Work or upon the Work and other pre-existing works, such as a translation, musical arrangement, dramatization, fictionalization, motion picture version, sound recording, art reproduction, abridgment, condensation, or any other form in which the Work may be recast, transformed, or adapted, except that a work that constitutes a Collective Work will not be considered a Derivative Work for the purpose of this License. For the avoidance of doubt, where the Work is a musical composition or sound recording, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered a Derivative Work for the purpose of this License. - 3. "Licensor" means the individual or entity that offers the Work under the terms of this License. - 4. "Original Author" means the individual or entity who created the Work. - 5. "Work" means the copyrightable work of authorship offered under the terms of this License. - 6. "You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation. - 7. "License Elements" means the following high-level license attributes as selected by Licensor and indicated in the title of this License: Attribution, ShareAlike. - -2. Fair Use Rights. Nothing in this license is intended to reduce, limit, or restrict any rights arising from fair use, first sale or other limitations on the exclusive rights of the copyright owner under copyright law or other applicable laws. - -3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below: - - 1. to reproduce the Work, to incorporate the Work into one or more Collective Works, and to reproduce the Work as incorporated in the Collective Works; - 2. to create and reproduce Derivative Works; - 3. to distribute copies or phonorecords of, display publicly, perform publicly, and perform publicly by means of a digital audio transmission the Work including as incorporated in Collective Works; - 4. to distribute copies or phonorecords of, display publicly, perform publicly, and perform publicly by means of a digital audio transmission Derivative Works. - 5. - - For the avoidance of doubt, where the work is a musical composition: - 1. Performance Royalties Under Blanket Licenses. Licensor waives the exclusive right to collect, whether individually or via a performance rights society (e.g. ASCAP, BMI, SESAC), royalties for the public performance or public digital performance (e.g. webcast) of the Work. - 2. Mechanical Rights and Statutory Royalties. Licensor waives the exclusive right to collect, whether individually or via a music rights society or designated agent (e.g. Harry Fox Agency), royalties for any phonorecord You create from the Work ("cover version") and distribute, subject to the compulsory license created by 17 USC Section 115 of the US Copyright Act (or the equivalent in other jurisdictions). - 6. Webcasting Rights and Statutory Royalties. For the avoidance of doubt, where the Work is a sound recording, Licensor waives the exclusive right to collect, whether individually or via a performance-rights society (e.g. SoundExchange), royalties for the public digital performance (e.g. webcast) of the Work, subject to the compulsory license created by 17 USC Section 114 of the US Copyright Act (or the equivalent in other jurisdictions). - -The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. All rights not expressly granted by Licensor are hereby reserved. - -4. Restrictions.The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: - - 1. You may distribute, publicly display, publicly perform, or publicly digitally perform the Work only under the terms of this License, and You must include a copy of, or the Uniform Resource Identifier for, this License with every copy or phonorecord of the Work You distribute, publicly display, publicly perform, or publicly digitally perform. You may not offer or impose any terms on the Work that alter or restrict the terms of this License or the recipients' exercise of the rights granted hereunder. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties. You may not distribute, publicly display, publicly perform, or publicly digitally perform the Work with any technological measures that control access or use of the Work in a manner inconsistent with the terms of this License Agreement. The above applies to the Work as incorporated in a Collective Work, but this does not require the Collective Work apart from the Work itself to be made subject to the terms of this License. If You create a Collective Work, upon notice from any Licensor You must, to the extent practicable, remove from the Collective Work any credit as required by clause 4(c), as requested. If You create a Derivative Work, upon notice from any Licensor You must, to the extent practicable, remove from the Derivative Work any credit as required by clause 4(c), as requested. - 2. You may distribute, publicly display, publicly perform, or publicly digitally perform a Derivative Work only under the terms of this License, a later version of this License with the same License Elements as this License, or a Creative Commons iCommons license that contains the same License Elements as this License (e.g. Attribution-ShareAlike 2.5 Japan). You must include a copy of, or the Uniform Resource Identifier for, this License or other license specified in the previous sentence with every copy or phonorecord of each Derivative Work You distribute, publicly display, publicly perform, or publicly digitally perform. You may not offer or impose any terms on the Derivative Works that alter or restrict the terms of this License or the recipients' exercise of the rights granted hereunder, and You must keep intact all notices that refer to this License and to the disclaimer of warranties. You may not distribute, publicly display, publicly perform, or publicly digitally perform the Derivative Work with any technological measures that control access or use of the Work in a manner inconsistent with the terms of this License Agreement. The above applies to the Derivative Work as incorporated in a Collective Work, but this does not require the Collective Work apart from the Derivative Work itself to be made subject to the terms of this License. - 3. If you distribute, publicly display, publicly perform, or publicly digitally perform the Work or any Derivative Works or Collective Works, You must keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or (ii) if the Original Author and/or Licensor designate another party or parties (e.g. a sponsor institute, publishing entity, journal) for attribution in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; the title of the Work if supplied; to the extent reasonably practicable, the Uniform Resource Identifier, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and in the case of a Derivative Work, a credit identifying the use of the Work in the Derivative Work (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). Such credit may be implemented in any reasonable manner; provided, however, that in the case of a Derivative Work or Collective Work, at a minimum such credit will appear where any other comparable authorship credit appears and in a manner at least as prominent as such other comparable authorship credit. - -5. Representations, Warranties and Disclaimer - -UNLESS OTHERWISE AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE MATERIALS, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. - -6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. Termination - - 1. This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Derivative Works or Collective Works from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License. - 2. Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above. - -8. Miscellaneous - - 1. Each time You distribute or publicly digitally perform the Work or a Collective Work, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License. - 2. Each time You distribute or publicly digitally perform a Derivative Work, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License. - 3. If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - 4. No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent. - 5. This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You. - -Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of Licensor. - -Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, neither party will use the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time. - -Creative Commons may be contacted at http://creativecommons.org/. diff --git a/scripts/communityModules/chat/emoticons/README b/scripts/communityModules/chat/emoticons/README deleted file mode 100644 index 407409cf38..0000000000 --- a/scripts/communityModules/chat/emoticons/README +++ /dev/null @@ -1,12 +0,0 @@ -Tango Icon Theme ----------------- - -This is an icon theme that follows the Tango visual guidelines [1]. Currently -it depends on Imagemagick for creation of 24x24 bitmaps by adding a 1px padding -around the 22x22px version. For GNOME and KDE you will also need -icon-naming-utils that allow the theme to work in these environments before -they follow the new naming scheme [2]. - - -[1] http://tango-project.org/Tango_Icon_Theme_Guidelines -[2] http://tango-project.org/Standard_Icon_Naming_Specification diff --git a/scripts/communityModules/chat/emoticons/face-angel.png b/scripts/communityModules/chat/emoticons/face-angel.png deleted file mode 100644 index d2c5e940df52406a6fdb2289da426cbbf6052404..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 992 zcmV<610Vc}P)Mh53JODVWnpw>WFU8GbZ8({Xk{Qr zNlj3Y*^6%g00S&ZL_t(I%WaZdY?E~u#()3s(Dv(Cx3Ud4%Gg+pjLkTa+36f)5_C)^ z*&+$aoFp0#i5D33!gy;U(ZrZ&6hmTS6e9*vF6M5$AkhI66kSGE)R9T6O(|Wwp84AE z@b_YDiHG0Sd-3LZ-n`EvxJ~?{9Yd;L-EZjeJ+7lPNLLGhP^DCDp~_s@3eAG@OTfEu zwzl@KIWbHEKmg32dGk<{JNb#&wH=T9JKow1|3{(p0OI?L6g@relTR#Ek%e29WZOo^G6)dRp%_Ft+A_ z=s%pDlAxMaa2E2|OBu@gy)$qF0PVN89&K?`8Lxl$QMAgBFt-5J1Zrs(0I974i5E+U^E?r&OOb3V9Z5NXaMj3$KczkR+0#|7I)R!YcX9Q>Uu&&`ld zXZLS=?&C>Cn3)5C?m=Y!630IOnX8K#gy!Mkv+oeO7U#92CqY$-ET;J2%Q<9fhCpW@ zIJZUsG^LPvT&v%Vo4iO*R~sizO|uyNibLbO>FV6fLw%hbeBoU>HZ}0%&|Tn`QR~}K z3fbY6CtB4uq4+@B4D`0MbKpMEJS+LQE+dchvTv{lDg|UAj?Cr|ngNd8ypogdiAuW& zRvBp(kyaTj6D$jC3+xJ5C8U`JGmEq;NUH=w$pUC@P2jAx9J@2V6yx+4$MJcF+11}o zsHG9JVxdZlWMYZqCug{$wVPL8d++rL%m*UpVD9PD#=Q@u}?p$l4RE?Jt)8F-M92n{F`@4~Uo<}-YupJ*#N(4Gp z|2Mh53JODVWnpw>WFU8GbZ8({Xk{Qr zNlj3Y*^6%g00Q($L_t(I%cYZBXk1kkhQGb{nKL=fG%1tL)YdkEVlatqjCDGUQSd=p zEw&U2v0^nElm<2CO+;F#tsvCkH4zy>@+u7_NYsig^hq;@*h@@(XjF31=GIKoq%&vE znKOI)5GuBP^m|_G=V!4#!5s{B&?W=fB7Bh`5K%0$#@53+L|?L7_ue@#{-;Ppj;=*7o<}GP zj0J&@@qMUF;boV&`sL9%UBRxMpXd<)2_QYvb#HXXL-qvwT8~ikI_Pl(A?HjJ+I3a`xu~O4U zPOayMfv?%SJB7#>Hb38RZSspjeM!n9Eme;_gI+j8_lbSH{X&dFF~E-4l#~LcC>p`N z+jevR!4EKh4-if6#ki#w04Y2Yp;!aLXoRwn(y%7vlJg}>3J`+zPJwk{pVzAUp;RCg zZ$P*vv3i4mC@O-{MNHt+Ke~xBt3<@opamH4vQzvvzQX%|z65~};RpmoR|71vcvx7XuBIV>f{o!Ao0?(- z8=jz;FYxh{B)YRu}ns; z3%Bn$>5bea(=9T+ojumipKcWe5(KQ;=!jwAsJ@3k4DPb=fAbF@zBcB0Ue8+q0000< KMNUMnLSTY~uBcN0 diff --git a/scripts/communityModules/chat/emoticons/face-devilish.png b/scripts/communityModules/chat/emoticons/face-devilish.png deleted file mode 100644 index 8e2cd4584d20c2add45d249ce4c93b444bbb0426..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 855 zcmV-d1E~CoP)Mh53JODVWnpw>WFU8GbZ8({Xk{Qr zNlj3Y*^6%g00N^)L_t(I%dL~iPZMz%hM$>EcNOT^ItavwVq6MUsYwyz!9=1L4=C{f z9`GOsP5eJR5-%7NMDbuyPQ(B%F)p!gVU6Gd5do1llwwJzQ)cGpK`?kQUVKmQ<$Esg z^GV&2$~NEvzY@(3jZ^^*Kokf7Dc~*8<%?7fuXccI^+O{qQg@_Moa!%U`eB9_jgRBi zRcg$u`EUk($SxU6H_0b-^zT^)-lyWVw~xgD2CgKj9~zMyXSFTbhg*x$f*me=66dBfnHLm0EDriqWv2cDr@&*S*t?yX8xF0iP61+Le z*8^o(GbXNp2PT&qfOZ*(I#mz0A;2k7W$P9I+nzlmJUB>UPY;bku(`LF)4EQuuaCM!g6gp` z0EBL`>IX9LHlN4>u-wsss;Y#;VE_Vw006400x;X!3cyOrU`;3)=vw}kW$(!d3!OKZ z?dieob_3w|`vC}rLL__dGv9HYnu8j-R1TmEz|jqZM}Fi_lyCKyZZB4u9DmKG>TLwH z3aphJUPX}k@|20ItsIK%B0DwB&{QVg1eXBTM5+QFME3f8SvGk0F`WR8H^K04z&c1Mh53JODVWnpw>WFU8GbZ8({Xk{Qr zNlj3Y*^6%g00RL@L_t(I%dO8%Oq+E8$MNs~>GM2&Xw&i{YfT+5W60aKQmT&5xdgYs zfn*YctQt*>iHU}j2hW;t@xGIu6g`>Z!Nr7R#AGocOvMQ+9Uu;USVYzluu$6Pt^db^ zFTuON`}dRl1i(agd;*vPI>1+=RP7;crFJIpAY7=m9Nluy1`enTf{?%_@LuloFLD5Z zzvIsu6TN1-rOD{)ZjA<;6Z-s)9*kZbQ)bP&U{5NgCr>Aoc%*)}ti>K$hr5$!&i1X} zE3DpAfvLts@6wf%@?6)2r$TBd!1m56QpUJBzech@!87R)vF1*^vKx;tEJwbs^(-Ac zT$=)N3eeHpP;2kX41^4$gz9bb_+tjKC+cxrh1Sj(v4$X;G%-SDx(Ab?HvOpmue+dv zuY~K3xE~ZqZy$>gX0eQ069D)qcp`|Z2&$Dm%#x20(c<8H*_U5>Usdpxq9w_%-@(IR zdF=tWzB}N>p)f(sXUp8<`lr9s->sAG4&d6qaUko6Qnky3-%&KADBLZuWtOliB~G7I z8M|cgQ+}I~OCI?}lNT-q80ZON+aARoi~Ae*8PZm2fTo6oBVNm9$j#1E$ZLQg*5omH zt-@f+qdl%NbJJtxM-}in5w&@HJWb@rO!zBru%<>t#Xa8@(o)ey3fpneG=!=lgo`*Pm3R%DHw2p&WAk%PpL0E6ar_-{-50 z4Y%=p@6Slb!gs-bw8@+L++2E^QDsD1`e5&eZwNGu;9I*$*J6A$LxnJ(+^BNxYKru8 zllak5eAgimz0Cg70zeKx0Ni<9-ldgLmqqae$x*ye`_?G(;o z2U|0_+v#a890!uXTwC^)n9;1_?azW{fm9Gu0jZ)i3}f$ln7LdL7*0=f_g~-`@=-&w zFVoncL2o{VqJ{C@L+nStu)q8*f8 diff --git a/scripts/communityModules/chat/emoticons/face-grin.png b/scripts/communityModules/chat/emoticons/face-grin.png deleted file mode 100644 index d15cf2d45ae513a4cf72d175f08526643e43327e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 905 zcmV;419tq0P)Mh53JODVWnpw>WFU8GbZ8({Xk{Qr zNlj3Y*^6%g00PxXL_t(I%dL}5XcTuChoAq7VnGz4s09%v>mlODMe!qgQA-FZD3O|Vv-lBfOBF)W#u^i56Rk0` zv$ON}Ad$vX4?gGj_q^}n{R!S7*GaqLDXqd4NjzboQIJ7D?+55fb@`{?ofrQJCX}M+ zu1cjF&GlOe#Opu_gF8*>*>Bi`mzlWRpY?-&M=Hbc0zs~mg!)qS*M57<(v1lI^mT-) zfz-frk**7|Mv8?Q9-Z7h=||bT_NYG$pa3XEx@*7bvI4;|3WDwyFW#NBr_2z>%|K^xm9cNmY#fCw`~*_B7F0 zjHqT4HdY{BIn~?i|M~0qpnp$MO0=3yZTNOCLN~Z_{TavhZz6MW6Q?fyNoG$InI9Ut zaAS&C^aJFRs~D-zk#pr%07Vo@2IBPy=_Ax2nSC3OLPIDDnID@$2td%aa}`LS>=3Z( z5pyyLpy6SlR&eg(5HQ65;mb7@;92#XDzCN0pn;94w zprN4w+qTJ_Y(Y9RpiuzObyYgv(}&2A z$b&>-k=kS5y3EEcJD9q;i`m&(bX^A^91a6uSr)=~nHoGmVqF_{?iwPb_5i5Iv+~}y z<)bZ&Yu8n;j600{F@&aqQB^~^>56 zDYw7otKF6!tKiA_2##t{_DZN)fS~t+>iA;Zmqi|*KQt*UeeMh53JODVWnpw>WFU8GbZ8({Xk{Qr zNlj3Y*^6%g00QGlL_t(I%dM0DYt(fd#~-iv=W`$Lv)yLf-8R3`JTyaDh`akCL%|A- zSRvAINDz%P6@)12FOd2N{3TMyQFE2GBpMNnNRU96ciUW}EnU-^E$`;-=I(O$`P|+6 z-4DkC_1B(1zg|zCUw8_SAeEp`G_RrwV^9bhMb20Z#m|v=^j`jZJW97zNQOIOp_MIr zh;Hvd+4X2|iCfdZ5S+cj;@Ei6*!0HFG58Qc>L}gQ)%Gv<9)4NU^DC5!vmD%g7ev4q zE{#WU8=hiU#3D8DwQhEnd*WwmBnm((B)i_|l7XM**d4t}>SiMob754lj)}Q2Ki^!- zj&&oP{vku`$RQ;@$yEg^m7p)Yt1}dAb$GjLic?=~+ zxAFeLDcm-P=A9j(^fBoJko22mw;p@1MOD8+If4qhh~uKxxQK0IDrK}^!jwvA?*Ycw zRI2;={gaOuVo6$U4B<7AEtE4QkU9_{d$qvGJELqk&_?FREUnKq68m5ih+vG56OMu= zT+6_q#I6Tzz-Z>a%QO1!4W8V*mHXfRMR;us%a@m!`7{H@)LIR=U~2i<2-xl!HvX8QS+;tXr&!2~e z26FxVEa&dg5EV?>$7+0m{P-0J$Pj>voi&O4#ALCQ@xYFvOCIa@In1~Pu3a1Ey3WHs zO|Yd5b~`H>kNo6RF?PlzY8C)-RqyQ!0~a>;98tl@)3m?xJ$A5)x2Um#!umZf?uM7} z?p63>@GC8KRxeZ^-ooe!)on^T+4RhgP}9z5aUxMvpdM2$;4R!De|?1ffmEzT1EOT>7!yETO$D(T9y63;$M+pGygTqi+%tA002ovPDHLkV1hqAuUh~B diff --git a/scripts/communityModules/chat/emoticons/face-monkey.png b/scripts/communityModules/chat/emoticons/face-monkey.png deleted file mode 100644 index 69db8fa5b5e06ac699018e5c702ca91c8c532018..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 784 zcmV+r1MmEaP)L zli!O}br{A!@AsUUvvcN*PRoj2bd{Sd&NeBNKgtoI$b@CrRd8V!1(&)>D!MAN#r}YZ z2&9X;sBZE?K^>w+DXC>41BYZ+*I7!CwJsuQnVoZX&+MG@eZ5h!jDmVDUmiX@ygZMn zD*s3BUk^i-;9$n^l0tuKS?>t9jWC~B&ROKcTD@f-^vk^jLzRN-h<@T4M#?>_e$lh! zGsJok4)?gtUXM#yru#4H0qn5AH1$ z*5pqBn07m^RLi{p_{B#7%kcOF!{ZZZXNBP-$Jlq|7-<~hukAq_4_|4`p$PxJ>I?cnLVR2H#f_{ z!51m`KAI+In$T=EIX!ui{!*E#3#WAMmu9mW+1*o(aKL7t^BLREQobBQf|8?Z||@EY}#5i93I-kp@HX! zqKL2+;(IQ+j0-j;o9W`#!cB}YfA(@q@AtqepMEv{V|1f&1;_6})!>QJ-R06HASO$8 zT`xcXG{-lWuSKeS_D~b|Rf3};^4{L+HgCuFs?+_*IpR+b|c|M;Eh@2BjA=}RjL zZ`SJJM-Kt+*0~RK)WCLyeueb{zX@Em@B_%nTD{fy+b#T8nSZzZv+e+GZy^;e&C$XD O0000Mh53JODVWnpw>WFU8GbZ8({Xk{Qr zNlj3Y*^6%g00PQML_t(I%cYY|XjE4ihM(`;Gxuha%p^|882Y2FwwR=C7CKI+)QX!z zMK@hU!G$`DnoU}YQ0Sr{-Lw`#5dRpYEwzhMf(-?Y6bmi2Bq5Hm!~{XRi4@aLnPieN z$=shg$3>9VWa+d1zL$6LKEf)-`pK(E^-3TaB1xf{wXP|e7z5eU=Ihn>^1sI( zyC>K7=6+)BU7(sEm?QjWlJdwU{=Ri>)VQWEdxnW80>=93aUROG&JWI}y;K4-_Y2}^ zuo|KO8wAjj!=J5i_sdU8Cdu2|Pnih-1)zKio$sGc$J}Y`;xLkU7Lpqw@f;*KAc<#S zp@?gzdHK+>v@Dy#;|6N1pM1x*cXIB!CUAh}O-N%0;w2ET5pkQ5cp7Pb0UV2$jI+M` zt=!F{IuD>!NN?MYeVF-S!~uzEz8xIr`1$M5xPi~kUFYJDw~)jpz{i$;BbD8YU9R^6 zDDla}+Pe`GB9059862AA>d$vTV*Gw%n#;fb1){(L(GszAH?nLq0GfzYWEPRIf{oTA z^@tz7It)sncAue(hq1nooxhDli`ZHjyk>|o-4>3%cZ9n4B3J{aj#K%A*vwDZ#d&1&A<83{k+?Ge(aMmD zM;O_1;8@NLC$ZHj&>o@`SPM~z4QiNLfFxfbh`+|Y!4spI0&n~`q*k}@?l+&7e5VU} z{s1fo*lGp4Fo$_qg+Nd*9VBdgl|R2fQBtj5-x?RjKXQA_d{9Vt?Z~xd_n^~Vh?fMv zLO3%;dF%?Md!wVO)$7~(g+H+-;4#GyojkRAuhhs8v0`IfiV}AQww;XD*!a{u0{u56 U&))pRivR!s07*qoM6N<$f*0eM>Hq)$ diff --git a/scripts/communityModules/chat/emoticons/face-sad.png b/scripts/communityModules/chat/emoticons/face-sad.png deleted file mode 100644 index fa258956ae0f075e793bd2451d58989703c6563c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 918 zcmV;H18Mw;P)Mh53JODVWnpw>WFU8GbZ8({Xk{Qr zNlj3Y*^6%g00QDkL_t(I%cYY~XcT7{hoA48$xOB(tKFE5qLHc%Cb2G5x64{BsL`TC z?I{%sBDqv3X{drd2}1Q!EQK}|*+c2ELX@hY2V>GdLR`XROJhnjp(#;I+D$elad$H_ zJNtb-gh*qL{?703;pOFh1TSQugLWCnHsOmnfrwx-qb=pA3c3?r>bn=`#ea%1>50_p zL~F8U=TRzZn?P29|CG`{!{qK=c8E&CSFrGcP`{rUmKf{p{21VjQ=K$K?D zK^>wT(6VPYEqnKX`zKu&I-yiTPdkX9fOd1J$|wXx76B$Rrmn0ld-DX|7^Yc;P!B+w zpvq7jLA%e;#Voowh4zZ*{1Y&l0WftXjz5_>C_Nwf%x5B>;n5S9ljnvB$|2r+_f7UC z>e;z=9$m~K>JJl)_o73>0ga^6=+5iQ05x<) zSad^gZEa<4bO0!0DIhX1Ff<@aVQY0_AX9W@X>Mh53JODVWnpw>WFU8GbZ8({Xk{Qr zNlj3Y*^6%g00PWOL_t(I%cYY|XjEquhM)7zojbYa`ZM0i&%)UJ)t{h9CPBODLTL>O z*#!$0+6=K#q^lZ17lm#F-L{mrA=6Q`3u}~=EEJ(oN}&{HjK+d!ni`pEW5)cz#L3*5 zJKxtuG^NS1FPzL%L-ehFFDs45=#hYw7w>SR zd*2~a+lsQP(f$Jd%p>N~KQT9UchOiRI)@nk4LXMZZh|U<2p9v} zLb(T6`n$m6D=BRvyw^Fn3{e0QkZSHdsUq$Km4y*Lz0$;Z)axD3@>7arT4f3?$nin8K;E z*}P|$o9UM%fMj}^Y3)B%qbegPTToRFVmqjagIE?OD5Fb7OtFae3z(87sJzSMrEhW_ zDQYbYUL@ASkB73%PnM|LU&X$zMx!MjZ~=Ase9o1mC}S zvDz~PUb`}V2 zIKcefUm+}`D@Mxnl5afnzH3)cp#4e2vXD^d)ocU0f(`;C+(aqg%#-Wa7CSDo{$C?G zDlv8SJ6(F&g0<-|rd+`k3mCtE@s}{ZCbYhb@?tYjhOcRHLWwn5xN}1Fn4(TacelCG zJ#S&hno!|tOgWFAd(8a3-N5fmxGA!ZO-1Xx60hf9oGv WT@;MZ?8U+W0000Mh53JODVWnpw>WFU8GbZ8({Xk{Qr zNlj3Y*^6%g00QGlL_t(I%cYY~Xq#mm$3M^WK6#U@?rlxitZQ`)-Pn?LIc!;sTD7wZ z3sVrJ4m?bHv6rrh;7u5c7byr*1#=MbB1oMcbQdR`Q)o+lS8d%GrphP-Ekym+Tqz_@9PBs2_QX+ht7;ABlZ%e`76SC7@U2u^8s-7B3d7U zjceFui36{kO^Svt-n~H1jxf}D^hDmizXdEH+QOt;X7uezgww<5JC~Sr%g9|vz%oRg zIJ?tN#T{vXPE7LI()T2BFCGKFHzp9snN8?qy)$nXPvjAiP5)nMO2B7C;e_2=xXcsB>-6 zCe@o@;CMd+PalWob;id=AqX&4m(ulR4#a8@y$?bXTL48(nOMiBcZ>6vzGeEC0{LSV zI(N6yXap#;%*}F@k3MsGp|6|$i49D%4vHFpGBI4gJXesO&x?hpxbbJ5FTeht`BK1A z*`qtzLhr#YP8Bkwv(F=H7YWN(F>&F7K@qbiR;JDsI-cyOd-)4?WfJ5c=|{zTkYW!a z)&*e`v$lw?{)D!6urmD(B5qAUxK$+gRi+QVd^T?fSJ=EW56VVJi3}Bl0mg5ln?Azn z!H*wi@vE_!Y>`L*DN>s~T>A8_if5&;x=th44Whn*xwVR3zYV@X?mtbiqnF=5AFIf= z=Mh53JODVWnpw>WFU8GbZ8({Xk{Qr zNlj3Y*^6%g00QAjL_t(I%cYY~Y?Eai$3M^ew=K1dmcBNM$U%~A#*wg62Vw$&Ei)LS zhv`9$*@;U>h>4y^NVpNfXoiQm5U<9GCkY`_VvLifser{DgfwIRSz%jCx324+w{M?^ z0~v96oKlvVhAHieEXBjpEV@UWSO(5b}RJEfD%4Q-ns=j*sUi_!nV@NTU${guS zyz&lqvI~q&;NPcp?++?hFL3wzWKKEiXyzQn4S;->9&<%Zb{_k}bGIf?wO-MjU(I`yLN5or596R8SLBhJcs%Rz_h`Rpv#wuXI@7) z+d}}BkfiNoH){40!h9Bl#i7Fk93JRLua+47V)W)!V_ zbl@Y}0W@dOh5#kNzk`+%+G~iQfes|NQ3!}X1Xxs&)g*ESE$_2fw;2Dn#LxLz{`zN; zEis3KneAlXNRreGXxT)s)xe?(VCfJA|L*Uv8EpsZbDSD4bF);Vx$0xv4$BSArKvLi zmX{cRZy8}m3Ch#xuqc4WAY@Kde!YN^9E9aLOcCJP4k0&0Bobj$G(tEW!ZHN9u>?Eb zqLTj}5jH0P%rA5L#=Fnm8SHrBaaN28E|~>JtEKS!&wB00000NkvXXu0mjf^&FEX diff --git a/scripts/communityModules/chat/emoticons/face-wink.png b/scripts/communityModules/chat/emoticons/face-wink.png deleted file mode 100644 index 46be685577ce2122c83c5190cd1c6dedb87ef82c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 914 zcmV;D18w|?P)Mh53JODVWnpw>WFU8GbZ8({Xk{Qr zNlj3Y*^6%g00Q1gL_t(I%cYY~Xp?6g$3M^WzIoGFO>1gmZAFGtY-`OxW6ZQ}LMJSA zf*`f9gVM`->By(C~S;QFo!X`2-2ws^`fBDL0h`4u2tzs2cs%xMw_OtZQg%* z9uGmB_PFo)_xtkY`$zB=#{21&zU&sRNZ^YICPi(jtO_uk98y2MeJ}p=7?+O7G$y-J z4f}csL|Z}Df;*4*^geT=7y0MzjWK1ZzT^)~y+JVEPuy4(H(CbH#DbAEsQFt6!vt-D z@1k87>QXqx61gA0ET}LCcYm*@03?8P$h3Su6bo3hX!{-_{4Rvwfi)W;ya`da8J4E8 z^ekJCpN@&L%Dhq_$NTAR-1TwFT3ZVS5Ud4Nfn^sF-p;_+x4D_kBiHQ&LlX>#Sl_lk z_4^647eGpn?uL$|sD%-P0XKhr!guE;N%WitQ!+B~h{@b@Ff7197w!;Aeu6Gnx&ch# zkO)NEP>=5*42#Z#?Q|a6%!!i%sIWJ&iO$ZCs&;9>UnUT1LzH!*>VZ$hS4(KG#PrNl zsQ9llvL7-uIKX=?G4#Sca(_Pqy9mM6;1dBbF)5n5CR%Y`aP9VWM*m2Y+FhV=eI4bp z$Dh+vMC$^aJ)h-pM>AU@OK7_UCPe^K*N}Dd6KUzV97%u3qbDUUUHOH{oX2e5p*dDd z`?e-}(s9}nhY-bE`1uFukjR3@q{bMY8@ZT{esF;1XFszp9wD{o0A^@AQfxrfG=XoU z7iLh;e?u9om>a!{2pPlRSBsSWjL~hMo=#cbeJab7U|I+%k-iDOhjwk0U5(WZ?O^8e z;8-HV`>%^sZ}sKQeN}LbR*a@&$VH7PEumk`qZa=KS0J|>!&}wPUl#@ovOd_iVha vs[a] ? + (-vp[a]+tp[a]+ts[a]/2 > vs[a]/2 && tp[a]+ts[a]-ps[a] >= 0 ? tp[a]+ts[a]-ps[a] : tp[a]) : + tp[a], + -vp[b]+tp[b]+ts[b]+ps[b]-l+l*c > vs[b] ? + (-vp[b]+tp[b]+ts[b]/2 > vs[b]/2 && tp[b]+ts[b]-l-l*c >= 0 ? tp[b]+ts[b]-l-l*c : tp[b]+ts[b]-l+l*c) : + (tp[b]+ts[b]-l+l*c >= 0 ? tp[b]+ts[b]-l+l*c : tp[b]+ts[b]-l-l*c) + ]; + } + + var x = pp[a]; + var y = pp[b]; + var positionValue = thisObj.fixed ? 'fixed' : 'absolute'; + var contractShadow = + (pp[0] + ps[0] > tp[0] || pp[0] < tp[0] + ts[0]) && + (pp[1] + ps[1] < tp[1] + ts[1]); + + jsc._drawPosition(thisObj, x, y, positionValue, contractShadow); + } + }, + + + _drawPosition : function (thisObj, x, y, positionValue, contractShadow) { + var vShadow = contractShadow ? 0 : thisObj.shadowBlur; // px + + jsc.picker.wrap.style.position = positionValue; + jsc.picker.wrap.style.left = x + 'px'; + jsc.picker.wrap.style.top = y + 'px'; + + jsc.setBoxShadow( + jsc.picker.boxS, + thisObj.shadow ? + new jsc.BoxShadow(0, vShadow, thisObj.shadowBlur, 0, thisObj.shadowColor) : + null); + }, + + + getPickerDims : function (thisObj) { + var displaySlider = !!jsc.getSliderComponent(thisObj); + var dims = [ + 2 * thisObj.insetWidth + 2 * thisObj.padding + thisObj.width + + (displaySlider ? 2 * thisObj.insetWidth + jsc.getPadToSliderPadding(thisObj) + thisObj.sliderSize : 0), + 2 * thisObj.insetWidth + 2 * thisObj.padding + thisObj.height + + (thisObj.closable ? 2 * thisObj.insetWidth + thisObj.padding + thisObj.buttonHeight : 0) + ]; + return dims; + }, + + + getPickerOuterDims : function (thisObj) { + var dims = jsc.getPickerDims(thisObj); + return [ + dims[0] + 2 * thisObj.borderWidth, + dims[1] + 2 * thisObj.borderWidth + ]; + }, + + + getPadToSliderPadding : function (thisObj) { + return Math.max(thisObj.padding, 1.5 * (2 * thisObj.pointerBorderWidth + thisObj.pointerThickness)); + }, + + + getPadYComponent : function (thisObj) { + switch (thisObj.mode.charAt(1).toLowerCase()) { + case 'v': return 'v'; break; + } + return 's'; + }, + + + getSliderComponent : function (thisObj) { + if (thisObj.mode.length > 2) { + switch (thisObj.mode.charAt(2).toLowerCase()) { + case 's': return 's'; break; + case 'v': return 'v'; break; + } + } + return null; + }, + + + onDocumentMouseDown : function (e) { + if (!e) { e = window.event; } + var target = e.target || e.srcElement; + + if (target._jscLinkedInstance) { + if (target._jscLinkedInstance.showOnClick) { + target._jscLinkedInstance.show(); + } + } else if (target._jscControlName) { + jsc.onControlPointerStart(e, target, target._jscControlName, 'mouse'); + } else { + // Mouse is outside the picker controls -> hide the color picker! + if (jsc.picker && jsc.picker.owner) { + jsc.picker.owner.hide(); + } + } + }, + + + onDocumentTouchStart : function (e) { + if (!e) { e = window.event; } + var target = e.target || e.srcElement; + + if (target._jscLinkedInstance) { + if (target._jscLinkedInstance.showOnClick) { + target._jscLinkedInstance.show(); + } + } else if (target._jscControlName) { + jsc.onControlPointerStart(e, target, target._jscControlName, 'touch'); + } else { + if (jsc.picker && jsc.picker.owner) { + jsc.picker.owner.hide(); + } + } + }, + + + onWindowResize : function (e) { + jsc.redrawPosition(); + }, + + + onParentScroll : function (e) { + // hide the picker when one of the parent elements is scrolled + if (jsc.picker && jsc.picker.owner) { + jsc.picker.owner.hide(); + } + }, + + + _pointerMoveEvent : { + mouse: 'mousemove', + touch: 'touchmove' + }, + _pointerEndEvent : { + mouse: 'mouseup', + touch: 'touchend' + }, + + + _pointerOrigin : null, + _capturedTarget : null, + + + onControlPointerStart : function (e, target, controlName, pointerType) { + var thisObj = target._jscInstance; + + jsc.preventDefault(e); + jsc.captureTarget(target); + + var registerDragEvents = function (doc, offset) { + jsc.attachGroupEvent('drag', doc, jsc._pointerMoveEvent[pointerType], + jsc.onDocumentPointerMove(e, target, controlName, pointerType, offset)); + jsc.attachGroupEvent('drag', doc, jsc._pointerEndEvent[pointerType], + jsc.onDocumentPointerEnd(e, target, controlName, pointerType)); + }; + + registerDragEvents(document, [0, 0]); + + if (window.parent && window.frameElement) { + var rect = window.frameElement.getBoundingClientRect(); + var ofs = [-rect.left, -rect.top]; + registerDragEvents(window.parent.window.document, ofs); + } + + var abs = jsc.getAbsPointerPos(e); + var rel = jsc.getRelPointerPos(e); + jsc._pointerOrigin = { + x: abs.x - rel.x, + y: abs.y - rel.y + }; + + switch (controlName) { + case 'pad': + // if the slider is at the bottom, move it up + switch (jsc.getSliderComponent(thisObj)) { + case 's': if (thisObj.hsv[1] === 0) { thisObj.fromHSV(null, 100, null); }; break; + case 'v': if (thisObj.hsv[2] === 0) { thisObj.fromHSV(null, null, 100); }; break; + } + jsc.setPad(thisObj, e, 0, 0); + break; + + case 'sld': + jsc.setSld(thisObj, e, 0); + break; + } + + jsc.dispatchFineChange(thisObj); + }, + + + onDocumentPointerMove : function (e, target, controlName, pointerType, offset) { + return function (e) { + var thisObj = target._jscInstance; + switch (controlName) { + case 'pad': + if (!e) { e = window.event; } + jsc.setPad(thisObj, e, offset[0], offset[1]); + jsc.dispatchFineChange(thisObj); + break; + + case 'sld': + if (!e) { e = window.event; } + jsc.setSld(thisObj, e, offset[1]); + jsc.dispatchFineChange(thisObj); + break; + } + } + }, + + + onDocumentPointerEnd : function (e, target, controlName, pointerType) { + return function (e) { + var thisObj = target._jscInstance; + jsc.detachGroupEvents('drag'); + jsc.releaseTarget(); + // Always dispatch changes after detaching outstanding mouse handlers, + // in case some user interaction will occur in user's onchange callback + // that would intrude with current mouse events + jsc.dispatchChange(thisObj); + }; + }, + + + dispatchChange : function (thisObj) { + if (thisObj.valueElement) { + if (jsc.isElementType(thisObj.valueElement, 'input')) { + jsc.fireEvent(thisObj.valueElement, 'change'); + } + } + }, + + + dispatchFineChange : function (thisObj) { + if (thisObj.onFineChange) { + var callback; + if (typeof thisObj.onFineChange === 'string') { + callback = new Function (thisObj.onFineChange); + } else { + callback = thisObj.onFineChange; + } + callback.call(thisObj); + } + }, + + + setPad : function (thisObj, e, ofsX, ofsY) { + var pointerAbs = jsc.getAbsPointerPos(e); + var x = ofsX + pointerAbs.x - jsc._pointerOrigin.x - thisObj.padding - thisObj.insetWidth; + var y = ofsY + pointerAbs.y - jsc._pointerOrigin.y - thisObj.padding - thisObj.insetWidth; + + var xVal = x * (360 / (thisObj.width - 1)); + var yVal = 100 - (y * (100 / (thisObj.height - 1))); + + switch (jsc.getPadYComponent(thisObj)) { + case 's': thisObj.fromHSV(xVal, yVal, null, jsc.leaveSld); break; + case 'v': thisObj.fromHSV(xVal, null, yVal, jsc.leaveSld); break; + } + }, + + + setSld : function (thisObj, e, ofsY) { + var pointerAbs = jsc.getAbsPointerPos(e); + var y = ofsY + pointerAbs.y - jsc._pointerOrigin.y - thisObj.padding - thisObj.insetWidth; + + var yVal = 100 - (y * (100 / (thisObj.height - 1))); + + switch (jsc.getSliderComponent(thisObj)) { + case 's': thisObj.fromHSV(null, yVal, null, jsc.leavePad); break; + case 'v': thisObj.fromHSV(null, null, yVal, jsc.leavePad); break; + } + }, + + + _vmlNS : 'jsc_vml_', + _vmlCSS : 'jsc_vml_css_', + _vmlReady : false, + + + initVML : function () { + if (!jsc._vmlReady) { + // init VML namespace + var doc = document; + if (!doc.namespaces[jsc._vmlNS]) { + doc.namespaces.add(jsc._vmlNS, 'urn:schemas-microsoft-com:vml'); + } + if (!doc.styleSheets[jsc._vmlCSS]) { + var tags = ['shape', 'shapetype', 'group', 'background', 'path', 'formulas', 'handles', 'fill', 'stroke', 'shadow', 'textbox', 'textpath', 'imagedata', 'line', 'polyline', 'curve', 'rect', 'roundrect', 'oval', 'arc', 'image']; + var ss = doc.createStyleSheet(); + ss.owningElement.id = jsc._vmlCSS; + for (var i = 0; i < tags.length; i += 1) { + ss.addRule(jsc._vmlNS + '\\:' + tags[i], 'behavior:url(#default#VML);'); + } + } + jsc._vmlReady = true; + } + }, + + + createPalette : function () { + + var paletteObj = { + elm: null, + draw: null + }; + + if (jsc.isCanvasSupported) { + // Canvas implementation for modern browsers + + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + + var drawFunc = function (width, height, type) { + canvas.width = width; + canvas.height = height; + + ctx.clearRect(0, 0, canvas.width, canvas.height); + + var hGrad = ctx.createLinearGradient(0, 0, canvas.width, 0); + hGrad.addColorStop(0 / 6, '#F00'); + hGrad.addColorStop(1 / 6, '#FF0'); + hGrad.addColorStop(2 / 6, '#0F0'); + hGrad.addColorStop(3 / 6, '#0FF'); + hGrad.addColorStop(4 / 6, '#00F'); + hGrad.addColorStop(5 / 6, '#F0F'); + hGrad.addColorStop(6 / 6, '#F00'); + + ctx.fillStyle = hGrad; + ctx.fillRect(0, 0, canvas.width, canvas.height); + + var vGrad = ctx.createLinearGradient(0, 0, 0, canvas.height); + switch (type.toLowerCase()) { + case 's': + vGrad.addColorStop(0, 'rgba(255,255,255,0)'); + vGrad.addColorStop(1, 'rgba(255,255,255,1)'); + break; + case 'v': + vGrad.addColorStop(0, 'rgba(0,0,0,0)'); + vGrad.addColorStop(1, 'rgba(0,0,0,1)'); + break; + } + ctx.fillStyle = vGrad; + ctx.fillRect(0, 0, canvas.width, canvas.height); + }; + + paletteObj.elm = canvas; + paletteObj.draw = drawFunc; + + } else { + // VML fallback for IE 7 and 8 + + jsc.initVML(); + + var vmlContainer = document.createElement('div'); + vmlContainer.style.position = 'relative'; + vmlContainer.style.overflow = 'hidden'; + + var hGrad = document.createElement(jsc._vmlNS + ':fill'); + hGrad.type = 'gradient'; + hGrad.method = 'linear'; + hGrad.angle = '90'; + hGrad.colors = '16.67% #F0F, 33.33% #00F, 50% #0FF, 66.67% #0F0, 83.33% #FF0' + + var hRect = document.createElement(jsc._vmlNS + ':rect'); + hRect.style.position = 'absolute'; + hRect.style.left = -1 + 'px'; + hRect.style.top = -1 + 'px'; + hRect.stroked = false; + hRect.appendChild(hGrad); + vmlContainer.appendChild(hRect); + + var vGrad = document.createElement(jsc._vmlNS + ':fill'); + vGrad.type = 'gradient'; + vGrad.method = 'linear'; + vGrad.angle = '180'; + vGrad.opacity = '0'; + + var vRect = document.createElement(jsc._vmlNS + ':rect'); + vRect.style.position = 'absolute'; + vRect.style.left = -1 + 'px'; + vRect.style.top = -1 + 'px'; + vRect.stroked = false; + vRect.appendChild(vGrad); + vmlContainer.appendChild(vRect); + + var drawFunc = function (width, height, type) { + vmlContainer.style.width = width + 'px'; + vmlContainer.style.height = height + 'px'; + + hRect.style.width = + vRect.style.width = + (width + 1) + 'px'; + hRect.style.height = + vRect.style.height = + (height + 1) + 'px'; + + // Colors must be specified during every redraw, otherwise IE won't display + // a full gradient during a subsequential redraw + hGrad.color = '#F00'; + hGrad.color2 = '#F00'; + + switch (type.toLowerCase()) { + case 's': + vGrad.color = vGrad.color2 = '#FFF'; + break; + case 'v': + vGrad.color = vGrad.color2 = '#000'; + break; + } + }; + + paletteObj.elm = vmlContainer; + paletteObj.draw = drawFunc; + } + + return paletteObj; + }, + + + createSliderGradient : function () { + + var sliderObj = { + elm: null, + draw: null + }; + + if (jsc.isCanvasSupported) { + // Canvas implementation for modern browsers + + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + + var drawFunc = function (width, height, color1, color2) { + canvas.width = width; + canvas.height = height; + + ctx.clearRect(0, 0, canvas.width, canvas.height); + + var grad = ctx.createLinearGradient(0, 0, 0, canvas.height); + grad.addColorStop(0, color1); + grad.addColorStop(1, color2); + + ctx.fillStyle = grad; + ctx.fillRect(0, 0, canvas.width, canvas.height); + }; + + sliderObj.elm = canvas; + sliderObj.draw = drawFunc; + + } else { + // VML fallback for IE 7 and 8 + + jsc.initVML(); + + var vmlContainer = document.createElement('div'); + vmlContainer.style.position = 'relative'; + vmlContainer.style.overflow = 'hidden'; + + var grad = document.createElement(jsc._vmlNS + ':fill'); + grad.type = 'gradient'; + grad.method = 'linear'; + grad.angle = '180'; + + var rect = document.createElement(jsc._vmlNS + ':rect'); + rect.style.position = 'absolute'; + rect.style.left = -1 + 'px'; + rect.style.top = -1 + 'px'; + rect.stroked = false; + rect.appendChild(grad); + vmlContainer.appendChild(rect); + + var drawFunc = function (width, height, color1, color2) { + vmlContainer.style.width = width + 'px'; + vmlContainer.style.height = height + 'px'; + + rect.style.width = (width + 1) + 'px'; + rect.style.height = (height + 1) + 'px'; + + grad.color = color1; + grad.color2 = color2; + }; + + sliderObj.elm = vmlContainer; + sliderObj.draw = drawFunc; + } + + return sliderObj; + }, + + + leaveValue : 1<<0, + leaveStyle : 1<<1, + leavePad : 1<<2, + leaveSld : 1<<3, + + + BoxShadow : (function () { + var BoxShadow = function (hShadow, vShadow, blur, spread, color, inset) { + this.hShadow = hShadow; + this.vShadow = vShadow; + this.blur = blur; + this.spread = spread; + this.color = color; + this.inset = !!inset; + }; + + BoxShadow.prototype.toString = function () { + var vals = [ + Math.round(this.hShadow) + 'px', + Math.round(this.vShadow) + 'px', + Math.round(this.blur) + 'px', + Math.round(this.spread) + 'px', + this.color + ]; + if (this.inset) { + vals.push('inset'); + } + return vals.join(' '); + }; + + return BoxShadow; + })(), + + + // + // Usage: + // var myColor = new jscolor( [, ]) + // + + jscolor : function (targetElement, options) { + + // General options + // + this.value = null; // initial HEX color. To change it later, use methods fromString(), fromHSV() and fromRGB() + this.valueElement = targetElement; // element that will be used to display and input the color code + this.styleElement = targetElement; // element that will preview the picked color using CSS backgroundColor + this.required = true; // whether the associated text can be left empty + this.refine = true; // whether to refine the entered color code (e.g. uppercase it and remove whitespace) + this.hash = false; // whether to prefix the HEX color code with # symbol + this.uppercase = true; // whether to show the color code in upper case + this.onFineChange = null; // called instantly every time the color changes (value can be either a function or a string with javascript code) + this.activeClass = 'jscolor-active'; // class to be set to the target element when a picker window is open on it + this.overwriteImportant = false; // whether to overwrite colors of styleElement using !important + this.minS = 0; // min allowed saturation (0 - 100) + this.maxS = 100; // max allowed saturation (0 - 100) + this.minV = 0; // min allowed value (brightness) (0 - 100) + this.maxV = 100; // max allowed value (brightness) (0 - 100) + + // Accessing the picked color + // + this.hsv = [0, 0, 100]; // read-only [0-360, 0-100, 0-100] + this.rgb = [255, 255, 255]; // read-only [0-255, 0-255, 0-255] + + // Color Picker options + // + this.width = 181; // width of color palette (in px) + this.height = 101; // height of color palette (in px) + this.showOnClick = true; // whether to display the color picker when user clicks on its target element + this.mode = 'HSV'; // HSV | HVS | HS | HV - layout of the color picker controls + this.position = 'bottom'; // left | right | top | bottom - position relative to the target element + this.smartPosition = true; // automatically change picker position when there is not enough space for it + this.sliderSize = 16; // px + this.crossSize = 8; // px + this.closable = false; // whether to display the Close button + this.closeText = 'Close'; + this.buttonColor = '#000000'; // CSS color + this.buttonHeight = 18; // px + this.padding = 12; // px + this.backgroundColor = '#FFFFFF'; // CSS color + this.borderWidth = 1; // px + this.borderColor = '#BBBBBB'; // CSS color + this.borderRadius = 8; // px + this.insetWidth = 1; // px + this.insetColor = '#BBBBBB'; // CSS color + this.shadow = true; // whether to display shadow + this.shadowBlur = 15; // px + this.shadowColor = 'rgba(0,0,0,0.2)'; // CSS color + this.pointerColor = '#4C4C4C'; // px + this.pointerBorderColor = '#FFFFFF'; // px + this.pointerBorderWidth = 1; // px + this.pointerThickness = 2; // px + this.zIndex = 1000; + this.container = null; // where to append the color picker (BODY element by default) + + + for (var opt in options) { + if (options.hasOwnProperty(opt)) { + this[opt] = options[opt]; + } + } + + + this.hide = function () { + if (isPickerOwner()) { + detachPicker(); + } + }; + + + this.show = function () { + drawPicker(); + }; + + + this.redraw = function () { + if (isPickerOwner()) { + drawPicker(); + } + }; + + + this.importColor = function () { + if (!this.valueElement) { + this.exportColor(); + } else { + if (jsc.isElementType(this.valueElement, 'input')) { + if (!this.refine) { + if (!this.fromString(this.valueElement.value, jsc.leaveValue)) { + if (this.styleElement) { + this.styleElement.style.backgroundImage = this.styleElement._jscOrigStyle.backgroundImage; + this.styleElement.style.backgroundColor = this.styleElement._jscOrigStyle.backgroundColor; + this.styleElement.style.color = this.styleElement._jscOrigStyle.color; + } + this.exportColor(jsc.leaveValue | jsc.leaveStyle); + } + } else if (!this.required && /^\s*$/.test(this.valueElement.value)) { + this.valueElement.value = ''; + if (this.styleElement) { + this.styleElement.style.backgroundImage = this.styleElement._jscOrigStyle.backgroundImage; + this.styleElement.style.backgroundColor = this.styleElement._jscOrigStyle.backgroundColor; + this.styleElement.style.color = this.styleElement._jscOrigStyle.color; + } + this.exportColor(jsc.leaveValue | jsc.leaveStyle); + + } else if (this.fromString(this.valueElement.value)) { + // managed to import color successfully from the value -> OK, don't do anything + } else { + this.exportColor(); + } + } else { + // not an input element -> doesn't have any value + this.exportColor(); + } + } + }; + + + this.exportColor = function (flags) { + if (!(flags & jsc.leaveValue) && this.valueElement) { + var value = this.toString(); + if (this.uppercase) { value = value.toUpperCase(); } + if (this.hash) { value = '#' + value; } + + if (jsc.isElementType(this.valueElement, 'input')) { + this.valueElement.value = value; + } else { + this.valueElement.innerHTML = value; + } + } + if (!(flags & jsc.leaveStyle)) { + if (this.styleElement) { + var bgColor = '#' + this.toString(); + var fgColor = this.isLight() ? '#000' : '#FFF'; + + this.styleElement.style.backgroundImage = 'none'; + this.styleElement.style.backgroundColor = bgColor; + this.styleElement.style.color = fgColor; + + if (this.overwriteImportant) { + this.styleElement.setAttribute('style', + 'background: ' + bgColor + ' !important; ' + + 'color: ' + fgColor + ' !important;' + ); + } + } + } + if (!(flags & jsc.leavePad) && isPickerOwner()) { + redrawPad(); + } + if (!(flags & jsc.leaveSld) && isPickerOwner()) { + redrawSld(); + } + }; + + + // h: 0-360 + // s: 0-100 + // v: 0-100 + // + this.fromHSV = function (h, s, v, flags) { // null = don't change + if (h !== null) { + if (isNaN(h)) { return false; } + h = Math.max(0, Math.min(360, h)); + } + if (s !== null) { + if (isNaN(s)) { return false; } + s = Math.max(0, Math.min(100, this.maxS, s), this.minS); + } + if (v !== null) { + if (isNaN(v)) { return false; } + v = Math.max(0, Math.min(100, this.maxV, v), this.minV); + } + + this.rgb = HSV_RGB( + h===null ? this.hsv[0] : (this.hsv[0]=h), + s===null ? this.hsv[1] : (this.hsv[1]=s), + v===null ? this.hsv[2] : (this.hsv[2]=v) + ); + + this.exportColor(flags); + }; + + + // r: 0-255 + // g: 0-255 + // b: 0-255 + // + this.fromRGB = function (r, g, b, flags) { // null = don't change + if (r !== null) { + if (isNaN(r)) { return false; } + r = Math.max(0, Math.min(255, r)); + } + if (g !== null) { + if (isNaN(g)) { return false; } + g = Math.max(0, Math.min(255, g)); + } + if (b !== null) { + if (isNaN(b)) { return false; } + b = Math.max(0, Math.min(255, b)); + } + + var hsv = RGB_HSV( + r===null ? this.rgb[0] : r, + g===null ? this.rgb[1] : g, + b===null ? this.rgb[2] : b + ); + if (hsv[0] !== null) { + this.hsv[0] = Math.max(0, Math.min(360, hsv[0])); + } + if (hsv[2] !== 0) { + this.hsv[1] = hsv[1]===null ? null : Math.max(0, this.minS, Math.min(100, this.maxS, hsv[1])); + } + this.hsv[2] = hsv[2]===null ? null : Math.max(0, this.minV, Math.min(100, this.maxV, hsv[2])); + + // update RGB according to final HSV, as some values might be trimmed + var rgb = HSV_RGB(this.hsv[0], this.hsv[1], this.hsv[2]); + this.rgb[0] = rgb[0]; + this.rgb[1] = rgb[1]; + this.rgb[2] = rgb[2]; + + this.exportColor(flags); + }; + + + this.fromString = function (str, flags) { + var m; + if (m = str.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i)) { + // HEX notation + // + + if (m[1].length === 6) { + // 6-char notation + this.fromRGB( + parseInt(m[1].substr(0,2),16), + parseInt(m[1].substr(2,2),16), + parseInt(m[1].substr(4,2),16), + flags + ); + } else { + // 3-char notation + this.fromRGB( + parseInt(m[1].charAt(0) + m[1].charAt(0),16), + parseInt(m[1].charAt(1) + m[1].charAt(1),16), + parseInt(m[1].charAt(2) + m[1].charAt(2),16), + flags + ); + } + return true; + + } else if (m = str.match(/^\W*rgba?\(([^)]*)\)\W*$/i)) { + var params = m[1].split(','); + var re = /^\s*(\d*)(\.\d+)?\s*$/; + var mR, mG, mB; + if ( + params.length >= 3 && + (mR = params[0].match(re)) && + (mG = params[1].match(re)) && + (mB = params[2].match(re)) + ) { + var r = parseFloat((mR[1] || '0') + (mR[2] || '')); + var g = parseFloat((mG[1] || '0') + (mG[2] || '')); + var b = parseFloat((mB[1] || '0') + (mB[2] || '')); + this.fromRGB(r, g, b, flags); + return true; + } + } + return false; + }; + + + this.toString = function () { + return ( + (0x100 | Math.round(this.rgb[0])).toString(16).substr(1) + + (0x100 | Math.round(this.rgb[1])).toString(16).substr(1) + + (0x100 | Math.round(this.rgb[2])).toString(16).substr(1) + ); + }; + + + this.toHEXString = function () { + return '#' + this.toString().toUpperCase(); + }; + + + this.toRGBString = function () { + return ('rgb(' + + Math.round(this.rgb[0]) + ',' + + Math.round(this.rgb[1]) + ',' + + Math.round(this.rgb[2]) + ')' + ); + }; + + + this.isLight = function () { + return ( + 0.213 * this.rgb[0] + + 0.715 * this.rgb[1] + + 0.072 * this.rgb[2] > + 255 / 2 + ); + }; + + + this._processParentElementsInDOM = function () { + if (this._linkedElementsProcessed) { return; } + this._linkedElementsProcessed = true; + + var elm = this.targetElement; + do { + // If the target element or one of its parent nodes has fixed position, + // then use fixed positioning instead + // + // Note: In Firefox, getComputedStyle returns null in a hidden iframe, + // that's why we need to check if the returned style object is non-empty + var currStyle = jsc.getStyle(elm); + if (currStyle && currStyle.position.toLowerCase() === 'fixed') { + this.fixed = true; + } + + if (elm !== this.targetElement) { + // Ensure to attach onParentScroll only once to each parent element + // (multiple targetElements can share the same parent nodes) + // + // Note: It's not just offsetParents that can be scrollable, + // that's why we loop through all parent nodes + if (!elm._jscEventsAttached) { + jsc.attachEvent(elm, 'scroll', jsc.onParentScroll); + elm._jscEventsAttached = true; + } + } + } while ((elm = elm.parentNode) && !jsc.isElementType(elm, 'body')); + }; + + + // r: 0-255 + // g: 0-255 + // b: 0-255 + // + // returns: [ 0-360, 0-100, 0-100 ] + // + function RGB_HSV (r, g, b) { + r /= 255; + g /= 255; + b /= 255; + var n = Math.min(Math.min(r,g),b); + var v = Math.max(Math.max(r,g),b); + var m = v - n; + if (m === 0) { return [ null, 0, 100 * v ]; } + var h = r===n ? 3+(b-g)/m : (g===n ? 5+(r-b)/m : 1+(g-r)/m); + return [ + 60 * (h===6?0:h), + 100 * (m/v), + 100 * v + ]; + } + + + // h: 0-360 + // s: 0-100 + // v: 0-100 + // + // returns: [ 0-255, 0-255, 0-255 ] + // + function HSV_RGB (h, s, v) { + var u = 255 * (v / 100); + + if (h === null) { + return [ u, u, u ]; + } + + h /= 60; + s /= 100; + + var i = Math.floor(h); + var f = i%2 ? h-i : 1-(h-i); + var m = u * (1 - s); + var n = u * (1 - s * f); + switch (i) { + case 6: + case 0: return [u,n,m]; + case 1: return [n,u,m]; + case 2: return [m,u,n]; + case 3: return [m,n,u]; + case 4: return [n,m,u]; + case 5: return [u,m,n]; + } + } + + + function detachPicker () { + jsc.unsetClass(THIS.targetElement, THIS.activeClass); + jsc.picker.wrap.parentNode.removeChild(jsc.picker.wrap); + delete jsc.picker.owner; + } + + + function drawPicker () { + + // At this point, when drawing the picker, we know what the parent elements are + // and we can do all related DOM operations, such as registering events on them + // or checking their positioning + THIS._processParentElementsInDOM(); + + if (!jsc.picker) { + jsc.picker = { + owner: null, + wrap : document.createElement('div'), + box : document.createElement('div'), + boxS : document.createElement('div'), // shadow area + boxB : document.createElement('div'), // border + pad : document.createElement('div'), + padB : document.createElement('div'), // border + padM : document.createElement('div'), // mouse/touch area + padPal : jsc.createPalette(), + cross : document.createElement('div'), + crossBY : document.createElement('div'), // border Y + crossBX : document.createElement('div'), // border X + crossLY : document.createElement('div'), // line Y + crossLX : document.createElement('div'), // line X + sld : document.createElement('div'), + sldB : document.createElement('div'), // border + sldM : document.createElement('div'), // mouse/touch area + sldGrad : jsc.createSliderGradient(), + sldPtrS : document.createElement('div'), // slider pointer spacer + sldPtrIB : document.createElement('div'), // slider pointer inner border + sldPtrMB : document.createElement('div'), // slider pointer middle border + sldPtrOB : document.createElement('div'), // slider pointer outer border + btn : document.createElement('div'), + btnT : document.createElement('span') // text + }; + + jsc.picker.pad.appendChild(jsc.picker.padPal.elm); + jsc.picker.padB.appendChild(jsc.picker.pad); + jsc.picker.cross.appendChild(jsc.picker.crossBY); + jsc.picker.cross.appendChild(jsc.picker.crossBX); + jsc.picker.cross.appendChild(jsc.picker.crossLY); + jsc.picker.cross.appendChild(jsc.picker.crossLX); + jsc.picker.padB.appendChild(jsc.picker.cross); + jsc.picker.box.appendChild(jsc.picker.padB); + jsc.picker.box.appendChild(jsc.picker.padM); + + jsc.picker.sld.appendChild(jsc.picker.sldGrad.elm); + jsc.picker.sldB.appendChild(jsc.picker.sld); + jsc.picker.sldB.appendChild(jsc.picker.sldPtrOB); + jsc.picker.sldPtrOB.appendChild(jsc.picker.sldPtrMB); + jsc.picker.sldPtrMB.appendChild(jsc.picker.sldPtrIB); + jsc.picker.sldPtrIB.appendChild(jsc.picker.sldPtrS); + jsc.picker.box.appendChild(jsc.picker.sldB); + jsc.picker.box.appendChild(jsc.picker.sldM); + + jsc.picker.btn.appendChild(jsc.picker.btnT); + jsc.picker.box.appendChild(jsc.picker.btn); + + jsc.picker.boxB.appendChild(jsc.picker.box); + jsc.picker.wrap.appendChild(jsc.picker.boxS); + jsc.picker.wrap.appendChild(jsc.picker.boxB); + } + + var p = jsc.picker; + + var displaySlider = !!jsc.getSliderComponent(THIS); + var dims = jsc.getPickerDims(THIS); + var crossOuterSize = (2 * THIS.pointerBorderWidth + THIS.pointerThickness + 2 * THIS.crossSize); + var padToSliderPadding = jsc.getPadToSliderPadding(THIS); + var borderRadius = Math.min( + THIS.borderRadius, + Math.round(THIS.padding * Math.PI)); // px + var padCursor = 'crosshair'; + + // wrap + p.wrap.style.clear = 'both'; + p.wrap.style.width = (dims[0] + 2 * THIS.borderWidth) + 'px'; + p.wrap.style.height = (dims[1] + 2 * THIS.borderWidth) + 'px'; + p.wrap.style.zIndex = THIS.zIndex; + + // picker + p.box.style.width = dims[0] + 'px'; + p.box.style.height = dims[1] + 'px'; + + p.boxS.style.position = 'absolute'; + p.boxS.style.left = '0'; + p.boxS.style.top = '0'; + p.boxS.style.width = '100%'; + p.boxS.style.height = '100%'; + jsc.setBorderRadius(p.boxS, borderRadius + 'px'); + + // picker border + p.boxB.style.position = 'relative'; + p.boxB.style.border = THIS.borderWidth + 'px solid'; + p.boxB.style.borderColor = THIS.borderColor; + p.boxB.style.background = THIS.backgroundColor; + jsc.setBorderRadius(p.boxB, borderRadius + 'px'); + + // IE hack: + // If the element is transparent, IE will trigger the event on the elements under it, + // e.g. on Canvas or on elements with border + p.padM.style.background = + p.sldM.style.background = + '#FFF'; + jsc.setStyle(p.padM, 'opacity', '0'); + jsc.setStyle(p.sldM, 'opacity', '0'); + + // pad + p.pad.style.position = 'relative'; + p.pad.style.width = THIS.width + 'px'; + p.pad.style.height = THIS.height + 'px'; + + // pad palettes (HSV and HVS) + p.padPal.draw(THIS.width, THIS.height, jsc.getPadYComponent(THIS)); + + // pad border + p.padB.style.position = 'absolute'; + p.padB.style.left = THIS.padding + 'px'; + p.padB.style.top = THIS.padding + 'px'; + p.padB.style.border = THIS.insetWidth + 'px solid'; + p.padB.style.borderColor = THIS.insetColor; + + // pad mouse area + p.padM._jscInstance = THIS; + p.padM._jscControlName = 'pad'; + p.padM.style.position = 'absolute'; + p.padM.style.left = '0'; + p.padM.style.top = '0'; + p.padM.style.width = (THIS.padding + 2 * THIS.insetWidth + THIS.width + padToSliderPadding / 2) + 'px'; + p.padM.style.height = dims[1] + 'px'; + p.padM.style.cursor = padCursor; + + // pad cross + p.cross.style.position = 'absolute'; + p.cross.style.left = + p.cross.style.top = + '0'; + p.cross.style.width = + p.cross.style.height = + crossOuterSize + 'px'; + + // pad cross border Y and X + p.crossBY.style.position = + p.crossBX.style.position = + 'absolute'; + p.crossBY.style.background = + p.crossBX.style.background = + THIS.pointerBorderColor; + p.crossBY.style.width = + p.crossBX.style.height = + (2 * THIS.pointerBorderWidth + THIS.pointerThickness) + 'px'; + p.crossBY.style.height = + p.crossBX.style.width = + crossOuterSize + 'px'; + p.crossBY.style.left = + p.crossBX.style.top = + (Math.floor(crossOuterSize / 2) - Math.floor(THIS.pointerThickness / 2) - THIS.pointerBorderWidth) + 'px'; + p.crossBY.style.top = + p.crossBX.style.left = + '0'; + + // pad cross line Y and X + p.crossLY.style.position = + p.crossLX.style.position = + 'absolute'; + p.crossLY.style.background = + p.crossLX.style.background = + THIS.pointerColor; + p.crossLY.style.height = + p.crossLX.style.width = + (crossOuterSize - 2 * THIS.pointerBorderWidth) + 'px'; + p.crossLY.style.width = + p.crossLX.style.height = + THIS.pointerThickness + 'px'; + p.crossLY.style.left = + p.crossLX.style.top = + (Math.floor(crossOuterSize / 2) - Math.floor(THIS.pointerThickness / 2)) + 'px'; + p.crossLY.style.top = + p.crossLX.style.left = + THIS.pointerBorderWidth + 'px'; + + // slider + p.sld.style.overflow = 'hidden'; + p.sld.style.width = THIS.sliderSize + 'px'; + p.sld.style.height = THIS.height + 'px'; + + // slider gradient + p.sldGrad.draw(THIS.sliderSize, THIS.height, '#000', '#000'); + + // slider border + p.sldB.style.display = displaySlider ? 'block' : 'none'; + p.sldB.style.position = 'absolute'; + p.sldB.style.right = THIS.padding + 'px'; + p.sldB.style.top = THIS.padding + 'px'; + p.sldB.style.border = THIS.insetWidth + 'px solid'; + p.sldB.style.borderColor = THIS.insetColor; + + // slider mouse area + p.sldM._jscInstance = THIS; + p.sldM._jscControlName = 'sld'; + p.sldM.style.display = displaySlider ? 'block' : 'none'; + p.sldM.style.position = 'absolute'; + p.sldM.style.right = '0'; + p.sldM.style.top = '0'; + p.sldM.style.width = (THIS.sliderSize + padToSliderPadding / 2 + THIS.padding + 2 * THIS.insetWidth) + 'px'; + p.sldM.style.height = dims[1] + 'px'; + p.sldM.style.cursor = 'default'; + + // slider pointer inner and outer border + p.sldPtrIB.style.border = + p.sldPtrOB.style.border = + THIS.pointerBorderWidth + 'px solid ' + THIS.pointerBorderColor; + + // slider pointer outer border + p.sldPtrOB.style.position = 'absolute'; + p.sldPtrOB.style.left = -(2 * THIS.pointerBorderWidth + THIS.pointerThickness) + 'px'; + p.sldPtrOB.style.top = '0'; + + // slider pointer middle border + p.sldPtrMB.style.border = THIS.pointerThickness + 'px solid ' + THIS.pointerColor; + + // slider pointer spacer + p.sldPtrS.style.width = THIS.sliderSize + 'px'; + p.sldPtrS.style.height = sliderPtrSpace + 'px'; + + // the Close button + function setBtnBorder () { + var insetColors = THIS.insetColor.split(/\s+/); + var outsetColor = insetColors.length < 2 ? insetColors[0] : insetColors[1] + ' ' + insetColors[0] + ' ' + insetColors[0] + ' ' + insetColors[1]; + p.btn.style.borderColor = outsetColor; + } + p.btn.style.display = THIS.closable ? 'block' : 'none'; + p.btn.style.position = 'absolute'; + p.btn.style.left = THIS.padding + 'px'; + p.btn.style.bottom = THIS.padding + 'px'; + p.btn.style.padding = '0 15px'; + p.btn.style.height = THIS.buttonHeight + 'px'; + p.btn.style.border = THIS.insetWidth + 'px solid'; + setBtnBorder(); + p.btn.style.color = THIS.buttonColor; + p.btn.style.font = '12px sans-serif'; + p.btn.style.textAlign = 'center'; + try { + p.btn.style.cursor = 'pointer'; + } catch(eOldIE) { + p.btn.style.cursor = 'hand'; + } + p.btn.onmousedown = function () { + THIS.hide(); + }; + p.btnT.style.lineHeight = THIS.buttonHeight + 'px'; + p.btnT.innerHTML = ''; + p.btnT.appendChild(document.createTextNode(THIS.closeText)); + + // place pointers + redrawPad(); + redrawSld(); + + // If we are changing the owner without first closing the picker, + // make sure to first deal with the old owner + if (jsc.picker.owner && jsc.picker.owner !== THIS) { + jsc.unsetClass(jsc.picker.owner.targetElement, THIS.activeClass); + } + + // Set the new picker owner + jsc.picker.owner = THIS; + + // The redrawPosition() method needs picker.owner to be set, that's why we call it here, + // after setting the owner + if (jsc.isElementType(container, 'body')) { + jsc.redrawPosition(); + } else { + jsc._drawPosition(THIS, 0, 0, 'relative', false); + } + + if (p.wrap.parentNode != container) { + container.appendChild(p.wrap); + } + + jsc.setClass(THIS.targetElement, THIS.activeClass); + } + + + function redrawPad () { + // redraw the pad pointer + switch (jsc.getPadYComponent(THIS)) { + case 's': var yComponent = 1; break; + case 'v': var yComponent = 2; break; + } + var x = Math.round((THIS.hsv[0] / 360) * (THIS.width - 1)); + var y = Math.round((1 - THIS.hsv[yComponent] / 100) * (THIS.height - 1)); + var crossOuterSize = (2 * THIS.pointerBorderWidth + THIS.pointerThickness + 2 * THIS.crossSize); + var ofs = -Math.floor(crossOuterSize / 2); + jsc.picker.cross.style.left = (x + ofs) + 'px'; + jsc.picker.cross.style.top = (y + ofs) + 'px'; + + // redraw the slider + switch (jsc.getSliderComponent(THIS)) { + case 's': + var rgb1 = HSV_RGB(THIS.hsv[0], 100, THIS.hsv[2]); + var rgb2 = HSV_RGB(THIS.hsv[0], 0, THIS.hsv[2]); + var color1 = 'rgb(' + + Math.round(rgb1[0]) + ',' + + Math.round(rgb1[1]) + ',' + + Math.round(rgb1[2]) + ')'; + var color2 = 'rgb(' + + Math.round(rgb2[0]) + ',' + + Math.round(rgb2[1]) + ',' + + Math.round(rgb2[2]) + ')'; + jsc.picker.sldGrad.draw(THIS.sliderSize, THIS.height, color1, color2); + break; + case 'v': + var rgb = HSV_RGB(THIS.hsv[0], THIS.hsv[1], 100); + var color1 = 'rgb(' + + Math.round(rgb[0]) + ',' + + Math.round(rgb[1]) + ',' + + Math.round(rgb[2]) + ')'; + var color2 = '#000'; + jsc.picker.sldGrad.draw(THIS.sliderSize, THIS.height, color1, color2); + break; + } + } + + + function redrawSld () { + var sldComponent = jsc.getSliderComponent(THIS); + if (sldComponent) { + // redraw the slider pointer + switch (sldComponent) { + case 's': var yComponent = 1; break; + case 'v': var yComponent = 2; break; + } + var y = Math.round((1 - THIS.hsv[yComponent] / 100) * (THIS.height - 1)); + jsc.picker.sldPtrOB.style.top = (y - (2 * THIS.pointerBorderWidth + THIS.pointerThickness) - Math.floor(sliderPtrSpace / 2)) + 'px'; + } + } + + + function isPickerOwner () { + return jsc.picker && jsc.picker.owner === THIS; + } + + + function blurValue () { + THIS.importColor(); + } + + + // Find the target element + if (typeof targetElement === 'string') { + var id = targetElement; + var elm = document.getElementById(id); + if (elm) { + this.targetElement = elm; + } else { + jsc.warn('Could not find target element with ID \'' + id + '\''); + } + } else if (targetElement) { + this.targetElement = targetElement; + } else { + jsc.warn('Invalid target element: \'' + targetElement + '\''); + } + + if (this.targetElement._jscLinkedInstance) { + jsc.warn('Cannot link jscolor twice to the same element. Skipping.'); + return; + } + this.targetElement._jscLinkedInstance = this; + + // Find the value element + this.valueElement = jsc.fetchElement(this.valueElement); + // Find the style element + this.styleElement = jsc.fetchElement(this.styleElement); + + var THIS = this; + var container = + this.container ? + jsc.fetchElement(this.container) : + document.getElementsByTagName('body')[0]; + var sliderPtrSpace = 3; // px + + // For BUTTON elements it's important to stop them from sending the form when clicked + // (e.g. in Safari) + if (jsc.isElementType(this.targetElement, 'button')) { + if (this.targetElement.onclick) { + var origCallback = this.targetElement.onclick; + this.targetElement.onclick = function (evt) { + origCallback.call(this, evt); + return false; + }; + } else { + this.targetElement.onclick = function () { return false; }; + } + } + + /* + var elm = this.targetElement; + do { + // If the target element or one of its offsetParents has fixed position, + // then use fixed positioning instead + // + // Note: In Firefox, getComputedStyle returns null in a hidden iframe, + // that's why we need to check if the returned style object is non-empty + var currStyle = jsc.getStyle(elm); + if (currStyle && currStyle.position.toLowerCase() === 'fixed') { + this.fixed = true; + } + + if (elm !== this.targetElement) { + // attach onParentScroll so that we can recompute the picker position + // when one of the offsetParents is scrolled + if (!elm._jscEventsAttached) { + jsc.attachEvent(elm, 'scroll', jsc.onParentScroll); + elm._jscEventsAttached = true; + } + } + } while ((elm = elm.offsetParent) && !jsc.isElementType(elm, 'body')); + */ + + // valueElement + if (this.valueElement) { + if (jsc.isElementType(this.valueElement, 'input')) { + var updateField = function () { + THIS.fromString(THIS.valueElement.value, jsc.leaveValue); + jsc.dispatchFineChange(THIS); + }; + jsc.attachEvent(this.valueElement, 'keyup', updateField); + jsc.attachEvent(this.valueElement, 'input', updateField); + jsc.attachEvent(this.valueElement, 'blur', blurValue); + this.valueElement.setAttribute('autocomplete', 'off'); + } + } + + // styleElement + if (this.styleElement) { + this.styleElement._jscOrigStyle = { + backgroundImage : this.styleElement.style.backgroundImage, + backgroundColor : this.styleElement.style.backgroundColor, + color : this.styleElement.style.color + }; + } + + if (this.value) { + // Try to set the color from the .value option and if unsuccessful, + // export the current color + this.fromString(this.value) || this.exportColor(); + } else { + this.importColor(); + } + } + +}; + + +//================================ +// Public properties and methods +//================================ + + +// By default, search for all elements with class="jscolor" and install a color picker on them. +// +// You can change what class name will be looked for by setting the property jscolor.lookupClass +// anywhere in your HTML document. To completely disable the automatic lookup, set it to null. +// +jsc.jscolor.lookupClass = 'jscolor'; + + +jsc.jscolor.installByClassName = function (className) { + var inputElms = document.getElementsByTagName('input'); + var buttonElms = document.getElementsByTagName('button'); + + jsc.tryInstallOnElements(inputElms, className); + jsc.tryInstallOnElements(buttonElms, className); +}; + + +jsc.register(); + + +return jsc.jscolor; + + +})(); }