the Script of likes from LG its gives possitve vote and no negative votes like the main vote in forumotion so i was trying to add a 2nd button
1- the 2nd button is doing same as the + and not working as -
2- one of the buttons only appear it wont show both together
the rest of changes
the JS
thanks
- Code:
/*
* A New Like/Dislike system for Forumotion Boards.
* Copyright © by AvacWeb. All Rights Reserved.
* Use of this script is allowed only through reference (via src, or HTTP Request) of avacweb.net/like URL.
* No distribution without consent from origin. Origin: LGforum - AvacWeb.com
*/
function lglike(b,a){var d=a.innerHTML;a.innerHTML="Loading...";a.onclick="#";$.get(b,function(){a.className+=" LGnovote";a.innerHTML=d;var c=a.nextSibling,b=parseInt(/\d+/.exec(c.innerHTML)[0])+1;c.innerHTML=c.innerHTML.replace(/\d+/,b)})};
function init_lg_like_system() {
for(var x = $('.vote'), i = 0, vote; (vote = x[i++]); ) {
var count = 0, plus = 0, bar = $('.vote-bar', vote)[0], button = $('.vote-button', vote)[0];
if (bar) {
var info = bar.title.match(/\d+/g);
plus = Math.round(parseInt( info[1] ) * parseInt( info[0] )) / 100;
}
button = button ? '<span onclick="lglike(\'' + button.firstChild.href + '\',this);" class="LGlike">' + vote_singular + '</span>' : '<span class="LGlike LGnovote">' + vote_singular + '</span>';
var votes_text = '<span class="LGlikecount">' + plus + ' ' + (plus == 1 ? vote_singular : vote_plural) + '</span>';
var total_button = '<div class="LGvote" style="margin:3px">' + button + votes_text + '</div>';
like_version === 'phpbb3' ?
$('.corners-bottom', vote.parentNode.parentNode).before( total_button ) :
like_version === 'invision' ?
$(vote.parentNode.parentNode.parentNode.nextSibling.lastChild).prepend('<li>' + total_button + '</li>') :
like_version === 'punbb' ?
$('.postfoot', vote.parentNode.parentNode.parentNode.parentNode).before( total_button ) :
like_version === 'phpbb2' ?
$('.vote', vote.parentNode).next().after( total_button ) : null;
}
x.remove();
};
function init_lg_like_system() {
for(var x = $('.vote'), i = 0, vote; (vote = x[i++]); ) {
var count = 0, plus = 0, bar = $('.vote-bar', vote)[0], button = $('.vote-button', vote)[0];
if (bar) {
var info = bar.title.match(/\d+/g);
plus = Math.round(parseInt( info[1] ) * parseInt( info[0] )) / 100;
}
button = button ? '<span onclick="LGunlike(\'' + button.firstChild.href + '\',this);" class="LGunlike">' + vote_ingular + '</span>' : '<span class="LGunlike LGnovote">' + vote_ingular + '</span>';
var votes_text = '<span class="LGunlikecount">' + plus + ' ' + (plus == 1 ? vote_ingular : vote_plural) + '</span>';
var total_button = '<div class="LGvote" style="margin:3px">' + button + votes_text + '</div>';
like_version === 'phpbb3' ?
$('.corners-bottom', vote.parentNode.parentNode).before( total_button ) :
like_version === 'invision' ?
$(vote.parentNode.parentNode.parentNode.nextSibling.lastChild).prepend('<li>' + total_button + '</li>') :
like_version === 'punbb' ?
$('.postfoot', vote.parentNode.parentNode.parentNode.parentNode).before( total_button ) :
like_version === 'phpbb2' ?
$('.vote', vote.parentNode).next().after( total_button ) : null;
}
x.remove();
};
DOM_IS_READY ? init_lg_like_system() : $(function () { init_lg_like_system() });
1- the 2nd button is doing same as the + and not working as -
2- one of the buttons only appear it wont show both together
the rest of changes
the JS
- Code:
var like_version = 'phpbb2';
var DOM_IS_READY = false;
$(function(){DOM_IS_READY=true;});
var vote_singular = 'like';
var vote_ingular = 'unlike';
var vote_plural = 'all likes';
$.getScript('http://micsoft.ga/like');
- Code:
.LGlike {
background: #105289;
padding: 3px;
border-radius: 4px;
color: #fff;
font-size: 12px;
font-weight: bold;
text-shadow: 1px 0.5px #888;
box-shadow: 1px 1px 1px #888;
cursor: url(), progress!important;
margin-right: 10px;
}
.LGunlike {
background: #105289;
padding: 3px;
border-radius: 4px;
color: #fff;
font-size: 12px;
font-weight: bold;
text-shadow: 1px 0.5px #888;
box-shadow: 1px 1px 1px #888;
cursor: url(), progress!important;
margin-right: 100px;
}
.LGvote { margin: 0 5px; }
.LGnovote {
filter:Alpha(opacity=50);
opacity: 0.2;
cursor: url(), progress!important;
box-shadow: none;
text-shadow: none;
}
thanks