Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackSkorpio committed Dec 23, 2015
1 parent 37228eb commit c3eb131
Show file tree
Hide file tree
Showing 5 changed files with 984 additions and 0 deletions.
29 changes: 29 additions & 0 deletions license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Software License Agreement (BSD License)

Copyright (c) 2003, Scott Schiller (schillmania.com)
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

* Neither the name of schillmania.com nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission from schillmania.com.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
210 changes: 210 additions & 0 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
{
"name": "Snowstorm",
"description": "DHTML Snowstorm! JavaScript-based snow for web pages. Making it snow on Koken since 2015.",
"version": "1.0.0",
"demo": "http://kokensupport.com/demo/",
"author": {
"name": "Bjarne Varoystrand",
"link": "http://kokensupport.com/"
},

"data": {
"snowStorm_mobile": {
"label": "Exclude on mobile",
"info": "Snow is likely to be bad news for mobile phones CPUs (and batteries.) Enable at your own risk.",
"type": "select",
"options": [
{ "value": "true", "label": "True" },
{ "value": "false", "label": "False" }
],
"value": "true"
},
"snowStorm_flakemax": {
"label": "Max flakes on screen",
"info": "Limit total amount of snow made (falling + sticking)",
"type": "number",
"value": 128
},
"snowStorm_flakemaxactive": {
"label": "Max flakes active",
"info": "Limit amount of snow falling at once (less = lower CPU use)",
"type": "number",
"value": 64
},
"snowStorm_animationinterval": {
"label": "Update interval",
"info": "Theoretical miliseconds per frame measurement. 20 = fast + smooth, but high CPU use. 50 = more conservative, but slower.",
"type": "number",
"value": 33
},
"snowStorm_gpu": {
"label": "Use hardware acceleration",
"info": "Enable transform-based hardware acceleration, reduce CPU load.",
"type": "select",
"options": [
{ "value": "true", "label": "True" },
{ "value": "false", "label": "False" }
],
"value": "true"
},
"snowStorm_flakebottom": {
"label": "Flake bottom",
"info": "Integer for Y axis snow limit, 0 or null for full-screen snow effect",
"type": "string",
"value": "0"
},
"snowStorm_followmouse": {
"label": "Follow mouse",
"info": "Snow movement can respond to the user's mouse",
"type": "select",
"options": [
{ "value": "true", "label": "True" },
{ "value": "false", "label": "False" }
],
"value": "true"
},
"snowStorm_color": {
"label": "Snowflake color",
"info": "Remember: Don't eat (or use?) yellow snow!",
"type": "color",
"value": "#FFFFFF"
},
"snowStorm_char": {
"label": "Flake character",
"info": "Character used for the flake. See http://www.w3schools.com/charsets/ref_utf_dingbats.asp for reference.",
"type": "select",
"options": [
{ "label": "Bullet", "value": "•" },
{ "label": "Sparkles", "value": "✨" },
{ "label": "Open centre asterisk", "value": "✲" },
{ "label": "Eight spoked asterisk", "value": "✳" },
{ "label": "Eight pointed pinwheel star", "value": "✵" },
{ "label": "Teardrop-spoked asterisk", "value": "✻" },
{ "label": "Open centre teardrop-spoked asterisk", "value": "✼" },
{ "label": "Heavy teardrop-spoked asterisk", "value": "✽" },
{ "label": "Six petalled black and white florette", "value": "✾" },
{ "label": "Black florette", "value": "✿" },
{ "label": "White florette", "value": "❀" },
{ "label": "Eight petalled outlined black florette", "value": "❁" },
{ "label": "Heavy teardrop-spoked pinwheel asterisk", "value": "❃" },
{ "label": "Snowflake", "value": "❄" },
{ "label": "Tight trifoliate snowflake", "value": "❅" },
{ "label": "Heavy chevron snowflake", "value": "❆" },
{ "label": "Sparkle", "value": "❇" },
{ "label": "Heavy sparkle", "value": "❈" },
{ "label": "Balloon-spoked asterisk", "value": "❉" },
{ "label": "Eight teardrop-spoked propeller asterisk", "value": "❊" },
{ "label": "Heavy eight teardrop-spoked propeller asterisk", "value": "❋" }
],
"value": "❄"
},
"snowStorm_snowstick": {
"label": "Stick to bottom?",
"info": "Whether or not snow should 'stick' at the bottom. When off, will never collect.",
"type": "select",
"options": [
{ "value": "true", "label": "True" },
{ "value": "false", "label": "False" }
],
"value": "true"
},
"snowStorm_targetelement": {
"label": "Target element",
"info": "Element which snow will be appended to (null = document.body) - can be an element ID eg. 'myDiv', or a DOM node reference",
"type": "string",
"value": "null"
},
"snowStorm_usemelteffect": {
"label": "Melting effect",
"info": "When recycling fallen snow (or rarely, when falling), have it 'melt' and fade out if browser supports it",
"type": "select",
"options": [
{ "value": "true", "label": "True" },
{ "value": "false", "label": "False" }
],
"value": "true"
},
"snowStorm_twinkeleffect": {
"label": "Flicker effect",
"info": "Allow snow to randomly 'flicker' in and out of view while falling",
"type": "select",
"options": [
{ "value": "true", "label": "True" },
{ "value": "false", "label": "False" }
],
"value": "false"
},
"snowStorm_positionfixed": {
"label": "Snow Position",
"info": "true = snow does not shift vertically when scrolling. May increase CPU load, disabled by default - if enabled, used only where supported",
"type": "select",
"options": [
{ "value": "true", "label": "True" },
{ "value": "false", "label": "False" }
],
"value": "false"
},
"snowStorm_pixelposition": {
"label": "Pixel position",
"info": "Whether to use pixel values for snow top/left vs. percentages. Auto-enabled if body is position:relative or targetElement is specified.",
"type": "select",
"options": [
{ "value": "true", "label": "True" },
{ "value": "false", "label": "False" }
],
"value": "false"
},
"snowStorm_freezeonblur": {
"label": "Stop when not in focus",
"info": "Only snow when the window is in focus (foreground.) Saves CPU.",
"type": "select",
"options": [
{ "value": "true", "label": "True" },
{ "value": "false", "label": "False" }
],
"value": "true"
},
"snowStorm_flakeleftoffset": {
"label": "Left margin space",
"info": "Left margin/gutter space on edge of container (eg. browser window.) Bump up these values if seeing horizontal scrollbars.",
"type": "number",
"value": 0
},
"snowStorm_flakerightoffset": {
"label": "Right margin space",
"info": "Right margin/gutter space on edge of container",
"type": "number",
"value": 0
},
"snowStorm_flakewidth": {
"label": "Flake width",
"info": "Max pixel width reserved for snow element",
"type": "number",
"value": 50
},
"snowStorm_flakeheight": {
"label": "Flake height",
"info": "Max pixel height reserved for snow element",
"type": "number",
"value": 50
},
"snowStorm_vmaxx": {
"label": "Maximum X velocity",
"info": "Maximum X velocity range for snow",
"type": "number",
"value": 5
},
"snowStorm_vmaxy": {
"label": "Maximum Y velocity",
"info": "Maximum Y velocity range for snow",
"type": "number",
"value": 4
},
"snowStorm_zindex": {
"label": "Stacking order",
"info": "CSS stacking order (z-index) applied to each snowflake",
"type": "number",
"value": 0
}
}
}
69 changes: 69 additions & 0 deletions plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

