Files
Testing/js/whatshot.js
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

263 lines
9.4 KiB
JavaScript

function tumblr_recent(url)
{
if(typeof url == 'undefined') { url = 'https://bateworld.com/tumblr_feed_a3658vb2/cached-tumblr_whatshot.html';}
noclause=jQuery('#tumblr_video').html();
if(noclause=="no")
{
jQuery('#tumblr_video').html(' ');
jQuery('#tumblr_video').css('display', 'none');
}
else
{
jQuery.ajax({
url: url,
type: 'GET',
data:{},
async: true,
cache: false,
success: function(data) {
//called when successful
// whtumblr = '';
// whtumblr=whtumblr + '<div class="header">Bateworld on tumblr</div>';
// whtumblr=whtumblr + '<div class="wh-pad">';
// whtumblr=whtumblr + data;
// whtumblr=whtumblr + '</div>';
jQuery('#tumblr_video').html(data);
},
error: function(resp, textStatus, errorThrown){
//alert(errorThrown);
}
});
}
}
function hotvideos(url)
{
if(typeof url == 'undefined') { url = '/js/whatshot/get_member_videos.php';}
noclause=jQuery('#wh_video').html();
if(noclause=="no")
{
jQuery('#wh_video').html('&nbsp;');
jQuery('#wh_video').css('display', 'none');
}
else
{
jQuery.ajax({
url: url,
type: 'GET',
data:{uid:userid,ubl:userblocklist},
cache: false,
async: true,
success: function(data) {
//called when successful
var whvid = '';
whvid=whvid + '<div class="header">Videos</div>';
whvid=whvid + '<div class="wh-pad">';
whvid=whvid+'<a class="jackbox" href="'+data.thevid+'.mp4" style="" data-group="whv" data-autoplay="true" data-title="'+data.vun+'" data-description="#whvid_desc"><div class="jackbox-hover jackbox-hover-black jackbox-hover-play"></div><img src="'+data.thevid+'_thumb.jpg" style="width:100%;height:auto;min-width:180px;" width="180" height="180" /></a><div id="whvid_desc" style="display:none;"></div>';
whvid=whvid+ '<h3><a href="/video.php?user='+data.vun+'&video_id='+data.vid+'" target="_blank" style="">'+data.vtitle+'</a></h3>';
//whvid = whvid + '<div class="star-rating" style="padding-top:3px;"><span class="stars"></span></div>';
whvid=whvid + '<div class="wh-attribution"><a href="'+data.profile+'" target="_blank">'+data.vun+'</a></div>';
whvid=whvid+'</div>';
jQuery('#wh_video').html(whvid);
// dostars(data.vsr);
},
error: function(resp, textStatus, errorThrown){
//alert(resp);
}
});
}
}
function hotimages(url)
{
if(typeof url == 'undefined') { url = '/js/whatshot/get_member_images.php';}
noclause=jQuery('#wh_image').html();
if(noclause=="no")
{
jQuery('#wh_image').html('&nbsp;');
jQuery('#wh_image').css('display', 'none');
}
else
{
jQuery.ajax({
url: url,
type: 'GET',
data:{uid:userid,ubl:userblocklist},
cache: true,
async: true,
success: function(data) {
//called when successful
whimg='';
whimg=whimg + '<div class="header">Photos</div>';
whimg=whimg + '<div class="wh-pad">';
whimg= whimg + '<a class="jackbox" href="'+data.imagepath+'" style="" data-group="whi" data-autoplay="true" data-title="'+data.pun+'" data-description="#whvid_desc"><div class="jackbox-hover jackbox-hover-black jackbox-hover-magnify"></div><img src="'+data.imagepath+'" width="180" height="180" style="width:100%;height:auto;" /></a><div id="whvid_desc" style="display:none;"></div>';
whimg = whimg + '<h3><a href="'+data.profile+'" target="_blank">'+data.atitle+'</a></h3>';
whimg = whimg + '<div class="wh-attribution"><a href="/profile.php?user='+data.pun+'" target="_blank">'+data.pun+'</a></div>';
whimg = whimg + '</div>';
//whimg = whimg + '<div style="font-size:10px;"><span style="padding-right:5px;">Comments: '+data.pc+'</span></div>';
jQuery('#wh_image').html(whimg);
},
error: function(resp, textStatus, errorThrown){
//alert(resp);
}
});
}
}
function hotblogs(url)
{
if(typeof url == 'undefined') { url = '/js/whatshot/get_member_blogs.php';}
noclause=jQuery('#wh_blog').html();
if(noclause=="no")
{
jQuery('#wh_blog').html('&nbsp;');
jQuery('#wh_blog').css('display', 'none');
}
else
{
jQuery.ajax({
url: url,
type: 'GET',
data:{uid:userid,ubl:userblocklist},
cache: true,
async: true,
success: function(data) {
bsdesc=data.bdesc;
bsdesc='<p class="wh-excerpt">'+bsdesc+'</p>';
buimg=data.uimg;
whblog='';
whblog=whblog + '<div class="header">Blogs</div>';
whblog=whblog + '<div class="wh-pad">';
whblog=whblog + '<a class="jackbox" href="'+buimg+'" style="margin-left:0px;" data-group="whb" data-autoplay="false" data-title="'+data.uname+'" data-description=""><div class="jackbox-hover jackbox-hover-black jackbox-hover-play"></div><img src="'+buimg+'" style="width:100%;height:auto;float:left;" height="180" width="180"/></a>';
whblog = whblog + '<h3><a href="/blog.php?user='+data.uname+'&blogentry_id='+data.bid+'" target="_blank">'+data.btitle+'</a></h3>';
// whblog = whblog + '<p class="wh-excerpt">'+bsdesc+'</p>';
whblog = whblog + '<div class="wh-attribution"><a href="/profile.php?user='+data.uname+'" target="_blank">'+data.uname+'</a></div>';
whblog = whblog + '</div>';
//whblog = whblog + '<div style=""><span style="padding-right:5px;">Views: '+data.bviews+'</span><span>Comments: '+data.bcom+'</span></div>';
jQuery('#wh_blog').html(whblog);
},
error: function(resp, textStatus, errorThrown){
//alert(errorThrown);
}
});
}
}
function hotpolls(url)
{
if(typeof url == 'undefined') { url = '/js/whatshot/get_member_polls.php';}
noclause=jQuery('#wh_poll').html();
if(noclause=="no")
{
jQuery('#wh_poll').html('&nbsp;');
jQuery('#wh_poll').css('display', 'none');
}
else
{
jQuery.ajax({
url: url,
type: 'GET',
data:{uid:userid,ubl:userblocklist},
cache: true,
async: true,
success: function(data) {
ptitle='<h3><a href="/poll.php?user='+data.puser+'&poll_id='+data.pid+'" target="_blank">'+data.ptitle+'</a></h3>';
pdesc='<p>'+data.pdesc+'</p>';
whpoll=ptitle+pdesc;
percentage = Math.round((data.ma / data.tv) * 100);
whpoll = whpoll + '<div>Most Popular Answer: '+data.maq+' '+percentage+'% - Votes '+data.ma+'</div>';
whpoll='';
whpoll=whpoll + '<div class="header">Polls</div>';
whpoll=whpoll + '<div class="wh-pad">';
whpoll=whpoll + '<h3 style="padding-bottom:5px;"><a href="/poll.php?user='+data.puser+'&poll_id='+data.pid+'" target="_blank">'+data.ptitle+'</a></h3>'
whpoll=whpoll+ '<p>'+data.pdesc+'</p>';
whpoll=whpoll + '<div style="font-weight:bold;">Top Answer ('+percentage+'%)</div>';
whpoll = whpoll + '<div style="font-style:italic;">'+data.maq+'</div>';
whpoll=whpoll + '</div>';
jQuery('#wh_poll').html(whpoll);
},
error: function(resp, textStatus, errorThrown){
//alert(resp);
}
});
}
}
function hotgroups(url)
{
if(typeof url == 'undefined') { url = '/js/whatshot/get_member_groups.php';}
noclause=jQuery('#wh_group').html();
if(noclause=="no")
{
jQuery('#wh_group').html('&nbsp;');
jQuery('#wh_group').css('display', 'none');
}
else
{
jQuery.ajax({
url: url,
type: 'GET',
data:{},
async: true,
cache: true,
success: function(data) {
gtitle='<h3 style="padding-bottom:5px;"><a href="/group.php?group_id='+data.gid+'" target="_blank">'+data.gtitle+'</a></h3>';
gdesc='<a class="jackbox" href="'+data.gimg+'" style="margin-left:0px;" data-group="whg" data-autoplay="false" data-title="'+data.gtitle+'" data-description=""><div class="jackbox-hover jackbox-hover-black jackbox-hover-play"></div><img src="'+data.gimg+'" style="float:left;width:100%;height:auto;" /></a>';
whgroup=gtitle+gdesc+'<p class="wh-excerpt">'+data.gdesc+'</p>';
whgroup = '';
whgroup = whgroup + '<div class="header">Groups</div>';
whgroup = whgroup + '<div class="wh-pad">';
whgroup = whgroup + '<a class="jackbox" href="'+data.gimg+'" style="margin-left:0px;" data-group="whg" data-autoplay="false" data-title="'+data.gtitle+'" data-description=""><div class="jackbox-hover jackbox-hover-black jackbox-hover-play"></div><img src="'+data.gimg+'" style="float:left;width:100%;height:auto;" height="180" width="180" /></a>';
whgroup = whgroup + '<h3 style="padding-bottom:4px;"><a href="/group.php?group_id='+data.gid+'" target="_blank">'+data.gtitle+'</a></h3>';
whgroup = whgroup + '<p class="wh-excerpt">'+data.gdesc+'</p>';
whgroup = whgroup + '</div>';
jQuery('#wh_group').html(whgroup);
},
error: function(resp, textStatus, errorThrown){
//alert(resp);
}
});
}
}
jQuery.fn.stars = function(rating) {
return jQuery(this).each(function() {
// Get the value
var val = parseFloat(rating);
//val = Math.round(val * 4) / 4; /* To round to nearest quarter */
//val = Math.round(val * 2) / 2; /* To round to nearest half */
// Make sure that the value is in 0 - 5 range, multiply to get width
var size = Math.max(0, (Math.min(5, val))) * 16;
// Create stars holder
var $span = jQuery('<span />').width(size);
// Replace the numerical value with stars
jQuery(this).html($span);
});
}
function dostars(val) {
jQuery('span.stars').stars(val);
}