$(function() {
var scroll = $('.switch-articles').jScrollPane({
mouseWheelSpeed: 60,
verticalDragMaxHeight : 150,
contentWidth: '0px'
});
$(document).on('click','[data-like-status="0"]',function(){
$(this).qtip({
suppress:false,
content:{
text:'The author will receive 5 rank points for your approval'
},
show:{
event: false,
ready: true
},
style: {
classes: 'qtip-clean3',
},
position: {
my: 'top center',
at: 'bottom center',
target:$(this).find('.like-me')
},
api: { beforeShow: function(event) { return false; } },
hide: {when: 'inactive', delay:2000},
});
});
$(document).on('click','[data-like-status]',function(e){
e.preventDefault();
var that = this;
$(this).find('.tick-me').html('
');
$.ajax({
url:$(this).attr('href'),
type:'POST',
dataType: 'JSON',
context: this,
success: function(json){
var decoded = $('
').html('✓').text();
$('.tick-me').html(decoded);
if (json.stat){
if ($(this).attr('data-like-status') == 1){
$('[data-like-status]').attr('data-like-status',0).attr('title','Click to like this article')
$('.like-count').html(parseInt($('.like-count').html())-1)
$('.like-me').removeClass('light-up');
}else if($(this).attr('data-like-status') == 0){
$('[data-like-status]').attr('data-like-status',1).attr('title','Click to unlike this article')
$('.like-count').html(parseInt($('.like-count').html())+1)
$('.like-me').addClass('light-up');
}
}
}
});
});
$.each($('.left-main img[title], .left-main [data-expand]'), function(index, val) {
var source = val.src;
if(source.indexOf('legacy/1')!= -1){
var flt = 'float:right;margin-left:10px;';
}else if(source.indexOf('legacy/2')!= -1){
var flt = 'float:left;margin-right:10px;';
}else{
if ($(this).attr('style')){
var input = $(this).attr('style');
}else{
var input = '';
}
// console.log($(this).attr('style'));
var result = {};
var attributes = input.split(';');
for(var i=0; i';
}else{
var title = '';
}
if ($(this).attr('data-expand')){
anchor1 = '';
anchor2 = '';
mousePointer = 'cursor:pointer;';
}else{
anchor1 ='';
anchor2 ='';
mousePointer = '';
}
if ($(this).attr('data-expand')){
var h_w = 'width:200px;height:200px;';
var resize = '';
}else{
var h_w = '';
var resize = '';
}
$(this).wrap('');
$(this).parent().html(''+anchor1+' '+resize+anchor2+' |
'+title+'');
});
$(".fancybox").fancybox();
$('.info-bar, .article-info, .js-expand').hover(function(){
$('.summary').css('color','#1485CC');
$('.info-expander2').css('border-color','#ddd transparent transparent transparent');
},function(){
$('.summary').css('color','#000');
$('.info-expander2').css('border-color','#CCC transparent transparent transparent');
});
var originalHeight = $('.article-info').css('height');
$('.article-info').toggle(function(event){
$('.article-info').animate({'height':'397px'});
$('.js-expand').addClass('expander-active');
},function(event){
var tar = event.target.className;
if(tar == 'info-bar'||tar == 'summary'||tar.indexOf("js-expand")>-1||tar == 'article-info'){
$('.article-info').animate({'height':originalHeight});
$('.js-expand').removeClass('expander-active');
}
});
$(document).ready(function(){
$('.platformLabelJS').qtip({
position: {
at: 'right center',
my: 'left center'
},
show: {
delay: 0
},
style: {
classes: 'qtip-dark',
tip: {
corner: true,
width:20,
height:10
}
}
});
});
});