class BaldursPhotographySnowStorm extends KokenPlugin {

function __construct()
{
$this->require_setup = false;
$this->register_hook('before_closing_head', 'render');
}

function render()
{

$excludeMobile = $this->data->snowStorm_mobile;
$flakesMax = $this->data->snowStorm_flakemax;
$flakesMaxActive = $this->data->snowStorm_flakemaxactive;
$animationInterval = $this->data->snowStorm_animationinterval;
$useGPU = $this->data->snowStorm_gpu;
$flakeBottom = $this->data->snowStorm_flakebottom;
$followMouse = $this->data->snowStorm_followmouse;
$snowColor = $this->data->snowStorm_color;
$snowCharacter = $this->data->snowStorm_char;
$snowStick = $this->data->snowStorm_snowstick;
$targetElement = $this->data->snowStorm_targetelement;
$useMeltEffect = $this->data->snowStorm_usemelteffect;
$useTwinkleEffect = $this->data->snowStorm_twinkeleffect;
$usePositionFixed = $this->data->snowStorm_positionfixed;
$usePixelPosition = $this->data->snowStorm_pixelposition;
$freezeOnBlur = $this->data->snowStorm_freezeonblur;
$flakeLeftOffset = $this->data->snowStorm_flakeleftoffset;
$flakeRightOffset = $this->data->snowStorm_flakerightoffset;
$flakeWidth = $this->data->snowStorm_flakewidth;
$flakeHeight = $this->data->snowStorm_flakeheight;
$vMaxX = $this->data->snowStorm_vmaxx;
$vMaxY = $this->data->snowStorm_vmaxy;
$zIndex = $this->data->snowStorm_zindex;
$path = $this->get_path();

echo <<<OUT
<script type="text/javascript" src="{$path}/snowstorm.js"></script>
<script type="text/javascript">
snowStorm.autoStart = true;
snowStorm.excludeMobile = {$excludeMobile};
snowStorm.flakesMax = {$flakesMax};
snowStorm.flakesMaxActive = {$flakesMaxActive};
snowStorm.animationInterval = {$animationInterval};
snowStorm.useGPU = {$useGPU};
snowStorm.flakeBottom = {$flakeBottom};
snowStorm.followMouse = {$followMouse};
snowStorm.snowColor = '{$snowColor}';
snowStorm.snowCharacter = '{$snowCharacter}'
snowStorm.snowStick = {$snowStick};
snowStorm.targetElement = {$targetElement};
snowStorm.useMeltEffect = {$useMeltEffect};
snowStorm.useTwinkleEffect = {$useTwinkleEffect};
snowStorm.usePositionFixed = {$usePositionFixed};
snowStorm.usePixelPosition = {$usePixelPosition};
snowStorm.freezeOnBlur = {$freezeOnBlur};
snowStorm.flakeLeftOffset = {$flakeLeftOffset};
snowStorm.flakeRightOffset = {$flakeRightOffset};
snowStorm.flakeWidth = {$flakeWidth};
snowStorm.flakeHeight = {$flakeHeight};
snowStorm.vMaxX = {$vMaxX};
snowStorm.vMaxY = {$vMaxY};
snowStorm.zIndex = {$zIndex};
</script>
OUT;
}
}
Loading

0 comments on commit c3eb131

Please sign in to comment.