diff --git a/scripts/system/appreciate/README.md b/scripts/system/appreciate/README.md deleted file mode 100644 index b3f9a3649b..0000000000 --- a/scripts/system/appreciate/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# Appreciate - -## Description - -Show someone else that you like what they're doing. Open the app to see usage instructions and some options! - -## Releases - -### v1.5 | [48d8247](https://github.com/highfidelity/hifi-content/commit/48d8247) - -- Fixed an issue where Appreciate app users wearing avatars without a specific joint wouldn't hear the Appreciate sound or see the Appreciation Dodecahedron - -### 2019-03-08_11-37-00 | Marketplace v1.4 | [93bf464](https://github.com/highfidelity/hifi-content/commit/93bf464) - -- Fixed an issue where a user could press the "Z" key to appreciate while the Appreciate UI was focused even if the Appreciate switch was turned off -- Fixed an issue where Appreciation Intensity decayed too quickly after switching from HMD mode to Desktop mode - -### 2019-02-22_10-49-00 | Marketplace v1.3 | [51704b5](https://github.com/highfidelity/hifi-content/commit/51704b5) - -- Optimize app -- Add option to not show Appreciation Dodecahedron while Appreciating -- Forward Z keypresses to the Appreciate script that the user makes when the App's HTML UI is focused - -### 2019-02-19_13-09-00 | Marketplace v1.2 | [0e2fa82](https://github.com/highfidelity/hifi-content/commit/0e2fa82) - -- Introduced functionality to stop running versions of Appreciate when those versions are baked into the client installation AND other versions of Appreciate are running - -### 2019-02-15_17-03-00 | Marketplace v1.1 | [83f8927](https://github.com/highfidelity/hifi-content/commit/83f8927) - -- Ensure that old Appreciation Dodecahedrons will be deleted in the event of a client crashing while Appreciating - -### 2019-02-14_10-00-00 | Marketplace v1.0 | [658ed4e](https://github.com/highfidelity/hifi-content/commit/658ed4e) - -- Initial Release - -## Project Links -[Trello Card](https://trello.com/c/2iMbEgdw/36-appreciation-app) - -## Known issues -- N/A diff --git a/scripts/system/appreciate/appreciate.jpg b/scripts/system/appreciate/appreciate.jpg deleted file mode 100644 index 615991743b..0000000000 Binary files a/scripts/system/appreciate/appreciate.jpg and /dev/null differ diff --git a/scripts/system/appreciate/appreciate_app.js b/scripts/system/appreciate/appreciate_app.js deleted file mode 100644 index dce2a93502..0000000000 --- a/scripts/system/appreciate/appreciate_app.js +++ /dev/null @@ -1,1138 +0,0 @@ -/* - Appreciate - Created by Zach Fox on 2019-01-30 - Copyright 2019 High Fidelity, Inc. - - Distributed under the Apache License, Version 2.0. - See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -*/ - -(function () { - // ************************************* - // START UTILITY FUNCTIONS - // ************************************* - // #region Utilities - var MS_PER_S = 1000; - var CM_PER_M = 100; - var HALF = 0.5; - - - // Returns the first valid joint position from the list of supplied test joint positions. - // If none are valid, returns MyAvatar.position. - function getValidJointPosition(jointsToTest) { - var currentJointIndex; - - for (var i = 0; i < jointsToTest.length; i++) { - currentJointIndex = MyAvatar.getJointIndex(jointsToTest[i]); - - if (currentJointIndex > -1) { - return MyAvatar.getJointPosition(jointsToTest[i]); - } - } - - return MyAvatar.position; - } - - - // Returns the world position halfway between the user's hands - function getAppreciationPosition() { - var validLeftJoints = ["LeftHandMiddle2", "LeftHand", "LeftArm"]; - var leftPosition = getValidJointPosition(validLeftJoints); - - var validRightJoints = ["RightHandMiddle2", "RightHand", "RightArm"];; - var rightPosition = getValidJointPosition(validRightJoints); - - var centerPosition = Vec3.sum(leftPosition, rightPosition); - centerPosition = Vec3.multiply(centerPosition, HALF); - - return centerPosition; - } - - - // Returns a linearly scaled value based on `factor` and the other inputs - function linearScale(factor, minInput, maxInput, minOutput, maxOutput) { - return minOutput + (maxOutput - minOutput) * - (factor - minInput) / (maxInput - minInput); - } - - - // Linearly scales an RGB color between 0 and 1 based on RGB color values - // between 0 and 255. - function linearScaleColor(intensity, min, max) { - var output = { - "red": 0, - "green": 0, - "blue": 0 - }; - - output.red = linearScale(intensity, 0, 1, min.red, max.red); - output.green = linearScale(intensity, 0, 1, min.green, max.green); - output.blue = linearScale(intensity, 0, 1, min.blue, max.blue); - - return output; - } - - - function randomFloat(min, max) { - return Math.random() * (max - min) + min; - } - - - // Updates the Current Intensity Meter UI element. Called when intensity changes. - function updateCurrentIntensityUI() { - ui.sendMessage({method: "updateCurrentIntensityUI", currentIntensity: currentIntensity}); - } - // #endregion - // ************************************* - // END UTILITY FUNCTIONS - // ************************************* - - // If the interval that updates the intensity interval exists, - // clear it. - var updateIntensityEntityInterval = false; - var UPDATE_INTENSITY_ENTITY_INTERVAL_MS = 75; - function maybeClearUpdateIntensityEntityInterval() { - if (updateIntensityEntityInterval) { - Script.clearInterval(updateIntensityEntityInterval); - updateIntensityEntityInterval = false; - } - - if (intensityEntity) { - Entities.deleteEntity(intensityEntity); - intensityEntity = false; - } - } - - - // Determines if any XYZ JSON object has changed "enough" based on - // last xyz values and current xyz values. - // Used for determining if angular velocity and dimensions have changed enough. - var lastAngularVelocity = { - "x": 0, - "y": 0, - "z": 0 - }; - var ANGVEL_DISTANCE_THRESHOLD_PERCENT_CHANGE = 0.35; - var lastDimensions= { - "x": 0, - "y": 0, - "z": 0 - }; - var DIMENSIONS_DISTANCE_THRESHOLD_PERCENT_CHANGE = 0.2; - function xyzVecChangedEnough(current, last, thresh) { - var currentLength = Math.sqrt( - Math.pow(current.x, TWO) + Math.pow(current.y, TWO) + Math.pow(current.z, TWO)); - var lastLength = Math.sqrt( - Math.pow(last.x, TWO) + Math.pow(last.y, TWO) + Math.pow(last.z, TWO)); - - var change = Math.abs(currentLength - lastLength); - if (change/lastLength > thresh) { - return true; - } - - return false; - } - - - // Determines if color values have changed "enough" based on - // last color and current color - var lastColor = { - "red": 0, - "blue": 0, - "green": 0 - }; - var COLOR_DISTANCE_THRESHOLD_PERCENT_CHANGE = 0.35; - var TWO = 2; - function colorChangedEnough(current, last, thresh) { - var currentLength = Math.sqrt( - Math.pow(current.red, TWO) + Math.pow(current.green, TWO) + Math.pow(current.blue, TWO)); - var lastLength = Math.sqrt( - Math.pow(last.red, TWO) + Math.pow(last.green, TWO) + Math.pow(last.blue, TWO)); - - var change = Math.abs(currentLength - lastLength); - if (change/lastLength > thresh) { - return true; - } - - return false; - } - - - // Updates the intensity entity based on the user's avatar's hand position and the - // current intensity of their appreciation. - // Many of these property values are empirically determined. - var intensityEntity = false; - var INTENSITY_ENTITY_MAX_DIMENSIONS = { - "x": 0.24, - "y": 0.24, - "z": 0.24 - }; - var INTENSITY_ENTITY_MIN_ANGULAR_VELOCITY = { - "x": -0.21, - "y": -0.21, - "z": -0.21 - }; - var INTENSITY_ENTITY_MAX_ANGULAR_VELOCITY = { - "x": 0.21, - "y": 0.21, - "z": 0.21 - }; - var intensityEntityColorMin = { - "red": 82, - "green": 196, - "blue": 145 - }; - var INTENSITY_ENTITY_COLOR_MAX_DEFAULT = { - "red": 5, - "green": 255, - "blue": 5 - }; - var MIN_COLOR_MULTIPLIER = 0.4; - var intensityEntityColorMax = JSON.parse(Settings.getValue("appreciate/entityColor", - JSON.stringify(INTENSITY_ENTITY_COLOR_MAX_DEFAULT))); - var ANGVEL_ENTITY_MULTIPLY_FACTOR = 62; - var INTENSITY_ENTITY_NAME = "Appreciation Dodecahedron"; - var INTENSITY_ENTITY_PROPERTIES = { - "name": INTENSITY_ENTITY_NAME, - "type": "Shape", - "shape": "Dodecahedron", - "dimensions": { - "x": 0, - "y": 0, - "z": 0 - }, - "angularVelocity": { - "x": 0, - "y": 0, - "z": 0 - }, - "angularDamping": 0, - "grab": { - "grabbable": false, - "equippableLeftRotation": { - "x": -0.0000152587890625, - "y": -0.0000152587890625, - "z": -0.0000152587890625, - "w": 1 - }, - "equippableRightRotation": { - "x": -0.0000152587890625, - "y": -0.0000152587890625, - "z": -0.0000152587890625, - "w": 1 - } - }, - "collisionless": true, - "ignoreForCollisions": true, - "queryAACube": { - "x": -0.17320507764816284, - "y": -0.17320507764816284, - "z": -0.17320507764816284, - "scale": 0.3464101552963257 - }, - "damping": 0, - "color": intensityEntityColorMin, - "clientOnly": false, - "avatarEntity": true, - "localEntity": false, - "faceCamera": false, - "isFacingAvatar": false - }; - var currentInitialAngularVelocity = { - "x": 0, - "y": 0, - "z": 0 - }; - function updateIntensityEntity() { - if (!showAppreciationEntity) { - return; - } - - if (currentIntensity > 0) { - if (intensityEntity) { - intensityEntityColorMin.red = intensityEntityColorMax.red * MIN_COLOR_MULTIPLIER; - intensityEntityColorMin.green = intensityEntityColorMax.green * MIN_COLOR_MULTIPLIER; - intensityEntityColorMin.blue = intensityEntityColorMax.blue * MIN_COLOR_MULTIPLIER; - - var color = linearScaleColor(currentIntensity, intensityEntityColorMin, intensityEntityColorMax); - - var propsToUpdate = { - position: getAppreciationPosition() - }; - - var currentDimensions = Vec3.multiply(INTENSITY_ENTITY_MAX_DIMENSIONS, currentIntensity); - if (xyzVecChangedEnough(currentDimensions, lastDimensions, DIMENSIONS_DISTANCE_THRESHOLD_PERCENT_CHANGE)) { - propsToUpdate.dimensions = currentDimensions; - lastDimensions = currentDimensions; - } - - var currentAngularVelocity = Vec3.multiply(currentInitialAngularVelocity, - currentIntensity * ANGVEL_ENTITY_MULTIPLY_FACTOR); - if (xyzVecChangedEnough(currentAngularVelocity, lastAngularVelocity, ANGVEL_DISTANCE_THRESHOLD_PERCENT_CHANGE)) { - propsToUpdate.angularVelocity = currentAngularVelocity; - lastAngularVelocity = currentAngularVelocity; - } - - var currentColor = color; - if (colorChangedEnough(currentColor, lastColor, COLOR_DISTANCE_THRESHOLD_PERCENT_CHANGE)) { - propsToUpdate.color = currentColor; - lastColor = currentColor; - } - - Entities.editEntity(intensityEntity, propsToUpdate); - } else { - var props = INTENSITY_ENTITY_PROPERTIES; - props.position = getAppreciationPosition(); - - currentInitialAngularVelocity.x = - randomFloat(INTENSITY_ENTITY_MIN_ANGULAR_VELOCITY.x, INTENSITY_ENTITY_MAX_ANGULAR_VELOCITY.x); - currentInitialAngularVelocity.y = - randomFloat(INTENSITY_ENTITY_MIN_ANGULAR_VELOCITY.y, INTENSITY_ENTITY_MAX_ANGULAR_VELOCITY.y); - currentInitialAngularVelocity.z = - randomFloat(INTENSITY_ENTITY_MIN_ANGULAR_VELOCITY.z, INTENSITY_ENTITY_MAX_ANGULAR_VELOCITY.z); - props.angularVelocity = currentInitialAngularVelocity; - - intensityEntity = Entities.addEntity(props, "avatar"); - } - } else { - if (intensityEntity) { - Entities.deleteEntity(intensityEntity); - intensityEntity = false; - } - - maybeClearUpdateIntensityEntityInterval(); - } - } - - - // Function that AppUI calls when the App's UI opens - function onOpened() { - updateCurrentIntensityUI(); - } - - - // Locally pre-caches all of the sounds in the sounds/claps and sounds/whistles - // directories. - var NUM_CLAP_SOUNDS = 16; - var NUM_WHISTLE_SOUNDS = 17; - var clapSounds = []; - var whistleSounds = []; - function getSounds() { - for (var i = 1; i < NUM_CLAP_SOUNDS + 1; i++) { - clapSounds.push(SoundCache.getSound(Script.resolvePath( - "resources/sounds/claps/" + ("0" + i).slice(-2) + ".wav"))); - } - for (i = 1; i < NUM_WHISTLE_SOUNDS + 1; i++) { - whistleSounds.push(SoundCache.getSound(Script.resolvePath( - "resources/sounds/whistles/" + ("0" + i).slice(-2) + ".wav"))); - } - } - - - // Locally pre-caches the Cheering and Clapping animations - var whistlingAnimation = false; - var clappingAnimation = false; - function getAnimations() { - var animationURL = Script.resolvePath("resources/animations/Cheering.fbx"); - var resource = AnimationCache.prefetch(animationURL); - var animation = AnimationCache.getAnimation(animationURL); - whistlingAnimation = {url: animationURL, animation: animation, resource: resource}; - - animationURL = Script.resolvePath("resources/animations/Clapping.fbx"); - resource = AnimationCache.prefetch(animationURL); - animation = AnimationCache.getAnimation(animationURL); - clappingAnimation = {url: animationURL, animation: animation, resource: resource}; - } - - - // If we're currently fading out the appreciation sounds on an interval, - // clear that interval. - function maybeClearSoundFadeInterval() { - if (soundFadeInterval) { - Script.clearInterval(soundFadeInterval); - soundFadeInterval = false; - } - } - - - // Fade out the appreciation sounds by quickly - // lowering the global current intensity. - var soundFadeInterval = false; - var FADE_INTERVAL_MS = 20; - var FADE_OUT_STEP_SIZE = 0.05; // Unitless - function fadeOutAndStopSound() { - maybeClearSoundFadeInterval(); - - soundFadeInterval = Script.setInterval(function() { - currentIntensity -= FADE_OUT_STEP_SIZE; - - if (currentIntensity <= 0) { - if (soundInjector) { - soundInjector.stop(); - soundInjector = false; - } - - updateCurrentIntensityUI(); - - maybeClearSoundFadeInterval(); - } - - fadeIntensity(currentIntensity, INTENSITY_MAX_STEP_SIZE_DESKTOP); - }, FADE_INTERVAL_MS); - } - - - // Calculates the audio injector volume based on - // the current global appreciation intensity and some min/max values. - var MIN_VOLUME_CLAP = 0.05; - var MAX_VOLUME_CLAP = 1.0; - var MIN_VOLUME_WHISTLE = 0.07; - var MAX_VOLUME_WHISTLE = 0.16; - function calculateInjectorVolume() { - var minInputVolume = 0; - var maxInputVolume = MAX_CLAP_INTENSITY; - var minOutputVolume = MIN_VOLUME_CLAP; - var maxOutputVolume = MAX_VOLUME_CLAP; - - if (currentSound === "whistle") { - minInputVolume = MAX_CLAP_INTENSITY; - maxInputVolume = MAX_WHISTLE_INTENSITY; - minOutputVolume = MIN_VOLUME_WHISTLE; - maxOutputVolume = MAX_VOLUME_WHISTLE; - } - - var vol = linearScale(currentIntensity, minInputVolume, - maxInputVolume, minOutputVolume, maxOutputVolume); - return vol; - } - - - // Modifies the global currentIntensity. Moves towards the targetIntensity, - // but never moves faster than a given max step size per function call. - // Also clamps the intensity to a min of 0 and a max of 1.0. - var currentIntensity = 0; - var INTENSITY_MAX_STEP_SIZE = 0.003; // Unitless, determined empirically - var INTENSITY_MAX_STEP_SIZE_DESKTOP = 1; // Unitless, determined empirically - var MAX_CLAP_INTENSITY = 0.55; // Unitless, determined empirically - var MAX_WHISTLE_INTENSITY = 1.0; // Unitless, determined empirically - function fadeIntensity(targetIntensity, maxStepSize) { - if (!maxStepSize) { - maxStepSize = INTENSITY_MAX_STEP_SIZE; - } - - var volumeDelta = targetIntensity - currentIntensity; - volumeDelta = Math.min(Math.abs(volumeDelta), maxStepSize); - - if (targetIntensity < currentIntensity) { - volumeDelta *= -1; - } - - currentIntensity += volumeDelta; - - currentIntensity = Math.max(0.0, Math.min( - neverWhistleEnabled ? MAX_CLAP_INTENSITY : MAX_WHISTLE_INTENSITY, currentIntensity)); - - updateCurrentIntensityUI(); - - // Don't adjust volume or position while a sound is playing. - if (!soundInjector || soundInjector.isPlaying()) { - return; - } - - var injectorOptions = { - position: getAppreciationPosition(), - volume: calculateInjectorVolume() - }; - - soundInjector.setOptions(injectorOptions); - } - - - // Call this function to actually play a sound. - // Doesn't play a new sound if a sound is playing AND (you're whistling OR you're in HMD) - // Injectors are placed between the user's hands (at the same location as the apprecation - // entity) and are randomly pitched between a MIN and MAX value. - // Only uses one injector, ever. - var soundInjector = false; - var MINIMUM_PITCH = 0.85; - var MAXIMUM_PITCH = 1.15; - function playSound(sound) { - if (soundInjector && soundInjector.isPlaying() && (currentSound === "whistle" || HMD.active)) { - return; - } - - if (soundInjector) { - soundInjector.stop(); - soundInjector = false; - } - - soundInjector = Audio.playSound(sound, { - position: getAppreciationPosition(), - volume: calculateInjectorVolume(), - pitch: randomFloat(MINIMUM_PITCH, MAXIMUM_PITCH) - }); - } - - - // Returns true if the global intensity and user settings dictate that clapping is the - // right thing to do. - function shouldClap() { - return (currentIntensity > 0.0 && neverWhistleEnabled) || - (currentIntensity > 0.0 && currentIntensity <= MAX_CLAP_INTENSITY); - } - - - // Returns true if the global intensity and user settings dictate that whistling is the - // right thing to do. - function shouldWhistle() { - return currentIntensity > MAX_CLAP_INTENSITY && - currentIntensity <= MAX_WHISTLE_INTENSITY; - } - - - // Selects the correct sound, then plays it. - var currentSound; - function selectAndPlaySound() { - if (shouldClap()) { - currentSound = "clap"; - playSound(clapSounds[Math.floor(Math.random() * clapSounds.length)]); - } else if (shouldWhistle()) { - currentSound = "whistle"; - playSound(whistleSounds[Math.floor(Math.random() * whistleSounds.length)]); - } - } - - - // If there exists a VR debounce timer (used for not playing sounds too often), - // clear it. - function maybeClearVRDebounceTimer() { - if (vrDebounceTimer) { - Script.clearTimeout(vrDebounceTimer); - vrDebounceTimer = false; - } - } - - - // Calculates the current intensity of appreciation based on the user's - // hand velocity (rotational and linear). - // Each type of velocity is weighted differently when determining the final intensity. - // The VR debounce timer length changes based on current intensity. This forces - // sounds to play further apart when the user isn't appreciating hard. - var MAX_VELOCITY_CM_PER_SEC = 110; // determined empirically - var MAX_ANGULAR_VELOCITY_LENGTH = 1.5; // determined empirically - var LINEAR_VELOCITY_WEIGHT = 0.7; // This and the line below must add up to 1.0 - var ANGULAR_VELOCITY_LENGTH_WEIGHT = 0.3; // This and the line below must add up to 1.0 - var vrDebounceTimer = false; - var VR_DEBOUNCE_TIMER_TIMEOUT_MIN_MS = 20; // determined empirically - var VR_DEBOUNCE_TIMER_TIMEOUT_MAX_MS = 200; // determined empirically - function calculateHandEffect(linearVelocity, angularVelocity){ - var leftHandLinearVelocityCMPerSec = linearVelocity.left; - var rightHandLinearVelocityCMPerSec = linearVelocity.right; - var averageLinearVelocity = (leftHandLinearVelocityCMPerSec + rightHandLinearVelocityCMPerSec) / 2; - averageLinearVelocity = Math.min(averageLinearVelocity, MAX_VELOCITY_CM_PER_SEC); - - var leftHandAngularVelocityLength = Vec3.length(angularVelocity.left); - var rightHandAngularVelocityLength = Vec3.length(angularVelocity.right); - var averageAngularVelocityIntensity = (leftHandAngularVelocityLength + rightHandAngularVelocityLength) / 2; - averageAngularVelocityIntensity = Math.min(averageAngularVelocityIntensity, MAX_ANGULAR_VELOCITY_LENGTH); - - var appreciationIntensity = - averageLinearVelocity / MAX_VELOCITY_CM_PER_SEC * LINEAR_VELOCITY_WEIGHT + - averageAngularVelocityIntensity / MAX_ANGULAR_VELOCITY_LENGTH * ANGULAR_VELOCITY_LENGTH_WEIGHT; - - fadeIntensity(appreciationIntensity); - - var vrDebounceTimeout = VR_DEBOUNCE_TIMER_TIMEOUT_MIN_MS + - (VR_DEBOUNCE_TIMER_TIMEOUT_MAX_MS - VR_DEBOUNCE_TIMER_TIMEOUT_MIN_MS) * (1.0 - appreciationIntensity); - // This timer forces a minimum tail duration for all sound clips - if (!vrDebounceTimer) { - selectAndPlaySound(); - vrDebounceTimer = Script.setTimeout(function() { - vrDebounceTimer = false; - }, vrDebounceTimeout); - } - } - - - // Gets both hands' linear velocity. - var lastLeftHandPosition = false; - var lastRightHandPosition = false; - function getHandsLinearVelocity() { - var linearVelocity = { - left: 0, - right: 0 - }; - - var leftHandPosition = MyAvatar.getJointPosition("LeftHand"); - var rightHandPosition = MyAvatar.getJointPosition("RightHand"); - - if (!lastLeftHandPosition || !lastRightHandPosition) { - lastLeftHandPosition = leftHandPosition; - lastRightHandPosition = rightHandPosition; - return linearVelocity; - } - - var leftHandDistanceCM = Vec3.distance(leftHandPosition, lastLeftHandPosition) * CM_PER_M; - var rightHandDistanceCM = Vec3.distance(rightHandPosition, lastRightHandPosition) * CM_PER_M; - - linearVelocity.left = leftHandDistanceCM / HAND_VELOCITY_CHECK_INTERVAL_MS * MS_PER_S; - linearVelocity.right = rightHandDistanceCM / HAND_VELOCITY_CHECK_INTERVAL_MS * MS_PER_S; - - lastLeftHandPosition = leftHandPosition; - lastRightHandPosition = rightHandPosition; - - return linearVelocity; - } - - - // Gets both hands' angular velocity. - var lastLeftHandRotation = false; - var lastRightHandRotation = false; - function getHandsAngularVelocity() { - var angularVelocity = { - left: {x: 0, y: 0, z: 0}, - right: {x: 0, y: 0, z: 0} - }; - - var leftHandRotation = MyAvatar.getJointRotation(MyAvatar.getJointIndex("LeftHand")); - var rightHandRotation = MyAvatar.getJointRotation(MyAvatar.getJointIndex("RightHand")); - - if (!lastLeftHandRotation || !lastRightHandRotation) { - lastLeftHandRotation = leftHandRotation; - lastRightHandRotation = rightHandRotation; - return angularVelocity; - } - - var leftHandAngleDelta = Quat.multiply(leftHandRotation, Quat.inverse(lastLeftHandRotation)); - var rightHandAngleDelta = Quat.multiply(rightHandRotation, Quat.inverse(lastRightHandRotation)); - - leftHandAngleDelta = Quat.safeEulerAngles(leftHandAngleDelta); - rightHandAngleDelta = Quat.safeEulerAngles(rightHandAngleDelta); - - angularVelocity.left = Vec3.multiply(leftHandAngleDelta, 1 / HAND_VELOCITY_CHECK_INTERVAL_MS); - angularVelocity.right = Vec3.multiply(rightHandAngleDelta, 1 / HAND_VELOCITY_CHECK_INTERVAL_MS); - - lastLeftHandRotation = leftHandRotation; - lastRightHandRotation = rightHandRotation; - - return angularVelocity; - } - - - // Calculates the hand effect (see above). Gets called on an interval, - // but only if the user's hands are above their head. This saves processing power. - // Also sets up the `updateIntensityEntity` interval. - function handVelocityCheck() { - if (!handsAreAboveHead) { - return; - } - - var handsLinearVelocity = getHandsLinearVelocity(); - var handsAngularVelocity = getHandsAngularVelocity(); - - calculateHandEffect(handsLinearVelocity, handsAngularVelocity); - - if (!updateIntensityEntityInterval && showAppreciationEntity) { - updateIntensityEntityInterval = Script.setInterval(updateIntensityEntity, UPDATE_INTENSITY_ENTITY_INTERVAL_MS); - } - } - - - // If handVelocityCheckInterval is set up, clear it. - function maybeClearHandVelocityCheck() { - if (handVelocityCheckInterval) { - Script.clearInterval(handVelocityCheckInterval); - handVelocityCheckInterval = false; - } - } - - - // If handVelocityCheckInterval is set up, clear it. - // Also stop the sound injector and set currentIntensity to 0. - function maybeClearHandVelocityCheckIntervalAndStopSound() { - maybeClearHandVelocityCheck(); - - if (soundInjector) { - soundInjector.stop(); - soundInjector = false; - } - - currentIntensity = 0.0; - } - - - // Sets up an interval that'll check the avatar's hand's velocities. - // This is used for calculating the effect. - // If the user isn't in HMD, we'll never set up this interval. - var handVelocityCheckInterval = false; - var HAND_VELOCITY_CHECK_INTERVAL_MS = 10; - function maybeSetupHandVelocityCheckInterval() { - // `!HMD.active` clause isn't really necessary, just extra protection - if (handVelocityCheckInterval || !HMD.active) { - return; - } - - handVelocityCheckInterval = Script.setInterval(handVelocityCheck, HAND_VELOCITY_CHECK_INTERVAL_MS); - } - - - // Checks the position of the user's hands to determine if they're above their head. - // If they are, sets up the hand velocity check interval (see above). - // If they aren't, clears that interval and stops the apprecation sound. - var handsAreAboveHead = false; - function handPositionCheck() { - var leftHandPosition = MyAvatar.getJointPosition("LeftHand"); - var rightHandPosition = MyAvatar.getJointPosition("RightHand"); - var headJointPosition = MyAvatar.getJointPosition("Head"); - - var headY = headJointPosition.y; - - handsAreAboveHead = (rightHandPosition.y > headY && leftHandPosition.y > headY); - - if (handsAreAboveHead) { - maybeSetupHandVelocityCheckInterval(); - } else { - maybeClearHandVelocityCheck(); - fadeOutAndStopSound(); - } - } - - - // If handPositionCheckInterval is set up, clear it. - function maybeClearHandPositionCheckInterval() { - if (handPositionCheckInterval) { - Script.clearInterval(handPositionCheckInterval); - handPositionCheckInterval = false; - } - } - - - // If the app is enabled, sets up an interval that'll check if the avatar's hands are above their head. - var handPositionCheckInterval = false; - var HAND_POSITION_CHECK_INTERVAL_MS = 200; - function maybeSetupHandPositionCheckInterval() { - if (!appreciateEnabled || !HMD.active) { - return; - } - - maybeClearHandPositionCheckInterval(); - - handPositionCheckInterval = Script.setInterval(handPositionCheck, HAND_POSITION_CHECK_INTERVAL_MS); - } - - - // If the interval that periodically lowers the apprecation volume is set up, clear it. - function maybeClearSlowAppreciationInterval() { - if (slowAppreciationInterval) { - Script.clearInterval(slowAppreciationInterval); - slowAppreciationInterval = false; - } - } - - - // Stop appreciating. Called when Appreciating from Desktop mode. - function stopAppreciating() { - maybeClearStopAppreciatingTimeout(); - maybeClearSlowAppreciationInterval(); - maybeClearUpdateIntensityEntityInterval(); - MyAvatar.restoreAnimation(); - currentAnimationFPS = INITIAL_ANIMATION_FPS; - currentlyPlayingFrame = 0; - currentAnimationTimestamp = 0; - } - - - // If the timeout that stops the user's apprecation is set up, clear it. - function maybeClearStopAppreciatingTimeout() { - if (stopAppreciatingTimeout) { - Script.clearTimeout(stopAppreciatingTimeout); - stopAppreciatingTimeout = false; - } - } - - - function calculateCurrentAnimationFPS(frameCount) { - var animationTimestampDeltaMS = Date.now() - currentAnimationTimestamp; - var frameDelta = animationTimestampDeltaMS / MS_PER_S * currentAnimationFPS; - - currentlyPlayingFrame = (currentlyPlayingFrame + frameDelta) % frameCount; - - currentAnimationFPS = currentIntensity * CHEERING_FPS_MAX + INITIAL_ANIMATION_FPS; - - currentAnimationFPS = Math.min(currentAnimationFPS, CHEERING_FPS_MAX); - - if (currentAnimation === clappingAnimation) { - currentAnimationFPS += CLAP_ANIMATION_FPS_BOOST; - } - } - - - // Called on an interval. Slows down the user's appreciation! - var VOLUME_STEP_DOWN_DESKTOP = 0.01; // Unitless, determined empirically - function slowAppreciation() { - currentIntensity -= VOLUME_STEP_DOWN_DESKTOP; - fadeIntensity(currentIntensity, INTENSITY_MAX_STEP_SIZE_DESKTOP); - - currentAnimation = selectAnimation(); - - if (!currentAnimation) { - stopAppreciating(); - return; - } - - var frameCount = currentAnimation.animation.frames.length; - - calculateCurrentAnimationFPS(frameCount); - - MyAvatar.overrideAnimation(currentAnimation.url, currentAnimationFPS, true, currentlyPlayingFrame, frameCount); - - currentAnimationTimestamp = Date.now(); - } - - - // Selects the proper animation to use when Appreciating in Desktop mode. - function selectAnimation() { - if (shouldClap()) { - if (currentAnimation === whistlingAnimation) { - currentAnimationTimestamp = 0; - } - return clappingAnimation; - } else if (shouldWhistle()) { - if (currentAnimation === clappingAnimation) { - currentAnimationTimestamp = 0; - } - return whistlingAnimation; - } else { - return false; - } - } - - - // Called when the Z key is pressed (and some other conditions are met). - // 1. (Maybe) clears old intervals - // 2. Steps up the global currentIntensity, then forces the effect/sound to fade/play immediately - // 3. Selects an animation to play based on various factors, then plays it - // - Stops appreciating if the selected animation is falsey - // 4. Sets up the "Slow Appreciation" interval which slows appreciation over time - // 5. Modifies the avatar's animation based on the current appreciation intensity - // - Since there's no way to modify animation FPS on-the-fly, we have to calculate - // where the animation should start based on where it was before changing FPS - // 6. Sets up the `updateIntensityEntity` interval if one isn't already setup - var INITIAL_ANIMATION_FPS = 7; - var SLOW_APPRECIATION_INTERVAL_MS = 100; - var CHEERING_FPS_MAX = 80; - var VOLUME_STEP_UP_DESKTOP = 0.035; // Unitless, determined empirically - var CLAP_ANIMATION_FPS_BOOST = 15; - var currentAnimation = false; - var currentAnimationFPS = INITIAL_ANIMATION_FPS; - var slowAppreciationInterval = false; - var currentlyPlayingFrame = 0; - var currentAnimationTimestamp; - function keyPressed() { - // Don't do anything if the animations aren't cached. - if (!whistlingAnimation || !clappingAnimation) { - return; - } - - maybeClearSoundFadeInterval(); - maybeClearStopAppreciatingTimeout(); - - currentIntensity += VOLUME_STEP_UP_DESKTOP; - fadeIntensity(currentIntensity, INTENSITY_MAX_STEP_SIZE_DESKTOP); - selectAndPlaySound(); - - currentAnimation = selectAnimation(); - - if (!currentAnimation) { - stopAppreciating(); - return; - } - - if (!slowAppreciationInterval) { - slowAppreciationInterval = Script.setInterval(slowAppreciation, SLOW_APPRECIATION_INTERVAL_MS); - } - - var frameCount = currentAnimation.animation.frames.length; - - if (currentAnimationTimestamp > 0) { - calculateCurrentAnimationFPS(frameCount); - } else { - currentlyPlayingFrame = 0; - } - - MyAvatar.overrideAnimation(currentAnimation.url, currentAnimationFPS, true, currentlyPlayingFrame, frameCount); - currentAnimationTimestamp = Date.now(); - - if (!updateIntensityEntityInterval && showAppreciationEntity) { - updateIntensityEntityInterval = Script.setInterval(updateIntensityEntity, UPDATE_INTENSITY_ENTITY_INTERVAL_MS); - } - } - - - // The listener for all in-app keypresses. Listens for an unshifted, un-alted, un-ctrl'd - // "Z" keypress. Only listens when in Desktop mode. If the user is holding the key down, - // we make sure not to call the `keyPressed()` handler too often using the `desktopDebounceTimer`. - var desktopDebounceTimer = false; - var DESKTOP_DEBOUNCE_TIMEOUT_MS = 160; - function keyPressEvent(event) { - if (!appreciateEnabled) { - return; - } - - if ((event.text.toUpperCase() === "Z") && - !event.isShifted && - !event.isMeta && - !event.isControl && - !event.isAlt && - !HMD.active) { - - if (event.isAutoRepeat) { - if (!desktopDebounceTimer) { - keyPressed(); - - desktopDebounceTimer = Script.setTimeout(function() { - desktopDebounceTimer = false; - }, DESKTOP_DEBOUNCE_TIMEOUT_MS); - } - } else { - keyPressed(); - } - } - } - - - // Sets up a timeout that will fade out the appreciation sound, then stop it. - var stopAppreciatingTimeout = false; - var STOP_APPRECIATING_TIMEOUT_MS = 1000; - function stopAppreciatingSoon() { - maybeClearStopAppreciatingTimeout(); - - if (currentIntensity > 0) { - stopAppreciatingTimeout = Script.setTimeout(fadeOutAndStopSound, STOP_APPRECIATING_TIMEOUT_MS); - } - } - - - // When the "Z" key is released, we want to stop appreciating a short time later. - function keyReleaseEvent(event) { - if (!appreciateEnabled) { - return; - } - - if ((event.text.toUpperCase() === "Z") && - !event.isAutoRepeat) { - stopAppreciatingSoon(); - } - } - - - // Enables or disables the app's main functionality - var appreciateEnabled = Settings.getValue("appreciate/enabled", false); - var neverWhistleEnabled = Settings.getValue("appreciate/neverWhistle", false); - var showAppreciationEntity = Settings.getValue("appreciate/showAppreciationEntity", true); - var keyEventsWired = false; - function enableOrDisableAppreciate() { - maybeClearHandPositionCheckInterval(); - maybeClearHandVelocityCheckIntervalAndStopSound(); - - if (appreciateEnabled) { - maybeSetupHandPositionCheckInterval(); - - if (!keyEventsWired && !HMD.active) { - Controller.keyPressEvent.connect(keyPressEvent); - Controller.keyReleaseEvent.connect(keyReleaseEvent); - keyEventsWired = true; - } - } else { - stopAppreciating(); - - if (keyEventsWired) { - Controller.keyPressEvent.disconnect(keyPressEvent); - Controller.keyReleaseEvent.disconnect(keyReleaseEvent); - keyEventsWired = false; - } - } - } - - - // Handles incoming messages from the UI - // - "eventBridgeReady" - The App's UI will send this when it's ready to - // receive events over the Event Bridge - // - "appreciateSwitchClicked" - The App's UI will send this when the user - // clicks the main toggle switch in the top right of the app - // - "neverWhistleCheckboxClicked" - Sent when the user clicks the - // "Never Whistle" checkbox - // - "setEntityColor" - Sent when the user chooses a new Entity Color. - function onMessage(message) { - if (message.app !== "appreciate") { - return; - } - - switch (message.method) { - case "eventBridgeReady": - ui.sendMessage({ - method: "updateUI", - appreciateEnabled: appreciateEnabled, - neverWhistleEnabled: neverWhistleEnabled, - showAppreciationEntity: showAppreciationEntity, - isFirstRun: Settings.getValue("appreciate/firstRun", true), - entityColor: intensityEntityColorMax - }); - break; - - case "appreciateSwitchClicked": - Settings.setValue("appreciate/firstRun", false); - appreciateEnabled = message.appreciateEnabled; - Settings.setValue("appreciate/enabled", appreciateEnabled); - enableOrDisableAppreciate(); - break; - - case "neverWhistleCheckboxClicked": - neverWhistleEnabled = message.neverWhistle; - Settings.setValue("appreciate/neverWhistle", neverWhistleEnabled); - break; - - case "showAppreciationEntityCheckboxClicked": - showAppreciationEntity = message.showAppreciationEntity; - Settings.setValue("appreciate/showAppreciationEntity", showAppreciationEntity); - break; - - case "setEntityColor": - intensityEntityColorMax = message.entityColor; - Settings.setValue("appreciate/entityColor", JSON.stringify(intensityEntityColorMax)); - break; - - case "zKeyDown": - var pressEvent = { - "text": "Z", - "isShifted": false, - "isMeta": false, - "isControl": false, - "isAlt": false, - "isAutoRepeat": message.repeat - }; - keyPressEvent(pressEvent); - break; - - case "zKeyUp": - var releaseEvent = { - "text": "Z", - "isShifted": false, - "isMeta": false, - "isControl": false, - "isAlt": false, - "isAutoRepeat": false - }; - keyReleaseEvent(releaseEvent); - break; - - default: - console.log("Unhandled message from appreciate_ui.js: " + JSON.stringify(message)); - break; - } - } - - - // Searches through all of your avatar entities and deletes any with the name - // that equals the one set when rezzing the Intensity Entity - function cleanupOldIntensityEntities() { - MyAvatar.getAvatarEntitiesVariant().forEach(function(avatarEntity) { - var name = Entities.getEntityProperties(avatarEntity.id, 'name').name; - if (name === INTENSITY_ENTITY_NAME && avatarEntity.id !== intensityEntity) { - Entities.deleteEntity(avatarEntity.id); - } - }); - } - - - // Called when the script is stopped. STOP ALL THE THINGS! - function onScriptEnding() { - maybeClearHandPositionCheckInterval(); - maybeClearHandVelocityCheckIntervalAndStopSound(); - maybeClearSoundFadeInterval(); - maybeClearVRDebounceTimer(); - maybeClearUpdateIntensityEntityInterval(); - cleanupOldIntensityEntities(); - - maybeClearStopAppreciatingTimeout(); - stopAppreciating(); - - if (desktopDebounceTimer) { - Script.clearTimeout(desktopDebounceTimer); - desktopDebounceTimer = false; - } - - if (keyEventsWired) { - Controller.keyPressEvent.disconnect(keyPressEvent); - Controller.keyReleaseEvent.disconnect(keyReleaseEvent); - keyEventsWired = false; - } - - if (intensityEntity) { - Entities.deleteEntity(intensityEntity); - intensityEntity = false; - } - - HMD.displayModeChanged.disconnect(enableOrDisableAppreciate); - } - - - // When called, this function will stop the versions of this script that are - // baked into the client installation IF there's another version of the script - // running that ISN'T the baked version. - function maybeStopBakedScriptVersions() { - var THIS_SCRIPT_FILENAME = "appreciate_app.js"; - var RELATIVE_PATH_TO_BAKED_SCRIPT = "system/experiences/appreciate/appResources/appData/" + THIS_SCRIPT_FILENAME; - var bakedLocalScriptPaths = []; - var alsoRunningNonBakedVersion = false; - - var runningScripts = ScriptDiscoveryService.getRunning(); - runningScripts.forEach(function(scriptObject) { - if (scriptObject.local && scriptObject.url.indexOf(RELATIVE_PATH_TO_BAKED_SCRIPT) > -1) { - bakedLocalScriptPaths.push(scriptObject.path); - } - - if (scriptObject.name === THIS_SCRIPT_FILENAME && scriptObject.url.indexOf(RELATIVE_PATH_TO_BAKED_SCRIPT) === -1) { - alsoRunningNonBakedVersion = true; - } - }); - - if (alsoRunningNonBakedVersion && bakedLocalScriptPaths.length > 0) { - for (var i = 0; i < bakedLocalScriptPaths.length; i++) { - ScriptDiscoveryService.stopScript(bakedLocalScriptPaths[i]); - } - } - } - - - // Called when the script starts up - var BUTTON_NAME = "APPRECIATE"; - var APP_UI_URL = Script.resolvePath('resources/appreciate_ui.html'); - var CLEANUP_INTENSITY_ENTITIES_STARTUP_DELAY_MS = 5000; - var AppUI = Script.require('appUi'); - var ui; - function startup() { - ui = new AppUI({ - buttonName: BUTTON_NAME, - home: APP_UI_URL, - // clap by Rena from the Noun Project - graphicsDirectory: Script.resolvePath("./resources/images/icons/"), - onOpened: onOpened, - onMessage: onMessage - }); - - cleanupOldIntensityEntities(); - // We need this because sometimes avatar entities load after this script does. - Script.setTimeout(cleanupOldIntensityEntities, CLEANUP_INTENSITY_ENTITIES_STARTUP_DELAY_MS); - enableOrDisableAppreciate(); - getSounds(); - getAnimations(); - HMD.displayModeChanged.connect(enableOrDisableAppreciate); - maybeStopBakedScriptVersions(); - } - - - Script.scriptEnding.connect(onScriptEnding); - startup(); -})(); - diff --git a/scripts/system/appreciate/resource.json b/scripts/system/appreciate/resource.json deleted file mode 100644 index 485d35c726..0000000000 --- a/scripts/system/appreciate/resource.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "Appreciate App", - "version": "1.5.0", - "description": "Show someone else that you like what they're doing. Open the app to see usage instructions and some options!", - "homepage": "http://overte.org", - "bugs": "", - "keywords": [ - "Clapping", - "Clap", - "Applause" - ], - "icon": "/appreciate.jpg", - "images": [ - "/appreciate.jpg" - ], - "author": { - "name": "High Fidelity", - "email": "", - "url": "", - "license": "Apache 2.0" - }, - "sublicense": [ - ], - "contributors": [ - ], - "repository": { - "type": "git", - "url": "https://github.com/overte-org/overte-content.git" - }, - "main": "/appreciate_app.js", - "type": "app", - "meta": { - }, - "dependencies": { - }, - "engines": { - }, - "resource": { - "version": 1.0.0 - } -} diff --git a/scripts/system/appreciate/resources/animations/Cheering.fbx b/scripts/system/appreciate/resources/animations/Cheering.fbx deleted file mode 100644 index 8787bf4bd8..0000000000 Binary files a/scripts/system/appreciate/resources/animations/Cheering.fbx and /dev/null differ diff --git a/scripts/system/appreciate/resources/animations/Clapping.fbx b/scripts/system/appreciate/resources/animations/Clapping.fbx deleted file mode 100644 index d05b41866d..0000000000 Binary files a/scripts/system/appreciate/resources/animations/Clapping.fbx and /dev/null differ diff --git a/scripts/system/appreciate/resources/appreciate_ui.html b/scripts/system/appreciate/resources/appreciate_ui.html deleted file mode 100644 index 24ffb6fb64..0000000000 --- a/scripts/system/appreciate/resources/appreciate_ui.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - Appreciate - - - - - - - - -
-
- -
-
-
- Appreciate v1.5 -
- -
- - - -
- Intensity Meter -
- -
-
-
- -
- Options - - - - - -
- - -
-
- -
-
- Desktop Mode:
Tap or hold the Z key on your keyboard! -
-
- VR Mode:
Raise your hands above your head and shake them! -
-
-
- - - - - diff --git a/scripts/system/appreciate/resources/css/style.css b/scripts/system/appreciate/resources/css/style.css deleted file mode 100644 index abd58b1b22..0000000000 --- a/scripts/system/appreciate/resources/css/style.css +++ /dev/null @@ -1,284 +0,0 @@ -*, *:before, *:after { - -webkit-box-sizing: inherit; - -moz-box-sizing: inherit; - box-sizing: inherit; -} - -html { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -body { - font-family: 'Raleway', sans-serif; - background-color: #393939; - color: #afafaf; - overflow: hidden; - margin: 0; - padding: 0; -} - -#mainContainer { - width: 100vw; - height: 100vh; -} - -#loadingContainer { - background-color: rgba(0, 0, 0, 0.8); - background-image: url('../images/loadingSpinner.svg'); - background-repeat: no-repeat; - background-position: center center; - width: 100vw; - height: 100vh; - position: fixed; - z-index: 999; -} - -#firstRun { - background-color: rgba(0, 0, 0, 0.9); - width: 100vw; - height: calc(100vh - 60px); - position: fixed; - z-index: 998; - padding: 8px 12px 0 50%; - font-size: 24px; - text-align: right; -} - -#tutorialArrow { - border: solid #00b4ef; - border-width: 0 5px 5px 0; - margin-right: 28px; - display: inline-block; - padding: 5px; - transform: rotate(-135deg); - -webkit-transform: rotate(-135deg); -} - -/* START SWITCH CSS -Mostly from: https://www.w3schools.com/howto/howto_css_switch.asp -*/ -#titleBarContainer { - display: flex; - align-items: center; - height: 60px; - padding: 0 16px; - font-size: 24px; - background-color: #121212; - color: #ffffff; - justify-content: space-between; -} - -/* The switch - the box around the slider */ -.switch { - position: relative; - display: block; - width: 70px; - height: 34px; -} - -/* Hide default HTML checkbox */ -.switch input { - opacity: 0; - width: 0; - height: 0; -} - -/* The slider */ -.slider { - position: absolute; - cursor: pointer; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-color: #ccc; - -webkit-transition: .4s; - transition: .4s; -} - -.slider:before { - position: absolute; - content: ""; - height: 26px; - width: 26px; - left: 4px; - bottom: 4px; - background-color: white; - -webkit-transition: .4s; - transition: .4s; -} - -input:checked + .slider { - background-color: #00b4ef; -} - -input:focus + .slider { - box-shadow: 0 0 1px #00b4ef; -} - -input:checked + .slider:before { - -webkit-transform: translateX(35px); - -ms-transform: translateX(35px); - transform: translateX(35px); -} - -/* Rounded sliders */ -.slider.round { - border-radius: 34px; -} - -.slider.round:before { - border-radius: 50%; -} -/* END SWITCH CSS */ - -/* START PROGRESS BAR CSS */ -#progressBarContainer { - width: calc(100vw - 24px); - margin: 24px auto 0 auto; -} - -#progressBarContainer > span { - font-size: 18px; -} - -#currentIntensityDisplay { - width: 100%; - height: 175px; - margin-top: 8px; - background: #FFFFFF; - background-image: linear-gradient(to right, #EEE 0, #EEE 55%, #FFF 55%, #FFF 100%); -} - -#crosshatch { - display: none; - float: right; - position: relative; - top: -175px; - height: 175px; - width: 45%; - background: repeating-linear-gradient(45deg, transparent 0px, transparent 4px, rgba(0, 0, 0, 0.1) 4px, rgba(0, 0, 0, 0.1) 8px); -} - -#currentIntensity { - display: block; - height: 100%; - background-color: #1ac567; - background-image: linear-gradient(to right,#1ac567 0, #C62147 100%); - position: relative; - overflow: hidden; -} -/* END PROGRESS BAR CSS */ - -#optionsContainer { - display: flex; - flex-direction: column; - height: 150px; - width: calc(100vw - 24px); - margin: 12px 12px 0 12px; - position: absolute; -} - -#colorPickerContainer { - margin: 8px 0 0 0; - visibility: hidden; -} - -#colorPickerContainer > input { - font-family: 'Raleway', sans-serif; - height: 34px; - font-size: 18px; - min-width: 185px; -} - -.checkmark { - position: absolute; - top: 0; - left: 0; - height: 25px; - width: 25px; - background-color: #eee; -} - -/* Create the checkmark/indicator (hidden when not checked) */ -.checkmark:after { - content: ""; - position: absolute; - display: none; -} - -#neverWhistleContainer, -#showAppreciationEntityContainer { - display: block; - margin: 8px 0 0 0; - height: 25px; - position: relative; - padding-left: 35px; - cursor: pointer; - font-size: 18px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -#showAppreciationEntityContainer { - margin-top: 16px; -} - -/* Hide the browser's default checkbox */ -#neverWhistleContainer input, -#showAppreciationEntityContainer input { - position: absolute; - opacity: 0; - cursor: pointer; - height: 0; - width: 0; -} - -/* On mouse-over, add a grey background color */ -#neverWhistleContainer:hover input ~ .checkmark, -#showAppreciationEntityContainer:hover input ~ .checkmark { - background-color: #ccc; -} - -/* When the checkbox is checked, add a blue background */ -#neverWhistleContainer input:checked ~ .checkmark, -#showAppreciationEntityContainer input:checked ~ .checkmark { - background-color: #0093C5; -} - -/* Show the checkmark when checked */ -#neverWhistleContainer input:checked ~ .checkmark:after, -#showAppreciationEntityContainer input:checked ~ .checkmark:after { - display: block; -} - -/* Style the checkmark/indicator */ -#neverWhistleContainer .checkmark:after, -#showAppreciationEntityContainer .checkmark:after { - left: 9px; - top: 3px; - width: 8px; - height: 15px; - border: solid white; - border-width: 0 3px 3px 0; - transform: rotate(45deg); - -webkit-transform: rotate(45deg); -} - -#instructions { - position: fixed; - height: 150px; - bottom: 0; - left: 0; - right: 0; - margin: 0 12px; - font-size: 18px; -} - -#instructions > div { - margin-top: 16px; -} \ No newline at end of file diff --git a/scripts/system/appreciate/resources/images/icons/appreciate-a.svg b/scripts/system/appreciate/resources/images/icons/appreciate-a.svg deleted file mode 100644 index 44cd326ea1..0000000000 --- a/scripts/system/appreciate/resources/images/icons/appreciate-a.svg +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - image/svg+xml - - SCHOOL_ICONS_100 - - - - - - SCHOOL_ICONS_100 - - - - - Created by Rena - from the Noun Project - diff --git a/scripts/system/appreciate/resources/images/icons/appreciate-i.svg b/scripts/system/appreciate/resources/images/icons/appreciate-i.svg deleted file mode 100644 index 74ae65b19f..0000000000 --- a/scripts/system/appreciate/resources/images/icons/appreciate-i.svg +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - image/svg+xml - - SCHOOL_ICONS_100 - - - - - - SCHOOL_ICONS_100 - - - - - Created by Rena - from the Noun Project - diff --git a/scripts/system/appreciate/resources/images/loadingSpinner.svg b/scripts/system/appreciate/resources/images/loadingSpinner.svg deleted file mode 100644 index a290bb8c60..0000000000 --- a/scripts/system/appreciate/resources/images/loadingSpinner.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/scripts/system/appreciate/resources/js/appreciate_ui.js b/scripts/system/appreciate/resources/js/appreciate_ui.js deleted file mode 100644 index b955193b45..0000000000 --- a/scripts/system/appreciate/resources/js/appreciate_ui.js +++ /dev/null @@ -1,188 +0,0 @@ -/* - Appreciate - Created by Zach Fox on 2019-01-30 - Copyright 2019 High Fidelity, Inc. - - Distributed under the Apache License, Version 2.0. - See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -*/ - -/* globals document EventBridge setTimeout */ - -// Called when the user clicks the switch in the top right of the app. -// Sends an event to the App JS and clears the `firstRun` `div`. -function appreciateSwitchClicked(checkbox) { - EventBridge.emitWebEvent(JSON.stringify({ - app: "appreciate", - method: "appreciateSwitchClicked", - appreciateEnabled: checkbox.checked - })); - document.getElementById("firstRun").style.display = "none"; -} - -// Called when the user checks/unchecks the Never Whistle checkbox. -// Adds the crosshatch div to the UI and sends an event to the App JS. -function neverWhistleCheckboxClicked(checkbox) { - var crosshatch = document.getElementById("crosshatch"); - if (checkbox.checked) { - crosshatch.style.display = "inline-block"; - } else { - crosshatch.style.display = "none"; - } - - EventBridge.emitWebEvent(JSON.stringify({ - app: "appreciate", - method: "neverWhistleCheckboxClicked", - neverWhistle: checkbox.checked - })); -} - -// Called when the user checks/unchecks the Show Appreciation Entity checkbox. -// Sends an event to the App JS. -function showAppreciationEntityCheckboxClicked(checkbox) { - EventBridge.emitWebEvent(JSON.stringify({ - app: "appreciate", - method: "showAppreciationEntityCheckboxClicked", - showAppreciationEntity: checkbox.checked - })); - - if (checkbox.checked) { - document.getElementById("colorPickerContainer").style.visibility = "visible"; - } else { - document.getElementById("colorPickerContainer").style.visibility = "hidden"; - } -} - -// Called when the user changes the entity's color using the jscolor picker. -// Modifies the color of the Intensity Meter gradient and sends a message to the App JS. -var START_COLOR_MULTIPLIER = 0.2; -function setEntityColor(jscolor) { - var newEntityColor = { - "red": jscolor.rgb[0], - "green": jscolor.rgb[1], - "blue": jscolor.rgb[2] - }; - - var startColor = { - "red": Math.floor(newEntityColor.red * START_COLOR_MULTIPLIER), - "green": Math.floor(newEntityColor.green * START_COLOR_MULTIPLIER), - "blue": Math.floor(newEntityColor.blue * START_COLOR_MULTIPLIER) - }; - - var currentIntensityDisplayWidth = document.getElementById("currentIntensityDisplay").offsetWidth; - var bgString = "linear-gradient(to right, rgb(" + startColor.red + ", " + - startColor.green + ", " + startColor.blue + ") 0, " + - jscolor.toHEXString() + " " + currentIntensityDisplayWidth + "px)"; - document.getElementById("currentIntensity").style.backgroundImage = bgString; - - EventBridge.emitWebEvent(JSON.stringify({ - app: "appreciate", - method: "setEntityColor", - entityColor: newEntityColor - })); -} - -// Handle EventBridge messages from *_app.js. -function onScriptEventReceived(message) { - try { - message = JSON.parse(message); - } catch (error) { - console.log("Couldn't parse script event message: " + error); - return; - } - - // This message gets sent by `entityList.js` when it shouldn't! - if (message.type === "removeEntities") { - return; - } - - switch (message.method) { - case "updateUI": - if (message.isFirstRun) { - document.getElementById("firstRun").style.display = "block"; - } - document.getElementById("appreciateSwitch").checked = message.appreciateEnabled; - document.getElementById("neverWhistleCheckbox").checked = message.neverWhistleEnabled; - - var showAppreciationEntityCheckbox = document.getElementById("showAppreciationEntityCheckbox"); - showAppreciationEntityCheckbox.checked = message.showAppreciationEntity; - if (showAppreciationEntityCheckbox.checked) { - document.getElementById("colorPickerContainer").style.visibility = "visible"; - } else { - document.getElementById("colorPickerContainer").style.visibility = "hidden"; - } - - if (message.neverWhistleEnabled) { - var crosshatch = document.getElementById("crosshatch"); - crosshatch.style.display = "inline-block"; - } - - document.getElementById("loadingContainer").style.display = "none"; - - var color = document.getElementById("colorPicker").jscolor; - color.fromRGB(message.entityColor.red, message.entityColor.green, message.entityColor.blue); - - var startColor = { - "red": Math.floor(color.rgb[0] * START_COLOR_MULTIPLIER), - "green": Math.floor(color.rgb[1] * START_COLOR_MULTIPLIER), - "blue": Math.floor(color.rgb[2] * START_COLOR_MULTIPLIER) - }; - var currentIntensityDisplayWidth = document.getElementById("currentIntensityDisplay").offsetWidth; - document.getElementById("currentIntensity").style.backgroundImage = - "linear-gradient(to right, rgb(" + startColor.red + ", " + - startColor.green + ", " + startColor.blue + ") 0, " + - color.toHEXString() + " " + currentIntensityDisplayWidth + "px)"; - break; - - case "updateCurrentIntensityUI": - document.getElementById("currentIntensity").style.width = message.currentIntensity * 100 + "%"; - break; - - default: - console.log("Unknown message received from appreciate_app.js! " + JSON.stringify(message)); - break; - } -} - -// This function detects a keydown on the document, which enables the app -// to forward these keypress events to the app JS. -function onKeyDown(e) { - var key = e.key.toUpperCase(); - if (key === "Z") { - EventBridge.emitWebEvent(JSON.stringify({ - app: "appreciate", - method: "zKeyDown", - repeat: e.repeat - })); - } -} - -// This function detects a keyup on the document, which enables the app -// to forward these keypress events to the app JS. -function onKeyUp(e) { - var key = e.key.toUpperCase(); - if (key === "Z") { - EventBridge.emitWebEvent(JSON.stringify({ - app: "appreciate", - method: "zKeyUp" - })); - } -} - -// This delay is necessary to allow for the JS EventBridge to become active. -// The delay is still necessary for HTML apps in RC78+. -var EVENTBRIDGE_SETUP_DELAY = 500; -function onLoad() { - setTimeout(function() { - EventBridge.scriptEventReceived.connect(onScriptEventReceived); - EventBridge.emitWebEvent(JSON.stringify({ - app: "appreciate", - method: "eventBridgeReady" - })); - }, EVENTBRIDGE_SETUP_DELAY); - - document.addEventListener("keydown", onKeyDown); - document.addEventListener("keyup", onKeyUp); -} - -onLoad(); \ No newline at end of file diff --git a/scripts/system/appreciate/resources/js/jscolor.js b/scripts/system/appreciate/resources/js/jscolor.js deleted file mode 100644 index 9b5e8e6cbc..0000000000 --- a/scripts/system/appreciate/resources/js/jscolor.js +++ /dev/null @@ -1,1855 +0,0 @@ -/** - * jscolor - JavaScript Color Picker - * - * @link http://jscolor.com - * @license For open source use: GPLv3 - * For commercial use: JSColor Commercial License - * @author Jan Odvarko - * @version 2.0.5 - * - * See usage examples at http://jscolor.com/examples/ - */ - - -"use strict"; - - -if (!window.jscolor) { window.jscolor = (function () { - - -var jsc = { - - - register : function () { - jsc.attachDOMReadyEvent(jsc.init); - jsc.attachEvent(document, 'mousedown', jsc.onDocumentMouseDown); - jsc.attachEvent(document, 'touchstart', jsc.onDocumentTouchStart); - jsc.attachEvent(window, 'resize', jsc.onWindowResize); - }, - - - init : function () { - if (jsc.jscolor.lookupClass) { - jsc.jscolor.installByClassName(jsc.jscolor.lookupClass); - } - }, - - - tryInstallOnElements : function (elms, className) { - var matchClass = new RegExp('(^|\\s)(' + className + ')(\\s*(\\{[^}]*\\})|\\s|$)', 'i'); - - for (var i = 0; i < elms.length; i += 1) { - if (elms[i].type !== undefined && elms[i].type.toLowerCase() == 'color') { - if (jsc.isColorAttrSupported) { - // skip inputs of type 'color' if supported by the browser - continue; - } - } - var m; - if (!elms[i].jscolor && elms[i].className && (m = elms[i].className.match(matchClass))) { - var targetElm = elms[i]; - var optsStr = null; - - var dataOptions = jsc.getDataAttr(targetElm, 'jscolor'); - if (dataOptions !== null) { - optsStr = dataOptions; - } else if (m[4]) { - optsStr = m[4]; - } - - var opts = {}; - if (optsStr) { - try { - opts = (new Function ('return (' + optsStr + ')'))(); - } catch(eParseError) { - jsc.warn('Error parsing jscolor options: ' + eParseError + ':\n' + optsStr); - } - } - targetElm.jscolor = new jsc.jscolor(targetElm, opts); - } - } - }, - - - isColorAttrSupported : (function () { - var elm = document.createElement('input'); - if (elm.setAttribute) { - elm.setAttribute('type', 'color'); - if (elm.type.toLowerCase() == 'color') { - return true; - } - } - return false; - })(), - - - isCanvasSupported : (function () { - var elm = document.createElement('canvas'); - return !!(elm.getContext && elm.getContext('2d')); - })(), - - - fetchElement : function (mixed) { - return typeof mixed === 'string' ? document.getElementById(mixed) : mixed; - }, - - - isElementType : function (elm, type) { - return elm.nodeName.toLowerCase() === type.toLowerCase(); - }, - - - getDataAttr : function (el, name) { - var attrName = 'data-' + name; - var attrValue = el.getAttribute(attrName); - if (attrValue !== null) { - return attrValue; - } - return null; - }, - - - attachEvent : function (el, evnt, func) { - if (el.addEventListener) { - el.addEventListener(evnt, func, false); - } else if (el.attachEvent) { - el.attachEvent('on' + evnt, func); - } - }, - - - detachEvent : function (el, evnt, func) { - if (el.removeEventListener) { - el.removeEventListener(evnt, func, false); - } else if (el.detachEvent) { - el.detachEvent('on' + evnt, func); - } - }, - - - _attachedGroupEvents : {}, - - - attachGroupEvent : function (groupName, el, evnt, func) { - if (!jsc._attachedGroupEvents.hasOwnProperty(groupName)) { - jsc._attachedGroupEvents[groupName] = []; - } - jsc._attachedGroupEvents[groupName].push([el, evnt, func]); - jsc.attachEvent(el, evnt, func); - }, - - - detachGroupEvents : function (groupName) { - if (jsc._attachedGroupEvents.hasOwnProperty(groupName)) { - for (var i = 0; i < jsc._attachedGroupEvents[groupName].length; i += 1) { - var evt = jsc._attachedGroupEvents[groupName][i]; - jsc.detachEvent(evt[0], evt[1], evt[2]); - } - delete jsc._attachedGroupEvents[groupName]; - } - }, - - - attachDOMReadyEvent : function (func) { - var fired = false; - var fireOnce = function () { - if (!fired) { - fired = true; - func(); - } - }; - - if (document.readyState === 'complete') { - setTimeout(fireOnce, 1); // async - return; - } - - if (document.addEventListener) { - document.addEventListener('DOMContentLoaded', fireOnce, false); - - // Fallback - window.addEventListener('load', fireOnce, false); - - } else if (document.attachEvent) { - // IE - document.attachEvent('onreadystatechange', function () { - if (document.readyState === 'complete') { - document.detachEvent('onreadystatechange', arguments.callee); - fireOnce(); - } - }) - - // Fallback - window.attachEvent('onload', fireOnce); - - // IE7/8 - if (document.documentElement.doScroll && window == window.top) { - var tryScroll = function () { - if (!document.body) { return; } - try { - document.documentElement.doScroll('left'); - fireOnce(); - } catch (e) { - setTimeout(tryScroll, 1); - } - }; - tryScroll(); - } - } - }, - - - warn : function (msg) { - if (window.console && window.console.warn) { - window.console.warn(msg); - } - }, - - - preventDefault : function (e) { - if (e.preventDefault) { e.preventDefault(); } - e.returnValue = false; - }, - - - captureTarget : function (target) { - // IE - if (target.setCapture) { - jsc._capturedTarget = target; - jsc._capturedTarget.setCapture(); - } - }, - - - releaseTarget : function () { - // IE - if (jsc._capturedTarget) { - jsc._capturedTarget.releaseCapture(); - jsc._capturedTarget = null; - } - }, - - - fireEvent : function (el, evnt) { - if (!el) { - return; - } - if (document.createEvent) { - var ev = document.createEvent('HTMLEvents'); - ev.initEvent(evnt, true, true); - el.dispatchEvent(ev); - } else if (document.createEventObject) { - var ev = document.createEventObject(); - el.fireEvent('on' + evnt, ev); - } else if (el['on' + evnt]) { // alternatively use the traditional event model - el['on' + evnt](); - } - }, - - - classNameToList : function (className) { - return className.replace(/^\s+|\s+$/g, '').split(/\s+/); - }, - - - // The className parameter (str) can only contain a single class name - hasClass : function (elm, className) { - if (!className) { - return false; - } - return -1 != (' ' + elm.className.replace(/\s+/g, ' ') + ' ').indexOf(' ' + className + ' '); - }, - - - // The className parameter (str) can contain multiple class names separated by whitespace - setClass : function (elm, className) { - var classList = jsc.classNameToList(className); - for (var i = 0; i < classList.length; i += 1) { - if (!jsc.hasClass(elm, classList[i])) { - elm.className += (elm.className ? ' ' : '') + classList[i]; - } - } - }, - - - // The className parameter (str) can contain multiple class names separated by whitespace - unsetClass : function (elm, className) { - var classList = jsc.classNameToList(className); - for (var i = 0; i < classList.length; i += 1) { - var repl = new RegExp( - '^\\s*' + classList[i] + '\\s*|' + - '\\s*' + classList[i] + '\\s*$|' + - '\\s+' + classList[i] + '(\\s+)', - 'g' - ); - elm.className = elm.className.replace(repl, '$1'); - } - }, - - - getStyle : function (elm) { - return window.getComputedStyle ? window.getComputedStyle(elm) : elm.currentStyle; - }, - - - setStyle : (function () { - var helper = document.createElement('div'); - var getSupportedProp = function (names) { - for (var i = 0; i < names.length; i += 1) { - if (names[i] in helper.style) { - return names[i]; - } - } - }; - var props = { - borderRadius: getSupportedProp(['borderRadius', 'MozBorderRadius', 'webkitBorderRadius']), - boxShadow: getSupportedProp(['boxShadow', 'MozBoxShadow', 'webkitBoxShadow']) - }; - return function (elm, prop, value) { - switch (prop.toLowerCase()) { - case 'opacity': - var alphaOpacity = Math.round(parseFloat(value) * 100); - elm.style.opacity = value; - elm.style.filter = 'alpha(opacity=' + alphaOpacity + ')'; - break; - default: - elm.style[props[prop]] = value; - break; - } - }; - })(), - - - setBorderRadius : function (elm, value) { - jsc.setStyle(elm, 'borderRadius', value || '0'); - }, - - - setBoxShadow : function (elm, value) { - jsc.setStyle(elm, 'boxShadow', value || 'none'); - }, - - - getElementPos : function (e, relativeToViewport) { - var x=0, y=0; - var rect = e.getBoundingClientRect(); - x = rect.left; - y = rect.top; - if (!relativeToViewport) { - var viewPos = jsc.getViewPos(); - x += viewPos[0]; - y += viewPos[1]; - } - return [x, y]; - }, - - - getElementSize : function (e) { - return [e.offsetWidth, e.offsetHeight]; - }, - - - // get pointer's X/Y coordinates relative to viewport - getAbsPointerPos : function (e) { - if (!e) { e = window.event; } - var x = 0, y = 0; - if (typeof e.changedTouches !== 'undefined' && e.changedTouches.length) { - // touch devices - x = e.changedTouches[0].clientX; - y = e.changedTouches[0].clientY; - } else if (typeof e.clientX === 'number') { - x = e.clientX; - y = e.clientY; - } - return { x: x, y: y }; - }, - - - // get pointer's X/Y coordinates relative to target element - getRelPointerPos : function (e) { - if (!e) { e = window.event; } - var target = e.target || e.srcElement; - var targetRect = target.getBoundingClientRect(); - - var x = 0, y = 0; - - var clientX = 0, clientY = 0; - if (typeof e.changedTouches !== 'undefined' && e.changedTouches.length) { - // touch devices - clientX = e.changedTouches[0].clientX; - clientY = e.changedTouches[0].clientY; - } else if (typeof e.clientX === 'number') { - clientX = e.clientX; - clientY = e.clientY; - } - - x = clientX - targetRect.left; - y = clientY - targetRect.top; - return { x: x, y: y }; - }, - - - getViewPos : function () { - var doc = document.documentElement; - return [ - (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0), - (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0) - ]; - }, - - - getViewSize : function () { - var doc = document.documentElement; - return [ - (window.innerWidth || doc.clientWidth), - (window.innerHeight || doc.clientHeight), - ]; - }, - - - redrawPosition : function () { - - if (jsc.picker && jsc.picker.owner) { - var thisObj = jsc.picker.owner; - - var tp, vp; - - if (thisObj.fixed) { - // Fixed elements are positioned relative to viewport, - // therefore we can ignore the scroll offset - tp = jsc.getElementPos(thisObj.targetElement, true); // target pos - vp = [0, 0]; // view pos - } else { - tp = jsc.getElementPos(thisObj.targetElement); // target pos - vp = jsc.getViewPos(); // view pos - } - - var ts = jsc.getElementSize(thisObj.targetElement); // target size - var vs = jsc.getViewSize(); // view size - var ps = jsc.getPickerOuterDims(thisObj); // picker size - var a, b, c; - switch (thisObj.position.toLowerCase()) { - case 'left': a=1; b=0; c=-1; break; - case 'right':a=1; b=0; c=1; break; - case 'top': a=0; b=1; c=-1; break; - default: a=0; b=1; c=1; break; - } - var l = (ts[b]+ps[b])/2; - - // compute picker position - if (!thisObj.smartPosition) { - var pp = [ - tp[a], - tp[b]+ts[b]-l+l*c - ]; - } else { - var pp = [ - -vp[a]+tp[a]+ps[a] > 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; - - -})(); } diff --git a/scripts/system/appreciate/resources/sounds/claps/01.wav b/scripts/system/appreciate/resources/sounds/claps/01.wav deleted file mode 100644 index b4baa2888a..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/01.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/claps/02.wav b/scripts/system/appreciate/resources/sounds/claps/02.wav deleted file mode 100644 index 21cbf3fa4a..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/02.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/claps/03.wav b/scripts/system/appreciate/resources/sounds/claps/03.wav deleted file mode 100644 index bc5d35760d..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/03.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/claps/04.wav b/scripts/system/appreciate/resources/sounds/claps/04.wav deleted file mode 100644 index cacaf44b6e..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/04.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/claps/05.wav b/scripts/system/appreciate/resources/sounds/claps/05.wav deleted file mode 100644 index ffb688b5b2..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/05.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/claps/06.wav b/scripts/system/appreciate/resources/sounds/claps/06.wav deleted file mode 100644 index 81716f26be..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/06.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/claps/07.wav b/scripts/system/appreciate/resources/sounds/claps/07.wav deleted file mode 100644 index 4c20ceba2c..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/07.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/claps/08.wav b/scripts/system/appreciate/resources/sounds/claps/08.wav deleted file mode 100644 index c39e4b1dfc..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/08.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/claps/09.wav b/scripts/system/appreciate/resources/sounds/claps/09.wav deleted file mode 100644 index 791433c024..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/09.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/claps/10.wav b/scripts/system/appreciate/resources/sounds/claps/10.wav deleted file mode 100644 index b359475b51..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/10.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/claps/11.wav b/scripts/system/appreciate/resources/sounds/claps/11.wav deleted file mode 100644 index 40b8415725..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/11.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/claps/12.wav b/scripts/system/appreciate/resources/sounds/claps/12.wav deleted file mode 100644 index 68656f7c21..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/12.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/claps/13.wav b/scripts/system/appreciate/resources/sounds/claps/13.wav deleted file mode 100644 index e6a716ccdd..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/13.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/claps/14.wav b/scripts/system/appreciate/resources/sounds/claps/14.wav deleted file mode 100644 index a5e8b5ad49..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/14.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/claps/15.wav b/scripts/system/appreciate/resources/sounds/claps/15.wav deleted file mode 100644 index 7f3072e3e0..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/15.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/claps/16.wav b/scripts/system/appreciate/resources/sounds/claps/16.wav deleted file mode 100644 index f76bee0429..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/claps/16.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/01.wav b/scripts/system/appreciate/resources/sounds/whistles/01.wav deleted file mode 100644 index d8b27da990..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/01.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/02.wav b/scripts/system/appreciate/resources/sounds/whistles/02.wav deleted file mode 100644 index 0c0874087e..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/02.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/03.wav b/scripts/system/appreciate/resources/sounds/whistles/03.wav deleted file mode 100644 index 5a78406601..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/03.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/04.wav b/scripts/system/appreciate/resources/sounds/whistles/04.wav deleted file mode 100644 index eb4cb40675..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/04.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/05.wav b/scripts/system/appreciate/resources/sounds/whistles/05.wav deleted file mode 100644 index f261e29aac..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/05.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/06.wav b/scripts/system/appreciate/resources/sounds/whistles/06.wav deleted file mode 100644 index 7194c02d9b..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/06.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/07.wav b/scripts/system/appreciate/resources/sounds/whistles/07.wav deleted file mode 100644 index 43d65f3af7..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/07.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/08.wav b/scripts/system/appreciate/resources/sounds/whistles/08.wav deleted file mode 100644 index 612bc5b5fa..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/08.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/09.wav b/scripts/system/appreciate/resources/sounds/whistles/09.wav deleted file mode 100644 index d900d59f03..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/09.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/10.wav b/scripts/system/appreciate/resources/sounds/whistles/10.wav deleted file mode 100644 index 3c9b7fa9dc..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/10.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/11.wav b/scripts/system/appreciate/resources/sounds/whistles/11.wav deleted file mode 100644 index 8315b21cca..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/11.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/12.wav b/scripts/system/appreciate/resources/sounds/whistles/12.wav deleted file mode 100644 index c787336068..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/12.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/13.wav b/scripts/system/appreciate/resources/sounds/whistles/13.wav deleted file mode 100644 index fd303d27fc..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/13.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/14.wav b/scripts/system/appreciate/resources/sounds/whistles/14.wav deleted file mode 100644 index eda14dc291..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/14.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/15.wav b/scripts/system/appreciate/resources/sounds/whistles/15.wav deleted file mode 100644 index f86e9e2cb2..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/15.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/16.wav b/scripts/system/appreciate/resources/sounds/whistles/16.wav deleted file mode 100644 index 22ff07a650..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/16.wav and /dev/null differ diff --git a/scripts/system/appreciate/resources/sounds/whistles/17.wav b/scripts/system/appreciate/resources/sounds/whistles/17.wav deleted file mode 100644 index 498d6df56a..0000000000 Binary files a/scripts/system/appreciate/resources/sounds/whistles/17.wav and /dev/null differ