/**
thumbnailClick - onclick function
**/
var selected_art="", start_pos=0, asyncScroll=false;
var nLinhas = 3;
var nColunas= 19;
var nPages=0;
var arts_per_pg= nLinhas * nColunas;
var max_position = arts_per_pg * nPages;
$(document).ready(function (){
if($("#scroll").get(0)!= undefined){
fillScroll();
}
positionPage();
$(window).resize(function(){positionPage();});
});
function fillScroll(){
var scroll = "
");
if(nCols ==0) nCols = (nPages-1)*nColunas; //admin
if(nCols < nColunas) nCols = nColunas-1; //less than one page of arts
$("#scrollMe").css("width", ((nCols+1)*50+2) +"px");
$("#scroll").autoscroll(AUTOSCROLL_X);
}
function borderMe(child, title){ $(child).parent().append("
"); }
function removeMe(elem){ $(elem).remove();}
function swapArt(archive){
var max_position_main = 104;
var max_position_arquivo= 152;
var nPages_main =1+ Math.ceil(max_position_main/((arts_per_pg-1)*1.0));
var nPages_arquivo =1+Math.ceil(max_position_arquivo/((arts_per_pg-1)*1.0));
if(archive) { artigos=artigos_archive; nPages=nPages_arquivo+1; max_position= max_position_arquivo; }else{ artigos = artigos_main; nPages=nPages_main+1; max_position = max_position_main;}
fillScroll();
console.log(nPages);
}
function thumbnailClick(){}
/*function fScroll(e,page){
var middle= (950/2.0);
var current = $("#scrollMe").css("left") ,leftBound= (middle-100) , rightBound=(middle+100);
var deltaX = e.clientX>leftBound ? e.clientX-rightBound : leftBound - e.clientX; //incremento = distancia ao centro.
var r = e.clientX> middle ? "-" : "+";
if(e.clientX > leftBound && e.clientX < rightBound ) return;
//TO much for the right...
if(current>0 ) { $("#scrollMe").css("left",0); return; }
$("#scrollMe").animate({left:r+=deltaX}, {duration:300, queue:false});
}*/
function positionPage() {
if((document.location + "").indexOf("/admin")>0) return;
var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
myHeight=(myHeight-550)/2 > 0 ?(myHeight-550)/2 : 0 ;
myWidth =(myWidth-950)/2>0 ? (myWidth-950)/2 :0;
$(".pageBody").css("top" , myHeight+"px");
$(".pageBody").css("left", myWidth+"px");
fillScroll();
}
var AUTOSCROLL_BOTH, AUTOSCROLL_X, AUTOSCROLL_Y;
// jQuery autoscroll plugin
//
// Copyright 2010 Wilker Lucio
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
AUTOSCROLL_X = 1;
AUTOSCROLL_Y = 2;
AUTOSCROLL_BOTH = 3;
(function($) {
$.autoscroll = {};
$.autoscroll.Easemove = function Easemove() {
this.current_point = 0;
this.end_point = 0;
this.running = false;
this.speed = 0.07;
this.onmove = function onmove() { };
return this;
};
$.autoscroll.Easemove.prototype.set_end_point = function set_end_point(point) {
this.end_point = point;
if (this.running) {
return null;
}
this.running = true;
return this.move();
};
$.autoscroll.Easemove.prototype.move = function move() {
var distance, move;
distance = this.end_point - this.current_point;
move = distance * this.speed;
this.current_point += move;
this.onmove(this.current_point);
if (Math.round(this.current_point) !== this.end_point) {
return setTimeout(((function(func, obj, args) {
return function() {
return func.apply(obj, args.concat(Array.prototype.slice.call(arguments, 0)));
};
}(this.move, this, []))), 20);
} else {
this.running = false;
return this.running;
}
};
$.autoscroll.zip = function zip(callback) {
var _a, _b, _c, _d, _e, _f, i, items, line, results, x;
items = Array.prototype.slice.call(arguments, 1, arguments.length - 0);
results = [];
_b = 0; _c = items[0].length;
for (_a = 0, i = _b; (_b <= _c ? i < _c : i > _c); (_b <= _c ? i += 1 : i -= 1), _a++) {
line = [];
_e = 0; _f = items.length;
for (_d = 0, x = _e; (_e <= _f ? x < _f : x > _f); (_e <= _f ? x += 1 : x -= 1), _d++) {
line.push(items[x][i]);
}
results.push(callback.apply(this, line));
}
return results;
};
$.fn.autoscroll = function autoscroll(mode, degree_window, speed) {
var directions;
mode = mode || AUTOSCROLL_BOTH;
degree_window = degree_window || [20, 20];
speed = speed || 0.07;
directions = ['left', 'top'];
return this.each(function() {
var ava_size, container, easemove, inner_container, offset, position, real_size;
container = $(this);
inner_container = container.children(":first");
ava_size = [container.width(), container.height()];
// workaround to make possible to determine real size of content
position = inner_container.css('position');
inner_container.css('position', 'absolute');
real_size = [inner_container.width(), inner_container.height()];
// back to previous state
inner_container.css('position', position);
offset = container.offset();
offset = [offset.left, offset.top];
easemove = [];
jQuery.each(directions, function(i, v) {
var obj;
obj = new jQuery.autoscroll.Easemove();
obj.speed = speed;
obj.onmove = function onmove(position) {
//if( (document.location+"").indexOf("/admin")==-1 && v=="left"){ position -= parseInt($(".pageBody").offset().left)-15;}
/*return inner_container.css('margin-' + v, -position);*/
return inner_container.css(v,-position);
};
return easemove.push(obj);
});
return container.mousemove(function(event) {
var mouse;
mouse = [event.pageX, event.pageY];
return jQuery.autoscroll.zip((function(m, o, a, r, e, w, t) {
var d, f, real;
if (!(t & mode)) {
return null;
}
d = m - o;
d = Math.min(Math.max(d - w, 0), a - w * 2);
f = d / (a - w * 2);
real = f * (r - a);
return e.set_end_point(real);
}), mouse, offset, ava_size, real_size, easemove, degree_window, [AUTOSCROLL_X, AUTOSCROLL_Y]);
});
});
};
return $.fn.autoscroll;
})(jQuery);