discourse-legacysite-perl/site/common/templates/include_global_js.html
2024-06-17 22:24:05 +10:00

143 lines
4.8 KiB
HTML

<%~if mini_version%>
<script type="text/javascript" src="<%static_url%>/r<%mini_version%>/js/base.min.js"></script>
<%~if not slowtwitch_forum%>
<script type="text/javascript" src="<%static_url%>/r<%mini_version%>/js/main.min.js"></script>
<%~endif%>
<%~else%>
<script type="text/javascript" src="<%static_url%>/js/jquery.min.js"></script>
<script type="text/javascript" src="<%static_url%>/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="<%static_url%>/js/jquery.form.min.js"></script>
<script type="text/javascript" src="<%static_url%>/js/jquery.jcarousellite.min.js"></script>
<script type="text/javascript" src="<%static_url%>/js/jquery.autocomplete.min.js"></script>
<script type="text/javascript" src="<%static_url%>/js/core.js"></script>
<%~if not slowtwitch_forum%>
<script type="text/javascript" src="<%static_url%>/js/swiper.min.js"></script>
<script type="text/javascript" src="<%static_url%>/js/main.js"></script>
<%~endif%>
<%~endif%>
<script type="text/javascript">
$(document).ready(function() {
var loadThreadsWidget = function(url) {
if ($('.widget-threads').length > 0) {
$('.widget-threads').each(function() {
var container = $(this).find('.list');
$.ajax({
url: url + "?id=" + container.attr('data'),
success: function(html) {
container.html(html);
}
})
});
}
}
<%~if $search_widget or $poll_widget or $forum_id%>
<%~if search_widget or $forum_id%>
$('select[name=search_forum]').change(function() {
if ($(this).val().search(/do=search/) != -1) {
window.location = $(this).val();
}
});
<%~endif%>
<%~if poll_widget or $forum_id%>
/* poll */
$('form[name=forum_poll]').ajaxForm({
success: function(html) {
$('#poll').html(html);
}
});
<%~endif%>
$('.tagwidget a.cat').each(function() {
$(this).click(function() {
$(this).parent().siblings('li').removeClass('open').find('.children:visible').slideUp();
$(this).siblings('.children').slideToggle(400, function() {
if ($(this).is(':visible')) {
$(this).parent().addClass('open');
}
else {
$(this).parent().removeClass('open');
}
});
return false;
})
});
$('.children > ul > li > a').click(function() { return false; });
/* load individual widget */
$('.dynamic-widget[data]').each(function() {
var obj = this;
$.ajax({
url: "/cgi-bin/widget.cgi?id=" + $(obj).attr('data'),
success: function(html) {
$(obj).html(html).show('fast', function() {
loadThreadsWidget('/cgi-bin/threads.cgi');
$(this).find('a[rel=hottopic]').click(function() {
$(this).siblings('.tagwidget').slideToggle();
return false;
});
});
}
})
})
<%~endif%>
/* hot topic */
$('a[rel=hottopic]').each(function() {
$(this).click(function() {
$(this).siblings('.tagwidget').slideToggle();
return false;
});
});
<%if not slowtwitch_forum%>
function load_poll(url) {
$.ajax({
url: url,
success: function(html) {
$('#poll_widget').html(html).find('a').click(function() {
load_poll($(this).attr('href'));
return false;
});
$('#poll_widget form[name=forum_poll]').ajaxForm({
success: function(html) {
$('#poll').html(html).find('a').click(function() {
load_poll($(this).attr('href'));
return false;
});
}
});
}
})
}
/* load poll */
if ($('#poll_widget').length > 0) {
load_poll('<%config.db_cgi_url%>/poll.cgi?forum_id=' + $('#poll_widget').attr('data'));
}
/* load editor's threads pick */
loadThreadsWidget('<%config.db_cgi_url%>/threads.cgi')
<%~endif%>
})
</script>
<script type="text/javascript">
setTimeout(
function() {
AdvertInteractiveRegistry.forEach(
function(el){if (el.tagId === 'WallpaperAd'){el.finishViewableTimeTracking()}}
);
var wallpaper = document.getElementById('WallpaperAd');
if (wallpaper) { wallpaper.parentNode.parentNode.removeChild(wallpaper.parentNode); }
var shim = document.getElementById('WallpaperShim');
if (shim) { document.body.removeChild(shim); }
var pushdown = document.getElementById('WallpaperPushdown');
if (pushdown) { document.body.removeChild(pushdown); }
_avp.push({ tagid: 'avp_zid_106', alias: '/', type: 'wallpaper', zid: 106, pid: 0, secure: true });
AVP.load();
},
30000
);
</script>