Файл: system/modules/voting/vote_start_data/vote_script.js
Строк: 246
<?php
/*<script type="text/javascript">*/
var id_brand = 0;
var iterations = 0;
var total_count = new Array();
total_count[11] = 0;
total_count[12] = 0;
var social = new Array();
var texts = new Object();
texts.facebook = new Array();
texts.facebook[11] = new Object();
texts.facebook[11].summary = facebook_text_1;
texts.facebook[11].title = facebook_title_1;
texts.facebook[11].url = facebook_url_1;
texts.facebook[11].image = facebook_image_1;
texts.facebook[12] = new Object();
texts.facebook[12].summary = facebook_text_2;
texts.facebook[12].title = facebook_title_2;
texts.facebook[12].url = facebook_url_2;
texts.facebook[12].image = facebook_image_2;
texts.twitter = new Array();
texts.twitter[11] = new Object();
texts.twitter[11].title = twitter_title_1;
texts.twitter[11].url = twitter_url_1;
texts.twitter[12] = new Object();
texts.twitter[12].title = twitter_title_2;
texts.twitter[12].url = twitter_url_2;
texts.vkontakte = new Array();
texts.vkontakte[11] = new Object();
texts.vkontakte[11].summary = vkontakte_text_1;
texts.vkontakte[11].title = vkontakte_title_1;
texts.vkontakte[11].url = vkontakte_url_1;
texts.vkontakte[11].image = vkontakte_image_1;
texts.vkontakte[12] = new Object();
texts.vkontakte[12].summary = vkontakte_text_2;
texts.vkontakte[12].title = vkontakte_title_2;
texts.vkontakte[12].url = vkontakte_url_2;
texts.vkontakte[12].image = vkontakte_image_2;
function randomString(length) {
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'.split('');
if (! length) { length = Math.floor(Math.random() * chars.length); } var str = ''; for (var i = 0; i < length; i++) { str += chars[Math.floor(Math.random() * chars.length)]; } return str;
}
function voteFacebook(){
var url = "http://www.facebook.com/sharer.php?s=100&p[title]="+encodeURIComponent(texts.facebook[id_brand].title)+"&p[summary]="+encodeURIComponent(texts.facebook[id_brand].summary)+"&p[url]="+encodeURIComponent(texts.facebook[id_brand].url)+"&p[images][0]="+encodeURIComponent(texts.facebook[id_brand].image)+"&nocache-"+randomString(8);
window.open(url,'','toolbar=0,status=0,width=626,height=436');
}
function voteVkontakte(){
var url = "http://vkontakte.ru/share.php?title="+encodeURIComponent(texts.vkontakte[id_brand].title)+"&description="+encodeURIComponent(texts.vkontakte[id_brand].summary)+"&url="+encodeURIComponent(texts.vkontakte[id_brand].url)+"&image="+encodeURIComponent(texts.vkontakte[id_brand].image)+"&nocache-"+randomString(8);
window.open(url,'','toolbar=0,status=0,width=626,height=436');
}
function voteTwitter(){
var url = "http://twitter.com/share?text="+encodeURIComponent(texts.twitter[id_brand].title)+"&url="+encodeURIComponent(texts.twitter[id_brand].url)+"&counturl="+encodeURIComponent(texts.twitter[id_brand].url)+"&nocache-"+randomString(8);
window.open(url,'','toolbar=0,status=0,width=626,height=436');
}
function showSocial(){
// if(social[id_brand] !== false){
// $('#social-facebook').attr('href',social[id_brand].facebook);
// $('#social-twitter').attr('href',social[id_brand].twitter);
// $('#social-vkontakte').attr('href',social[id_brand].vkontakte);
// $('#sw').show();
// $('#lw').hide();
// }else{
$.modal.close();
// }
}
function calculateFB(idbrand){
var facebook = 'https://api.facebook.com/method/fql.query?query=select total_count from link_stat where url="' +encodeURIComponent(texts.facebook[idbrand].url) + '"&format=json&callback=?';
$.getJSON(facebook, function(data) {
upCounter([idbrand],data[0].total_count);
});
}
function calculateTwitter(idbrand){
var twitter = 'http://urls.api.twitter.com/1/urls/count.json?url=' +encodeURIComponent(texts.twitter[idbrand].url) + '&callback=?';
$.getJSON(twitter, function(data) {
upCounter([idbrand],data.count);
});
}
function calculateVkontakte(idbrand){
var vkontakte = 'http://vkontakte.ru/share.php?act=count&index='+idbrand+'&url=' +encodeURIComponent(texts.vkontakte[idbrand].url) + '&callback=?';
VK = new Object();
VK.Share = {};
VK.Share.count = function(index, count) {
upCounter([index],count);
}
$.getJSON(vkontakte, function(data) { });
}
function calculateStart(){
calculateFB(11);
calculateFB(12);
calculateTwitter(11);
calculateTwitter(12);
calculateVkontakte(11);
calculateVkontakte(12);
}
function upCounter(id,count){
total_count[id]+=count;
if(document.all){
document.getElementById('c'+id).innerText = total_count[id];
} else{
document.getElementById('c'+id).textContent = total_count[id];
}
}
var lang = {
years: ['год', 'лет'],
months: ['месяц','месяца', 'месяцев'],
days: ['дня','день', 'дней'],
hours: ['час', 'часов'],
minutes: ['минуты', 'минута', 'минут'],
seconds: ['секунды', 'секунда', 'секунд'],
plurar: function(n) {
return (n == 1 ? 0 : 1);
}
}
$(document).ready(function(){
$("#countdown").countdown(new Date(year_vote, month_vote, day_vote, hour_vote, minute_vote, seconds_vote), {suffix:'',prefix:'Осталось', finish: '',lang:lang});
// $("#mini-countdown").countdown(new Date(2011, 2, 26, 23, 59, 59), {suffix:'',prefix:'Осталось', finish: '',lang:lang});
calculateStart();
});
function showLogin(b){
id_brand = b;
$('#login-window').modal({});
$('#lw').show();
}
/*</script>*/
?>