//jquery
var orient = '';
var link_to_php_folder = 'http://www.animalslebanon.org/php/';
function checkW() {
if ($(window).width() > 1022) {
if (orient != 'v') {
$('#feed').removeClass('horizontal');
//https://graph.facebook.com/v2.3/54514164921/feed?access_token=12334132138|yieWda4Bi1e-2uuT4yFG9ney1fQ
//https://www.facebook.com/feeds/page.php?format=rss20&id=54514164921
$(function() { $('#feed').feedget({ feed: 'https://graph.facebook.com/v2.3/54514164921/feed?access_token=12334132138|yieWda4Bi1e-2uuT4yFG9ney1fQ', direction: 'vertical', entries: 4, images: true, buttons: false, facebook: false, twitter:false, reverse: false, loadingImg: 'http://img.animalslebanon.org/loading.gif', showHeader: false });});
}
orient = 'v';
} else {
if (orient != 'h') {
$('#feed').removeClass('vertical');
$(function() { $('#feed').feedget({ feed: 'https://graph.facebook.com/v2.3/54514164921/feed?access_token=12334132138|yieWda4Bi1e-2uuT4yFG9ney1fQ', direction: 'horizontal', entries: 5, images: true, buttons: false, facebook: false, twitter:false, reverse: false, loadingImg: 'http://img.animalslebanon.org/loading.gif', showHeader: false });});
}
orient = 'h';
}
}
$(window).resize(checkW);
checkW();
function dazloop(obj, obj2) {
obj.delay(0).css({left:'0%'});
leny = obj.find('.tk').children().length;
for (i = 1; i < leny; i++){
if (i == leny - 1) {func = function () { dazloop( obj, obj2); } } else {func = null }
obj.delay(3000).animate({left:(-100 * i) + '%'}, 1000, func);
}
icount = 0;
obj2.dequeue();
obj2.first().fadeIn(500).delay(3000).fadeOut(500);
obj2.each(function () {
if (icount > 0 ) {
$(this).delay(4000 * icount).fadeIn(500).delay(3000).fadeOut(500);
}
icount++;
});
}
$(window).ready(function() {
/*
var tester = $('.lgg');
tester.find('.tk:first-child').clone().appendTo(tester);
icount = 0;
tester.find('.tk').each(function () {
$(this).css({left:(icount * 100) + '%'});
icount++;
});
var caps = $($(this).children('.home_caption'));
setTimeout(function () {dazloop(tester, caps); }, 2000);
*/
$('#butto').on('click', function() {
var url = link_to_php_folder + "forms.php";
$.ajax({
type: "POST", url: url,
data: $("#newsletter").serialize(),
success: function(data) {
$('#newsletter').hide();
$('#done').show();
}
});
});
});
//
(function( $, undefined ){
$.fn.feedget = function( params ) {
// Private plugin functions
//
// Decode string
//
var decodeEntities = (function() {
// this prevents any overhead from creating the object each time
var element = document.createElement('div');
function decodeHTMLEntities (str) {
if(str && typeof str === 'string') {
// strip script/html tags
str = str.replace(/')
.appendTo(socialEl);
}
}
}
});
// All the entries are done, add the body container to the overall container
container.append(bodyContainer);
// Add buttons
if (jquipresent && params.buttons && params.showHeader) {
if (params.direction == 'vertical') {
var divUp = $('
')
.addClass(containerId + ' up arrow')
.attr('data-direction', 'up')
.button({
disabled: true,
text: false,
icons: {
primary: "ui-icon-carat-1-n"
}
});
var divDown = $('
')
.addClass(containerId + ' down arrow')
.attr('data-direction', 'down')
.button({
text: false,
icons: {
primary: "ui-icon-carat-1-s"
}
});
headerContainer.append(divUp).append(divDown);
}
else {
var divLeft = $('
')
.addClass(containerId + ' left arrow')
.attr('data-direction', 'left')
.button({
disabled: true,
text: false,
icons: {
primary: "ui-icon-carat-1-w"
}
});
var divRight = $('
')
.addClass(containerId + ' right arrow')
.attr('data-direction', 'right')
.button({
text: false,
icons: {
primary: "ui-icon-carat-1-e"
}
});
headerContainer.append(divLeft).append(divRight);
}
}
// Define inner container width and height based on "direction" parameter
if (params.direction == 'horizontal') {
// Get total width for all the elements
var totalWidth = entryCount * container.find('.feedget-element').outerWidth(true);
elementsContainer.width(totalWidth);
var elementOverflow = container.find('.feedget-element').outerHeight(true) - container.find('.feedget-element').height();
if (params.showHeader) {
var innerContainerHeight = container.innerHeight() - headerContainer.outerHeight(true);
} else {
var innerContainerHeight = container.innerHeight();
}
if (totalWidth < container.width()) {
totalWidth = container.width();
}
var overflowTop = parseInt(elementsContainer.css('padding-top'));
var overflowBottom = parseInt(elementsContainer.css('padding-top'));
bodyContainer.height(parseInt(
innerContainerHeight -
(2 * parseFloat(bodyContainer.css('borderTopWidth')))));
if (elementsContainer.width() > container.width()) {
elementsContainer.height(bodyContainer[0].clientHeight - overflowTop - overflowBottom);
container.find('.feedget-element').height(bodyContainer[0].clientHeight - overflowTop - overflowBottom - elementOverflow);
}
else {
// Too few elements too fill the width of the container, disable navigation buttons
if (params.buttons) {
$('#' + containerId + ' .arrow').button({ disabled: true });
}
elementsContainer.height(innerContainerHeight - overflowTop - overflowBottom);
container.find('.feedget-element').height(innerContainerHeight - overflowTop - overflowBottom - elementOverflow);
}
}
else {
var innerContainerWidth = container.width();
if (!(elementsContainer.height() > container.height())) {
// Too few elements too fill the width of the container, disable navigation buttons
if (params.buttons) {
$('#' + containerId + ' .arrow').css('opacity', '0.2');
$(document).off('click', '#' + containerId + ' .arrow');
}
}
if (params.showHeader) {
bodyContainer.height(parseInt(
container.height() - headerContainer.outerHeight(true) -
(2 * parseFloat(bodyContainer.css('borderTopWidth')))));
} else {
bodyContainer.height(parseInt(
container.height() -
(2 * parseFloat(bodyContainer.css('borderTopWidth')))));
}
}
// Load twitter buttons
if (params.twitter) {
$.getScript('http://platform.twitter.com/widgets.js', function() {
twttr.widgets.load();
});
}
// Buttons click event
$(document).on('click', '#' + containerId + ' .arrow', function(e) {
buttonClick($(this).data('direction'), container, scrollLocked);
});
// Scroll event. We have to update the current element id based on the elements that are visible on the body container
$('#' + containerId + ' .feedget-body-container').scroll(function(e) {
if (!scrollLocked) {
var bc = $(this);
var elContainer = bc.find('.feedget-elements-container');
// Determine which elements are visible on the body container
var els = $('#' + containerId + ' .feedget-element').filter(function (index) {
if (params.direction == 'vertical') {
return $(this).offset().top >= bc.offset().top &&
$(this).offset().top <= bc.offset().top + bc.height();
}
else {
return $(this).offset().left >= bc.offset().left &&
$(this).offset().left <= bc.offset().left + bc.width();
}
});
// Get the first element that is visible in the body container
if (els.length) {
var firstEl = $(els).first();
var currId = firstEl.data('element-id');
$('#' + containerId + ' .feedget-elements-container').attr('data-current-element-id', currId);
}
// Detect if scroll edges were reached
detectScrollEdges(container);
}
});
});
}, "jsonp");
//
// Event Binding
//
/*
$(document).on('mouseenter', '.feedget-element', function(e) {
$(this).siblings().each(function() {
$(this).stop();
$(this).animate({
opacity: 0.2
}, 200, function() {
// Animation complete.
});
});
});
$(document).on('mouseleave', '.feedget-element', function(e) {
$(this).siblings().each(function() {
$(this).stop();
$(this).animate({
opacity: 1
}, 200, function() {
// Animation complete.
});
});
});
*/
return this;
};
})( jQuery );