Correcion problema generacion json, mejora soporte parallax , agregado id_campo al api

This commit is contained in:
humano 2014-11-21 12:33:44 -05:00
parent 666322d919
commit 015955526b
22 changed files with 5589 additions and 36 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

View File

@ -0,0 +1,26 @@
.cleditorMain {border:1px solid #999; padding:0 1px 1px; background-color:white}
.cleditorMain,
.cleditorPopup,
.cleditorMain * {-moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box}
.cleditorMain iframe {border:none; margin:0; padding:0}
.cleditorMain textarea {overflow-y:scroll; font:10pt Arial,Verdana; resize:none; outline:none}
.cleditorToolbar {background: url('images/toolbar.gif') repeat}
.cleditorGroup {float:left; height:26px}
.cleditorButton {float:left; width:24px; height:24px; margin:1px 0 1px 0; background: url('images/buttons.gif')}
.cleditorDisabled {opacity:0.3; filter:alpha(opacity=30)}
.cleditorDivider {float:left; width:1px; height:23px; margin:1px 0 1px 0; background:#CCC}
.cleditorPopup {border:solid 1px #999; background-color:white; color:#333333; position:absolute; font:10pt Arial,Verdana; cursor:default; z-index:10000}
.cleditorList div {padding:2px 4px 2px 4px}
.cleditorList p,
.cleditorList h1,
.cleditorList h2,
.cleditorList h3,
.cleditorList h4,
.cleditorList h5,
.cleditorList h6,
.cleditorList font {padding:0; margin:0; background-color:Transparent}
.cleditorColor {width:150px; padding:1px 0 0 1px}
.cleditorColor div {float:left; width:14px; height:14px; margin:0 1px 1px 0}
.cleditorPrompt {background-color:#F6F7F9; padding:8px; font-size:8.5pt}
.cleditorPrompt label {padding-bottom:8px}
.cleditorMsg {background-color:#FDFCEE; width:150px; padding:4px; font-size:8.5pt}

172
milfs/css/style.css Normal file
View File

@ -0,0 +1,172 @@
* {
margin: 0;
padding: 0;
}
body {
background: #222;
font-family: Georgia, serif;
color: #fff;
font-size: 14px;
}
#dates a {
color: gray;
text-decoration: none;
-webkit-transition: 0.5s;
-moz-transition: 0.5s;
-o-transition: 0.5s;
-ms-transition: 0.5s;
transition: 0.5s;
font-size: 12px;
}
#dates a:hover,
#dates a.selected {
color: red;
font-size: 18px;
}
/*
h1,h2,h4,h5,h6 {
text-align: center;
color: #ccc;
text-shadow: #000 1px 1px 2px;
margin-bottom: 5px;
}
h1 {
font-size: 18px;
}
h2 {
font-size: 14px;
}
.sociales {
text-align: center;
margin-bottom: 20px;
}
*/
#timeline {
width: 95%;
height: 500px;
overflow: hidden;
margin: 100px auto;
position: relative;
}
#dates {
width: 800px;
height: 60px;
overflow: hidden;
background: url('timeline/dot.gif') left 45px repeat-x;
}
#dates li {
list-style: none;
float: left;
width: 100px;
height: 50px;
font-size: 24px;
text-align: center;
background: url('timeline/biggerdot.png') center bottom no-repeat;
}
#dates a {
line-height: 18px;
padding-bottom: 10px;
}
#dates .selected {
font-size: 18px;
}
#issues {
width: 800px;
height: 500px;
overflow: hidden;
}
#issues li {
width: 900px;
height: 500px;
list-style: none;
float: left;
}
#issues li.selected img {
-webkit-transform: scale(1.1,1.1);
-moz-transform: scale(1.1,1.1);
-o-transform: scale(1.1,1.1);
-ms-transform: scale(1.1,1.1);
transform: scale(1.1,1.1);
}
#issues li img {
float: left;
margin: 10px 30px 10px 50px;
background: transparent;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)"; /* IE 8 */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);/* IE 6 & 7 */
zoom: 1;
-webkit-transition: all 2s ease-in-out;
-moz-transition: all 2s ease-in-out;
-o-transition: all 2s ease-in-out;
-ms-transition: all 2s ease-in-out;
transition: all 2s ease-in-out;
-webkit-transform: scale(0.7,0.7);
-moz-transform: scale(0.7,0.7);
-o-transform: scale(0.7,0.7);
-ms-transform: scale(0.7,0.7);
transform: scale(0.7,0.7);
}
#issues li h1 {
font-size: 48px;
margin: 20px 0;
color: red;
/*text-shadow: #000 1px 1px 2px;*/
}
#issues li p {
font-size: 14px;
margin-right: 70px;
font-weight: normal;
line-height: 22px;
/* text-shadow: #000 1px 1px 2px;*/
}
#grad_left,
#grad_right {
width: 100px;
height: 500px;
position: absolute;
top: 0;
}
#grad_left {
left: 0;
/* background: url('timeline/grad_left.png') repeat-y;*/
}
#grad_right {
right: 0;
/* background: url('timeline/grad_right.png') repeat-y;*/
}
#next,
#prev {
position: absolute;
top: 0;
font-size: 70px;
top: 170px;
width: 22px;
height: 38px;
background-position: 0 0;
background-repeat: no-repeat;
text-indent: -9999px;
overflow: hidden;
}
#next:hover,
#prev:hover {
background-position: 0 -76px;
}
#next {
right: 0;
background-image: url('timeline/next.png');
}
#prev {
left: 0;
background-image: url('timeline/prev.png');
}
#next.disabled,
#prev.disabled {
opacity: 0.2;
}

