Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackSkorpio committed Dec 22, 2015
1 parent f1f8f41 commit 31b7f38
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
18 changes: 18 additions & 0 deletions jquery.snow.min.1.0.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* jquery.snow - jQuery Snow Effect Plugin
*
* Available under MIT licence
*
* @version 1 (21. Jan 2012)
* @author Ivan Lazarevic
* @requires jQuery
* @see http://workshop.rs
*
* @params minSize - min size of snowflake, 10 by default
* @params maxSize - max size of snowflake, 20 by default
* @params newOn - frequency in ms of appearing of new snowflake, 500 by default
* @params flakeColor - color of snowflake, #FFFFFF by default
* @example $.fn.snow({ maxSize: 200, newOn: 1000 });
*/

(function($){$.fn.snow=function(options){var $flake=$('<div id="flake" style="z-index:999;" />').css({'position':'absolute','top':'-50px'}).html('&#10052;'),documentHeight=$(document).height(),documentWidth=$(document).width(),defaults={minSize:10,maxSize:20,newOn:500,flakeColor:"#FFFFFF"},options=$.extend({},defaults,options);var interval=setInterval(function(){var startPositionLeft=Math.random()*documentWidth-100,startOpacity=0.5+Math.random(),sizeFlake=options.minSize+Math.random()*options.maxSize,endPositionTop=documentHeight-40,endPositionLeft=startPositionLeft-100+Math.random()*200,durationFall=documentHeight*10+Math.random()*5000;$flake.clone().appendTo('body').css({left:startPositionLeft,opacity:startOpacity,'font-size':sizeFlake,color:options.flakeColor}).animate({top:endPositionTop,left:endPositionLeft,opacity:0.2},durationFall,'linear',function(){$(this).remove()});},options.newOn);};})(jQuery);
37 changes: 37 additions & 0 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "Let It Snow",
"description": "Let it snow on your site",
"version": "1.0.0",
"demo": "http://varoystrand.se/sidor/let-it-snow-for-koken/",
"author": {
"name": "Bjarne Varoystrand",
"link": "http://varoystrand.se/"
},

"data": {
"let_it_snow_minsize": {
"label": "Min size",
"info": "Min size of snowflake.",
"type": "number",
"value": 10
},
"let_it_snow_maxsize": {
"label": "Max size",
"info": "Max size of snowflake.",
"type": "number",
"value": 20
},
"let_it_snow_newon": {
"label": "Snow frequency",
"info": "Frequency in ms of appearing of new snowflake.",
"type": "number",
"value": "500"
},
"let_it_snow_flakecolor": {
"label": "Color",
"info": "Color of snowflake.",
"type": "color",
"value": "#FFFFFF"
}
}
}
29 changes: 29 additions & 0 deletions plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

class BaldursPhotographyLetItSnow extends KokenPlugin {

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

function render()
{

$minsize = $this->data->let_it_snow_minsize;
$maxsize = $this->data->let_it_snow_maxsize;
$newon = $this->data->let_it_snow_newon;
$flakecolor = $this->data->let_it_snow_flakecolor;
$path = $this->get_path();

echo <<<OUT
<script src="{$path}/jquery.snow.min.1.0.js"></script>
<script>
$(document).ready( function(){
$.fn.snow({ minSize: {$minsize}, maxSize: {$maxsize}, newOn: {$newon}, flakeColor: '{$flakecolor}' });
});
</script>
OUT;
}
}

0 comments on commit 31b7f38

Please sign in to comment.