- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
Battle = new Class({
// Options
selected: 1,
onPopupClose: function() {},
// Class initalisation
initialize: function(options) {
Object.append(this, options);
},
// Open popup
initPopup: function(title, selection) {
this.selected = selection;
this.popup = new LightFace.Static({
title: title,
content: 'vote-options'
});
},
// Vote
vote: function(social_network) {
var share = this.selected == 1 ? this.share1 : this.share2;
var pic = this.selected == 1 ? this.pic1 : this.pic2;
var url = '';
if(social_network == 'fb') {
url = 'http://www.facebook.com/sharer.php?s=100';
url += '&p[title]=' + encodeURIComponent(this.text);
url += '&p[summary]=' + encodeURIComponent(share);
url += '&p[url]=' + encodeURIComponent(this.url);
url += '&p[images][0]=' + encodeURIComponent(pic);
} else if(social_network == 'tw') {
url = 'http://twitter.com/share?';
url += 'text=' + encodeURIComponent(this.text);
url += '&url=' + encodeURIComponent(this.url);
url += '&counturl=' + encodeURIComponent(this.url);
} else if(social_network == 'vk') {
url = 'http://vkontakte.ru/share.php?';
url += 'url=' + encodeURIComponent(this.url);
url += '&title=' + encodeURIComponent(this.text);
url += '&description=' + encodeURIComponent(share);
url += '&image=' + encodeURIComponent(pic);
url += '&noparse=true';
} else if(social_network == 'ok') {
url = 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1';
url += '&st.comments=' + encodeURIComponent(share);
url += '&st._surl=' + encodeURIComponent(this.url);
} else if(social_network == 'ml') {
url = 'http://connect.mail.ru/share?';
url += 'url=' + encodeURIComponent(this.url);
url += '&title=' + encodeURIComponent(this.text);
url += '&description=' + encodeURIComponent(share);
url += '&imageurl=' + encodeURIComponent(pic);
}
window.open(url,'','toolbar=0,status=0,width=626,height=436');
return this.vote_ns()
},
// Vote count
vote_ns: function() {
new Request({
url: '/vote/' + this.id + '/' + this.selected
}).send();
this.popup.close();
this.onPopupClose.delay(400);
var vote_count = $('vote-num-'+this.selected);
vote_count.set('text', vote_count.get('text').toInt() + 1);
$('vote-1').destroy();
$('vote-2').destroy();
$('voted_thank_you').show();
return false
},
// Askbook Promo
promoAskbook: function() {
this.promoBox = new LightFace.Static({
width: 500,
draggable: true,
title: 'AskBook.me',
content: 'askbook_promo'
});
}
});
bildja 26.01.2012 19:35 # 0
user111 26.01.2012 20:41 # +2
istem 26.01.2012 21:09 # 0
guest 27.01.2012 00:28 # 0
guest 27.01.2012 09:27 # 0
guest 27.01.2012 13:51 # 0
guest 27.01.2012 15:35 # 0
guest8 09.04.2019 12:35 # −999