157
milfs/css/styletimeline.css Normal file
View File

@ -0,0 +1,157 @@
/*
h1,h2,h4,h5,h6 {
text-align: center;
color: #ccc;
margin-bottom: 5px;
}
h1 {
font-size: 18px;
}
h2 {
font-size: 14px;
}
.sociales {
text-align: center;
margin-bottom: 20px;
}
*/
#timeline {
width: 95%;
height: 500px;
overflow: auto;
margin: 100px auto;
position: relative;
}
#dates {
width: 100%;
height: 60px;
overflow: hidden;
background: url('timeline/dot.gif') left 45px repeat-x;
}
#dates li {
list-style: none;
float: left;
width: 100px;
height: 50px;
font-size: 24px;
text-align: center;
background: url('timeline/biggerdot.png') center bottom no-repeat;
}
#dates a {
line-height: 10px !important;
font-size: 14px !important;
padding-bottom: 10px;
color: gray !important;
text-decoration: none;
-webkit-transition: 0.5s;
-moz-transition: 0.5s;
-o-transition: 0.5s;
-ms-transition: 0.5s;
transition: 0.5s;
}
#dates a:hover,
#dates a.selected {
color: black !important;
}
#dates .selected {
font-size: 18px !important;
}
#issues {
width: 100%;
height: 500px;*/
overflow: hidden;
}
#issues li {
width: 100%;
height: 500px;
list-style: none;
float: left;
}
#issues li.selected img {
-webkit-transform: scale(1.1,1.1);
-moz-transform: scale(1.1,1.1);
-o-transform: scale(1.1,1.1);
-ms-transform: scale(1.1,1.1);
transform: scale(1.1,1.1);
}
#issues li img {
float: left;
margin: 10px 30px 10px 50px;
background: transparent;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)"; /* IE 8 */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);/* IE 6 & 7 */
zoom: 1;
-webkit-transition: all 2s ease-in-out;
-moz-transition: all 2s ease-in-out;
-o-transition: all 2s ease-in-out;
-ms-transition: all 2s ease-in-out;
transition: all 2s ease-in-out;
-webkit-transform: scale(0.7,0.7);
-moz-transform: scale(0.7,0.7);
-o-transform: scale(0.7,0.7);
-ms-transform: scale(0.7,0.7);
transform: scale(0.7,0.7);
}
#issues li h1 {
color: red;
font-size: 60px !important;
margin: 20px 0;
//text-shadow: #000 1px 1px 2px;
}
#issues li p {
font-size: 14px;
margin-right: 70px;
font-weight: normal;
line-height: 22px;
//text-shadow: #000 1px 1px 2px;
}
#grad_left,
#grad_right {
width: 100px;
height: 500px;
position: absolute;
top: 0;
}
#grad_left {
left: 0;
/* background: url('timeline/grad_left.png') repeat-y;*/
}
#grad_right {
right: 0;
/* background: url('timeline/grad_right.png') repeat-y; */
}
#next,
#prev {
position: absolute;
top: 0;
font-size: 70px;
top: 170px;
width: 22px;
height: 38px;
background-position: 0 0;
background-repeat: no-repeat;
text-indent: -9999px;
overflow: hidden;
}
#next:hover,
#prev:hover {
background-position: 0 -76px;
}
#next {
right: 0;
background-image: url('timeline/next.png');
}
#prev {
left: 0;
background-image: url('timeline/prev.png');
}
#next.disabled,
#prev.disabled {
opacity: 0.2;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
milfs/css/timeline/dot.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 981 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 981 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

