Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
release 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sinoser committed Oct 8, 2014
1 parent 350729d commit 5265d4f
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 27 deletions.
8 changes: 7 additions & 1 deletion atomicLevel/atomicLevel.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
@charset "utf-8";
/* CSS Document */
/*
* About : atomicLevel v2.0.0 - base styles
* Theme name : Flat
* Created and published by : Mr.sinoser [mohammad ebrahimi aval]
* publisher site :http://sinoser.ir
* publisher blog :http://sinoser.ir/blog
*/

.atomicLevel-topic{
display: block;
Expand Down
48 changes: 34 additions & 14 deletions atomicLevel/atomicLevel.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* About : atomicLevel v2.0.0 - scripts
* Theme name : Flat
* Created and published by : Mr.sinoser [mohammad ebrahimi aval]
* publisher site :http://sinoser.ir
* publisher blog :http://sinoser.ir/blog
*/
(function($){
$.fn.atomicLevel = function(option,ease,callback){
option = $.extend({
Expand All @@ -14,26 +21,27 @@
return;
}
//check and set ease and callback arguments
if(!$.isFunction(callback)){
if($.isFunction(ease)){
callback = ease;
ease = 'linear';
}else if(!$.isFunction(callback)){
if($.type(ease) == 'string'){
callback = function(){};
}else{
console.log("atomicLevel plugin ERROR : invalid either ease or callback parameters");
callback = function(){};//fix bog
ease = "linear";
}
}else if($.isFunction(ease)){
callback = ease;
ease = 'linear';
}

//add base frame
$(this)
.html('<span class="atomicLevel-topic">'+option.topic+'</span><div class="atomicLevel-wrap"><div class="atomicLevel-pointSelector"></div><div class="atomicLevel-pointLine"></div></div>');


var senseStringValue = false;
$.each(option.params,function(index,value){
if($.type(value) == "string"){
senseStringValue = true;
$('.atomicLevel-pointSelector')
.before('<div class="atomicLevel-pointPart" data-value="undefined" ><div class="atomicLevel-pointText">'+value+'</div><div class="atomicLevel-pointPIC"></div></div>');
}else{
Expand Down Expand Up @@ -95,15 +103,25 @@
$('.atomicLevel-pointText').removeClass('atomicLevel-activePointTXT').eq(level).addClass('atomicLevel-activePointTXT');
$('.atomicLevel-pointSelector').animate({left:level*setWidth},setWidth*2,ease,function(){

callback(level+1,option.params[level]);
console.log( callback());
if(senseStringValue)
callback(level+1,option.params[level]);
else
callback(level+1,option.params[level][1]);

if(option.redirect && $.type(option.params[level]) != "string"){
if(option.redirect){
if(senseStringValue){
console.log("your params option is invalid");
return false;
}

urlPart = document.URL.split('?');
if($.type(urlPart[1]) != 'undefined' && urlPart[1] != ''){//if have other get data
wl = urlPart[1].split('&');
var startPointSens = false;
var pointDataSens = false;

var pointTitleSens = false;

$.each(wl,function(i,v){
wl[i] = v.split('=');
if(wl[i][0] == 'startPoint'){
Expand All @@ -113,8 +131,8 @@
wl[i][1] = $('.atomicLevel-pointPart').eq(level).attr('data-value');
pointDataSens = true;
}else if(wl[i][0] == 'pointTitle'){
wl[i][1] = option.params[level];
pointDataSens = true;
wl[i][1] = option.params[level][0];
pointTitleSens = true;
}
});

Expand All @@ -126,16 +144,18 @@
}

if(!startPointSens)
URL = URL + '&startPoint='+(level+1) ;
URL = URL + '&startPoint='+(level+1);

if(!pointDataSens)
URL = URL + '&pointData='+
$('.atomicLevel-pointPart').eq(level).attr('data-value') + '&pointTitle=' + option.params[level];
URL = URL + '&pointData='+$('.atomicLevel-pointPart').eq(level).attr('data-value');

if(!pointTitleSens)
URL = URL + '&pointTitle=' + option.params[level][0];

URL = urlPart[0]+'?'+URL;
document.location = URL;
}else{//if url is clean
document.location = document.location +'?'+ 'startPoint=' + (level+1) + '&pointData=' + $('.atomicLevel-pointPart').eq(level).attr('data-value')+ '&pointTitle=' + option.params[level] ;
document.location = document.location +'?'+ 'startPoint=' + (level+1) + '&pointData=' + $('.atomicLevel-pointPart').eq(level).attr('data-value')+ '&pointTitle=' + option.params[level][0] ;
}
}
});
Expand Down
8 changes: 7 additions & 1 deletion atomicLevel/theme.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
@charset "utf-8";
/* CSS Document */
/*
* About : atomicLevel v2.0.0 - theme styles
* Theme name : Flat
* Created and published by : Mr.sinoser [mohammad ebrahimi aval]
* publisher site :http://sinoser.ir
* publisher blog :http://sinoser.ir/blog
*/

.atomicLevel-topic{
text-align:right;
Expand Down
10 changes: 6 additions & 4 deletions example2.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>example 2 of atomicLevel plugin of Mr.sinoser</title>
<title>example 3 of atomicLevel plugin of Mr.sinoser</title>
<style>body{padding:30px;}dt{color: chocolate;}dd{color: royalblue;}h4>span{color: red}</style>

<script type="text/javascript" src="scripts/jquery-1.11.1.min.js"></script>
Expand Down Expand Up @@ -33,13 +33,15 @@
</head>
<body>

<h1>example 2 : atomicLevel plugin of Mr.sinoser</h1>
<h1>example 3 : atomicLevel plugin of Mr.sinoser</h1>
<h4>
you are in point '
<span id="pointIndex"><?php if (@$_GET["startPoint"])echo $_GET["startPoint"]; else echo 1; ?></span>
'with '
<span id="pointTitle"><?php if (@$_GET["pointTitle"])echo $_GET["pointTitle"]; else echo 1; ?></span>
'title. this text are changing when you change level
<span id="pointTitle"><?php if (@$_GET["pointTitle"])echo $_GET["pointTitle"]; else echo "Around 20$"; ?></span>
'title and '
<span id="pointData"><?php if (@$_GET["pointData"])echo $_GET["pointData"]; else echo "20"; ?></span>
' data-value. this text are changing when you change level
</h4>

<span> note : you can use neither drag and drop and click on levels to change state</span>
Expand Down
23 changes: 16 additions & 7 deletions example3.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
$('#container').atomicLevel(
{
params:myParams,
params:['stage1','stage 2','stage 3','stage 4','stage 5']],
width:400,
start:<?php if (@$_GET["startPoint"])echo $_GET["startPoint"]; else echo 1; ?>,
redirect : true,
start:2,
dir:"ltr"
},
function(index,value){
$("#pointIndex").text(index);
$("#pointTitle").text(value);
}
);
});
Expand All @@ -31,7 +34,14 @@
<body>

<h1>example 3 : atomicLevel plugin of Mr.sinoser</h1>
<h4>you are in point '<span id="pointIndex">4</span>' with '<span id="pointValue">level 4</span>' title. this text are changing when you change level</h4>
<h4>
you are in point '
<span id="pointIndex">2</span>
'with '
<span id="pointTitle">stage2</span>
'title. this text are changing when you change level
</h4>
<span> note : you can use neither drag and drop and click on levels to change state</span>
<br><br>
Expand All @@ -42,10 +52,9 @@
<dl>
<dt>$('#container').atomicLevel(</dt>
<dt>{</dt>
<dd>params : ['1 stage','2 stage','3 stage','4 stage',['5 stage','ended']],</dd>
<dd>params : ['1 stage','2 stage','3 stage','4 stage','5 stage'],</dd>
<dd>width : 400,</dd>
<dd>start : &lt;?php if (@$_GET["startPoint"])echo $_GET["startPoint"]; else echo 1; ?&gt;,</dd>
<dd>redirect : true,</dd>
<dd>start : 2,</dd>
<dd>dir : "ltr",</dd>
<dt>});</dl>
</dl>
Expand Down

0 comments on commit 5265d4f

Please # to comment.