BEAUTIFUL
//
function checkPost(postID, mutePosts)
{
var rootID = $(postID).readAttribute('data-root-post-id');
if (mutePosts.indexOf(rootID) != -1)
{
var postIDNum = postID.substring('like_button_'.length);
tmute(postIDNum, rootID, false);
}
else
addX(postID, rootID);
}
// ]]>//
function delMute(id, post)
{
var mutePosts = getMute();
mutePosts.splice(mutePosts.indexOf(id),1);
localStorage.setItem("tmute", mutePosts);
/*$('tunmute-' + post).up().setAttribute('class', 'post not_mine');
$('tunmute-' + post).fade();
$('tmuted-' + post).toggle();*/
$('tunmute-' + post).innerHTML = 'You sure punk?? Yes. ';
}
// ]]>//
function addMute(id)
{
var mutePosts = getMute();
mutePosts.push(id);
localStorage.setItem("tmute", mutePosts);
}
// ]]>//
function getMute()
{
var mute = localStorage.getItem("tmute");
if (mute == null)
return [];
else
{
mute = mute.split(',');
return mute;
}
}
// ]]>//
function tmute(post, id, newID)
{
hidePost = $$('a[data-root-post-id="' + id + '"]');
for (var i = 0; i < hidePost.length; i++)
{
var mutePost = hidePost[i].up().up();
//if (hidePost[i].up().up().readAttribute('class').search('same_user_as_last') == -1 && hidePost[i].up().up().next().readAttribute('class').search('same_user_as_last') > -1)
if (mutePost.readAttribute('class').search('same_user_as_last') == -1)
{
// mutePost.next().readAttribute('class').search('same_user_as_last') > -1
var nextPost = mutePost.next();
while (nextPost.readAttribute('tmute') != null)
nextPost = nextPost.next();
if (mutePost.next().readAttribute('class') == null)
nextPost = nextPost.next();
if (nextPost.readAttribute('class').search('same_user_as_last') > -1)
{
nextPost.setAttribute('class', nextPost.readAttribute('class').replace('same_user_as_last', ''));
var newPost = nextPost.readAttribute('id').substring(nextPost.readAttribute('id').search('_')+1);
var newMenu = $('user_menu_' + post);
newMenu.setAttribute('id', 'user_menu_' + newPost);
nextPost.insert(newMenu);
}
}
mutePost.setAttribute('tmute', true);
mutePost.setAttribute('class', 'notification single_notification ');
mutePost.innerHTML = '