BIN
milfs/css/timeline/next.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
milfs/css/timeline/prev.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

3648
milfs/funciones.php Executable file

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ function json($datos){
$datos = mysql_seguridad($datos);
$link=Conectarse();
if($datos[id] !=''){
$consulta = "SELECT form_datos.id as id_dato, form_datos.form_id AS id_formulario, nombre as formulario, campo_nombre, contenido ,timestamp, control as identificador , form_datos.orden
$consulta = "SELECT form_datos.id as id_dato, form_datos.form_id AS id_formulario, nombre as formulario, campo_nombre, form_campos.id AS id_campo , contenido ,timestamp, control as identificador , form_datos.orden
FROM `form_datos` , `form_campos` ,form_id
WHERE form_datos.id_campo = `form_campos`.id
AND form_datos.form_id = `form_id`.id
@ -14,7 +14,7 @@ function json($datos){
ORDER BY form_datos.control ,form_datos.timestamp ";
}
elseif($datos[identificador] !=''){
$consulta = "SELECT form_datos.id as id_dato, form_datos.form_id AS id_formulario, nombre as formulario, campo_nombre, contenido ,timestamp, control as identificador , form_datos.orden
$consulta = "SELECT form_datos.id as id_dato, form_datos.form_id AS id_formulario, nombre as formulario, campo_nombre, form_campos.id AS id_campo ,contenido ,timestamp, control as identificador , form_datos.orden
FROM `form_datos` , `form_campos` ,form_id
WHERE form_datos.id_campo = `form_campos`.id
AND form_datos.form_id = `form_id`.id
@ -23,7 +23,7 @@ function json($datos){
";
}
elseif($datos[dato] !=''){
$consulta = "SELECT form_datos.id as id_dato, form_datos.form_id AS id_formulario, nombre as formulario, nombre as formulario, campo_nombre, contenido ,timestamp, control as identificador, form_datos.orden
$consulta = "SELECT form_datos.id as id_dato, form_datos.form_id AS id_formulario, nombre as formulario, nombre as formulario, campo_nombre, form_campos.id AS id_campo ,contenido ,timestamp, control as identificador, form_datos.orden
FROM `form_datos` , `form_campos` ,form_id
WHERE form_datos.id_campo = `form_campos`.id
AND form_datos.form_id = `form_id`.id
@ -312,13 +312,13 @@ function imprime_geojson($id,$id2){
$link=Conectarse();
$consulta = "SELECT form_id as id, control, GROUP_CONCAT(contenido ORDER by timestamp desc ) as data
FROM `form_datos`
WHERE (form_id = '$id_form' $w_id2 )
AND ( id_campo ='$id_campo' $or_2 )
group by control
ORDER BY orden desc";
$consulta = "SELECT form_id as id, control, GROUP_CONCAT(contenido ORDER by timestamp desc ) as data
FROM `form_datos`
WHERE (form_id = '$id_form' $w_id2 )
AND ( id_campo ='$id_campo' $or_2 )
group by control
ORDER BY orden desc";
//return $consulta;
mysql_query("SET NAMES 'UTF8'");
$sql = mysql_query($consulta,$link) or die("error al ejecutar consulta ");
@ -421,10 +421,17 @@ while( $row = mysql_fetch_array( $sql ) ) {
$nombre = strtoupper("$row[nombre]");
$contenido_listado = contenido_listado("$row[id]");
if($row[nombre] =='Agenda') {
$resultado_nav .= "<li class='dropdown' >
<a href='#' onclick=\"xajax_contenido_timeline('$row[id]');\" class='dropdown-toggle' data-toggle=''> $nombre </a>
$contenido_listado
";
}else{
$resultado_nav .= "<li class='dropdown' >
<a href='#' onclick=\"xajax_contenido_parallax('$row[id]');\" class='dropdown-toggle' data-toggle=''> $nombre </a>
$contenido_listado
";
}
$resultado_nav .="</li>";
$resultado .= "<li class='list-group-item'><span class='badge alert-success'>$row[id]</span>$categoria $row[nombre] $mapa";
@ -467,25 +474,26 @@ while( $row = mysql_fetch_array( $sql ) ) {
$titulo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
$nav_li .="<li><a href='#$row[control]'>$titulo[0]</a></li>";
$contenido .= "<style type='text/css'>
a[id= '$row[control]']:target ~ #main_$row[form_id] article.article
$style .=" a[id= '$row[control]']:target ~ #main_$id article.article
{
-webkit-transform: translateY(- $orden px);
transform: translateY( - $orden px );
}
</style>
<a id='$row[control]'></a>
-webkit-transform: translateY(-$orden"."px);
transform: translateY( -$orden"."px );
} ";
$links .= " <a id='$row[control]'></a>";
$contenido .= "
$contenido_desplegado
<!-- <a href='#' onclick= \"xajax_contenido_mostrar('$row[form_id]','$row[control]','contenedor'); \">$titulo[0] </a> -->
";
$orden = $orden +600;
$orden = $orden +800;
}
$contenido = "
<style type='text/css'>
$style
.article {
width: 100%;
height: 500px;
height: 800px;
z-index:0;
-webkit-transform: translateZ( 0 );
transform: translateZ( 0 );
@ -495,12 +503,15 @@ while( $row = mysql_fetch_array( $sql ) ) {
backface-visibility: hidden;
}
</style>
<header class='nav' style='position: fixed;z-index: 10;' >
<div class='navbar navbar-default'>
<ul class='nav navbar-nav'>
$nav_li
</ul>
</div>
$links
<header class='nav' style='position: fixed;z-index: 10;' >
<nav class='navbar navbar-default'>
<ul class='nav navbar-nav'> $nav_li </ul>
</nav>
</header>
<section id='main_$id'>$contenido</section>";
}
@ -512,6 +523,65 @@ while( $row = mysql_fetch_array( $sql ) ) {
}
$xajax->registerFunction("contenido_parallax");
function contenido_timeline($id){
$div = "contenedor";
$respuesta = new xajaxResponse('utf-8');
$campo_titulo = remplacetas('parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
if($campo_titulo[0] !='') {$w_campo = "AND id_campo = '$campo_titulo[0]'";}
$campo_titulo = $campo_titulo[0];
$consulta ="SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador FROM form_datos WHERE form_id = '$id' $w_campo GROUP BY control order by contenido";
$link=Conectarse();
$sql=mysql_query($consulta,$link);
if (mysql_num_rows($sql)!='0'){
$control = mysql_result($sql,0,control);
//$contenido = "<ul class='dropdown-menu' role='menu'>";
mysql_data_seek($sql, 0);
$contenido = "
";
while( $row = mysql_fetch_array( $sql ) ) {
//$orden = $orden+500;
$identificador = explode(',',$row[identificador]);
$identificador = $identificador[0];
$contenido_desplegado = contenido_mostrar("$row[form_id]","$row[control]",'');
$titulo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
$nav_li .="<li><a href='#$row[control]'>$titulo[0]</a></li>";
$contenido .= "$contenido_desplegado ";
}
$contenido = "
<ul id='dates'>
$nav_li
</ul>
<div id='timeline'>
<ul id='issues'>
$contenido
</ul>
<div id='grad_left'></div>
<div id='grad_right'></div>
<a href='#' id='next'>+</a>
<a href='#' id='prev'>-</a>
</div>
";
}
//return " $contenido";
$respuesta->addAssign("$div","innerHTML","$contenido");
$respuesta->addscript(" $(function(){
$().timelinr({
arrowKeys: 'true'
})
});");
return $respuesta;
}
$xajax->registerFunction("contenido_timeline");
function contenido_listado($id){
$respuesta = new xajaxResponse('utf-8');
@ -905,12 +975,13 @@ $xajax->registerFunction("editar_campo");
function formulario_imprimir($id,$control,$tipo) {
include ('includes/markdown.php');
if (function_exists("Markdown")) {
//include ('includes/markdown.php');
/*if (function_exists("Markdown")) {
}else{
require_once ('milfs/includes/markdown.php');
//require_once ('milfs/includes/markdown.php');
}
*/
// include_once ('milfs/includes/markdown.php');
$id = mysql_seguridad($id);
$publico = remplacetas('form_id','id',$id,'publico') ;
@ -994,7 +1065,7 @@ if (mysql_num_rows($sql)!='0'){
// $html = convertTables($html);
// $html = simpleText($html);
$contenido = nl2br($html);
$contenido = Markdown($contenido);
//$contenido = Markdown($contenido);
}
$campo_nombre = remplacetas('form_campos','id',$row[id_campo],'campo_nombre');
$nombre[$row[id_campo]] = $campo_nombre[0] ;
@ -1080,7 +1151,7 @@ if (mysql_num_rows($sql)!='0'){
}
$resultado .="</table></div>";
}else{$resultado ="";}
}else{$resultado ="problema";}
return $resultado;
}
@ -2691,9 +2762,14 @@ $consulta ="
<input value='$value' type='email' id='".$id_campo."[".$item."]' name='".$id_campo."[".$item."]' class='form-control' placeholder='$campo_descripcion' > ";}
elseif($campo_tipo_accion == 'envio'){$render = "<code>Se enviará un correo electrónico a este email</code>
<input value='$value' type='email' id='".$id_campo."[".$item."]' name='".$id_campo."[".$item."]' class='form-control' placeholder='$campo_descripcion' > ";}
elseif($campo_tipo_accion == 'textarea'){$render = "
<textarea cols='50' data-provide=\"markdown\" rows='15' id='".$id_campo."[".$item."]' name='".$id_campo."[".$item."]' class='form-control' placeholder='$campo_descripcion' >$value</textarea> ";}
elseif($campo_tipo_accion == 'textarea'){
$render = " <textarea cols='50' data-provide=\"markdown\" rows='15' id='".$id_campo."[".$item."]' name='".$id_campo."[".$item."]' class='form-control' placeholder='$campo_descripcion' >$value</textarea> ";
}
elseif($campo_tipo_accion == 'html'){
$render = "
<textarea cols='50' rows='15' id='".$id_campo."[".$item."]' name='".$id_campo."[".$item."]' class='form-control' placeholder='$campo_descripcion' >$value</textarea> ";
}
elseif($campo_tipo_accion == 'limit'){
$limite = limite("".$id_campo."[".$item."]",'');
$rows = ceil($limite / 50 )+1;
@ -3229,7 +3305,10 @@ $respuesta->addAssign("titulo_modal","innerHTML","$cabecera");
$respuesta->addAssign("pie_modal","innerHTML","$pie");
$respuesta->addscript("$('#muestraInfo').modal('toggle')");
$respuesta->addscript("$('textarea').markdown({autofocus:false,savable:false})");
//$('textarea').markdown({autofocus:false,savable:false}
//$respuesta->addscript("$(document).ready(function () { $(\"#24[0]\").cleditor(); })");
//$(document).ready(function () { $("#input").cleditor(); });
return $respuesta;
}

1190
milfs/js/jquery.cleditor.js Normal file

File diff suppressed because it is too large Load Diff

11
milfs/js/jquery.cleditor.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,270 @@
/* ----------------------------------
jQuery Timelinr 0.9.54
tested with jQuery v1.6+
Copyright 2011, CSSLab.cl
Free under the MIT license.
http://www.opensource.org/licenses/mit-license.php
instructions: http://www.csslab.cl/2011/08/18/jquery-timelinr/
---------------------------------- */
jQuery.fn.timelinr = function(options){
// default plugin settings
settings = jQuery.extend({
orientation: 'horizontal', // value: horizontal | vertical, default to horizontal
containerDiv: '#timeline', // value: any HTML tag or #id, default to #timeline
datesDiv: '#dates', // value: any HTML tag or #id, default to #dates
datesSelectedClass: 'selected', // value: any class, default to selected
datesSpeed: 'normal', // value: integer between 100 and 1000 (recommended) or 'slow', 'normal' or 'fast'; default to normal
issuesDiv: '#issues', // value: any HTML tag or #id, default to #issues
issuesSelectedClass: 'selected', // value: any class, default to selected
issuesSpeed: 'fast', // value: integer between 100 and 1000 (recommended) or 'slow', 'normal' or 'fast'; default to fast
issuesTransparency: 0.2, // value: integer between 0 and 1 (recommended), default to 0.2
issuesTransparencySpeed: 500, // value: integer between 100 and 1000 (recommended), default to 500 (normal)
prevButton: '#prev', // value: any HTML tag or #id, default to #prev
nextButton: '#next', // value: any HTML tag or #id, default to #next
arrowKeys: 'false', // value: true | false, default to false
startAt: 1, // value: integer, default to 1 (first)
autoPlay: 'false', // value: true | false, default to false
autoPlayDirection: 'forward', // value: forward | backward, default to forward
autoPlayPause: 2000 // value: integer (1000 = 1 seg), default to 2000 (2segs)
}, options);
$(function(){
// setting variables... many of them
var howManyDates = $(settings.datesDiv+' li').length;
var howManyIssues = $(settings.issuesDiv+' li').length;
var currentDate = $(settings.datesDiv).find('a.'+settings.datesSelectedClass);
var currentIssue = $(settings.issuesDiv).find('li.'+settings.issuesSelectedClass);
var widthContainer = $(settings.containerDiv).width();
var heightContainer = $(settings.containerDiv).height();
var widthIssues = $(settings.issuesDiv).width();
var heightIssues = $(settings.issuesDiv).height();
var widthIssue = $(settings.issuesDiv+' li').width();
var heightIssue = $(settings.issuesDiv+' li').height();
var widthDates = $(settings.datesDiv).width();
var heightDates = $(settings.datesDiv).height();
var widthDate = $(settings.datesDiv+' li').width();
var heightDate = $(settings.datesDiv+' li').height();
// set positions!
if(settings.orientation == 'horizontal') {
$(settings.issuesDiv).width(widthIssue*howManyIssues);
$(settings.datesDiv).width(widthDate*howManyDates).css('marginLeft',widthContainer/2-widthDate/2);
var defaultPositionDates = parseInt($(settings.datesDiv).css('marginLeft').substring(0,$(settings.datesDiv).css('marginLeft').indexOf('px')));
} else if(settings.orientation == 'vertical') {
$(settings.issuesDiv).height(heightIssue*howManyIssues);
$(settings.datesDiv).height(heightDate*howManyDates).css('marginTop',heightContainer/2-heightDate/2);
var defaultPositionDates = parseInt($(settings.datesDiv).css('marginTop').substring(0,$(settings.datesDiv).css('marginTop').indexOf('px')));
}
$(settings.datesDiv+' a').click(function(event){
event.preventDefault();
// first vars
var whichIssue = $(this).text();
var currentIndex = $(this).parent().prevAll().length;
// moving the elements
if(settings.orientation == 'horizontal') {
$(settings.issuesDiv).animate({'marginLeft':-widthIssue*currentIndex},{queue:false, duration:settings.issuesSpeed});
} else if(settings.orientation == 'vertical') {
$(settings.issuesDiv).animate({'marginTop':-heightIssue*currentIndex},{queue:false, duration:settings.issuesSpeed});
}
$(settings.issuesDiv+' li').animate({'opacity':settings.issuesTransparency},{queue:false, duration:settings.issuesSpeed}).removeClass(settings.issuesSelectedClass).eq(currentIndex).addClass(settings.issuesSelectedClass).fadeTo(settings.issuesTransparencySpeed,1);
// prev/next buttons now disappears on first/last issue | bugfix from 0.9.51: lower than 1 issue hide the arrows | bugfixed: arrows not showing when jumping from first to last date
if(howManyDates == 1) {
$(settings.prevButton+','+settings.nextButton).fadeOut('fast');
} else if(howManyDates == 2) {
if($(settings.issuesDiv+' li:first-child').hasClass(settings.issuesSelectedClass)) {
$(settings.prevButton).fadeOut('fast');
$(settings.nextButton).fadeIn('fast');
}
else if($(settings.issuesDiv+' li:last-child').hasClass(settings.issuesSelectedClass)) {
$(settings.nextButton).fadeOut('fast');
$(settings.prevButton).fadeIn('fast');
}
} else {
if( $(settings.issuesDiv+' li:first-child').hasClass(settings.issuesSelectedClass) ) {
$(settings.nextButton).fadeIn('fast');
$(settings.prevButton).fadeOut('fast');
}
else if( $(settings.issuesDiv+' li:last-child').hasClass(settings.issuesSelectedClass) ) {
$(settings.prevButton).fadeIn('fast');
$(settings.nextButton).fadeOut('fast');
}
else {
$(settings.nextButton+','+settings.prevButton).fadeIn('slow');
}
}
// now moving the dates
$(settings.datesDiv+' a').removeClass(settings.datesSelectedClass);
$(this).addClass(settings.datesSelectedClass);
if(settings.orientation == 'horizontal') {
$(settings.datesDiv).animate({'marginLeft':defaultPositionDates-(widthDate*currentIndex)},{queue:false, duration:'settings.datesSpeed'});
} else if(settings.orientation == 'vertical') {
$(settings.datesDiv).animate({'marginTop':defaultPositionDates-(heightDate*currentIndex)},{queue:false, duration:'settings.datesSpeed'});
}
});
$(settings.nextButton).bind('click', function(event){
event.preventDefault();
// bugixed from 0.9.54: now the dates gets centered when there's too much dates.
var currentIndex = $(settings.issuesDiv).find('li.'+settings.issuesSelectedClass).index();
if(settings.orientation == 'horizontal') {
var currentPositionIssues = parseInt($(settings.issuesDiv).css('marginLeft').substring(0,$(settings.issuesDiv).css('marginLeft').indexOf('px')));
var currentIssueIndex = currentPositionIssues/widthIssue;
var currentPositionDates = parseInt($(settings.datesDiv).css('marginLeft').substring(0,$(settings.datesDiv).css('marginLeft').indexOf('px')));
var currentIssueDate = currentPositionDates-widthDate;
if(currentPositionIssues <= -(widthIssue*howManyIssues-(widthIssue))) {
$(settings.issuesDiv).stop();
$(settings.datesDiv+' li:last-child a').click();
} else {
if (!$(settings.issuesDiv).is(':animated')) {
// bugixed from 0.9.52: now the dates gets centered when there's too much dates.
$(settings.datesDiv+' li').eq(currentIndex+1).find('a').trigger('click');
}
}
} else if(settings.orientation == 'vertical') {
var currentPositionIssues = parseInt($(settings.issuesDiv).css('marginTop').substring(0,$(settings.issuesDiv).css('marginTop').indexOf('px')));
var currentIssueIndex = currentPositionIssues/heightIssue;
var currentPositionDates = parseInt($(settings.datesDiv).css('marginTop').substring(0,$(settings.datesDiv).css('marginTop').indexOf('px')));
var currentIssueDate = currentPositionDates-heightDate;
if(currentPositionIssues <= -(heightIssue*howManyIssues-(heightIssue))) {
$(settings.issuesDiv).stop();
$(settings.datesDiv+' li:last-child a').click();
} else {
if (!$(settings.issuesDiv).is(':animated')) {
// bugixed from 0.9.54: now the dates gets centered when there's too much dates.
$(settings.datesDiv+' li').eq(currentIndex+1).find('a').trigger('click');
}
}
}
// prev/next buttons now disappears on first/last issue | bugfix from 0.9.51: lower than 1 issue hide the arrows
if(howManyDates == 1) {
$(settings.prevButton+','+settings.nextButton).fadeOut('fast');
} else if(howManyDates == 2) {
if($(settings.issuesDiv+' li:first-child').hasClass(settings.issuesSelectedClass)) {
$(settings.prevButton).fadeOut('fast');
$(settings.nextButton).fadeIn('fast');
}
else if($(settings.issuesDiv+' li:last-child').hasClass(settings.issuesSelectedClass)) {
$(settings.nextButton).fadeOut('fast');
$(settings.prevButton).fadeIn('fast');
}
} else {
if( $(settings.issuesDiv+' li:first-child').hasClass(settings.issuesSelectedClass) ) {
$(settings.prevButton).fadeOut('fast');
}
else if( $(settings.issuesDiv+' li:last-child').hasClass(settings.issuesSelectedClass) ) {
$(settings.nextButton).fadeOut('fast');
}
else {
$(settings.nextButton+','+settings.prevButton).fadeIn('slow');
}
}
});
$(settings.prevButton).click(function(event){
event.preventDefault();
// bugixed from 0.9.54: now the dates gets centered when there's too much dates.
var currentIndex = $(settings.issuesDiv).find('li.'+settings.issuesSelectedClass).index();
if(settings.orientation == 'horizontal') {
var currentPositionIssues = parseInt($(settings.issuesDiv).css('marginLeft').substring(0,$(settings.issuesDiv).css('marginLeft').indexOf('px')));
var currentIssueIndex = currentPositionIssues/widthIssue;
var currentPositionDates = parseInt($(settings.datesDiv).css('marginLeft').substring(0,$(settings.datesDiv).css('marginLeft').indexOf('px')));
var currentIssueDate = currentPositionDates+widthDate;
if(currentPositionIssues >= 0) {
$(settings.issuesDiv).stop();
$(settings.datesDiv+' li:first-child a').click();
} else {
if (!$(settings.issuesDiv).is(':animated')) {
// bugixed from 0.9.54: now the dates gets centered when there's too much dates.
$(settings.datesDiv+' li').eq(currentIndex-1).find('a').trigger('click');
}
}
} else if(settings.orientation == 'vertical') {
var currentPositionIssues = parseInt($(settings.issuesDiv).css('marginTop').substring(0,$(settings.issuesDiv).css('marginTop').indexOf('px')));
var currentIssueIndex = currentPositionIssues/heightIssue;
var currentPositionDates = parseInt($(settings.datesDiv).css('marginTop').substring(0,$(settings.datesDiv).css('marginTop').indexOf('px')));
var currentIssueDate = currentPositionDates+heightDate;
if(currentPositionIssues >= 0) {
$(settings.issuesDiv).stop();
$(settings.datesDiv+' li:first-child a').click();
} else {
if (!$(settings.issuesDiv).is(':animated')) {
// bugixed from 0.9.54: now the dates gets centered when there's too much dates.
$(settings.datesDiv+' li').eq(currentIndex-1).find('a').trigger('click');
}
}
}
// prev/next buttons now disappears on first/last issue | bugfix from 0.9.51: lower than 1 issue hide the arrows
if(howManyDates == 1) {
$(settings.prevButton+','+settings.nextButton).fadeOut('fast');
} else if(howManyDates == 2) {
if($(settings.issuesDiv+' li:first-child').hasClass(settings.issuesSelectedClass)) {
$(settings.prevButton).fadeOut('fast');
$(settings.nextButton).fadeIn('fast');
}
else if($(settings.issuesDiv+' li:last-child').hasClass(settings.issuesSelectedClass)) {
$(settings.nextButton).fadeOut('fast');
$(settings.prevButton).fadeIn('fast');
}
} else {
if( $(settings.issuesDiv+' li:first-child').hasClass(settings.issuesSelectedClass) ) {
$(settings.prevButton).fadeOut('fast');
}
else if( $(settings.issuesDiv+' li:last-child').hasClass(settings.issuesSelectedClass) ) {
$(settings.nextButton).fadeOut('fast');
}
else {
$(settings.nextButton+','+settings.prevButton).fadeIn('slow');
}
}
});
// keyboard navigation, added since 0.9.1
if(settings.arrowKeys=='true') {
if(settings.orientation=='horizontal') {
$(document).keydown(function(event){
if (event.keyCode == 39) {
$(settings.nextButton).click();
}
if (event.keyCode == 37) {
$(settings.prevButton).click();
}
});
} else if(settings.orientation=='vertical') {
$(document).keydown(function(event){
if (event.keyCode == 40) {
$(settings.nextButton).click();
}
if (event.keyCode == 38) {
$(settings.prevButton).click();
}
});
}
}
// default position startAt, added since 0.9.3
$(settings.datesDiv+' li').eq(settings.startAt-1).find('a').trigger('click');
// autoPlay, added since 0.9.4
if(settings.autoPlay == 'true') {
setInterval("autoPlay()", settings.autoPlayPause);
}
});
};
// autoPlay, added since 0.9.4
function autoPlay(){
var currentDate = $(settings.datesDiv).find('a.'+settings.datesSelectedClass);
if(settings.autoPlayDirection == 'forward') {
if(currentDate.parent().is('li:last-child')) {
$(settings.datesDiv+' li:first-child').find('a').trigger('click');
} else {
currentDate.parent().next().find('a').trigger('click');
}
} else if(settings.autoPlayDirection == 'backward') {
if(currentDate.parent().is('li:first-child')) {
$(settings.datesDiv+' li:last-child').find('a').trigger('click');
} else {
currentDate.parent().prev().find('a').trigger('click');
}
}
}