var src = null; var prev = null; var livetime = null; var msie = false; var stopped = false; var totStopped = false; var timer = null; var pr = 0; var liking = 0; var in_progress = false; var langSelect = false; var commentBusy = false; var last_popup_menu = null; var last_popup_button = null; var scroll_next = false; var next_page = 1; var page_load = true; var loadingPage = true; var pageHasMoreContent = true; var divmore_height = 400; var last_filestorage_id = null; var mediaPlaying = false; var liveRecurse = 0; var savedTitle = ''; var followUpPageLoad = false; var window_needs_alert = true; var expanded_items = []; var page_cache = {}; // take care of tab/window reloads on channel change if(localStorage.getItem('uid') !== localUser.toString()) { localStorage.clear(); sessionStorage.clear(); localStorage.setItem('uid', localUser.toString()); } window.onstorage = function(e) { if(e.key === 'uid' && parseInt(e.newValue) !== localUser) { if(window_needs_alert) { window_needs_alert = false; alert("Your identity has changed. Page reload required!"); window.location.reload(); return; } } } $.ajaxSetup({cache: false}); $(document).ready(function() { $(document).on('click focus', '.comment-edit-form', handle_comment_form); $(document).on('click', '.conversation-settings-link', getConversationSettings); $(document).on('click', '#settings_module_ajax_submit', postConversationSettings); $(document).on('click focus', '.comment-edit-form textarea', function(e) { if(! this.autocomplete_handled) { /* autocomplete @nicknames */ $(this).editor_autocomplete(baseurl+"/acl?f=&n=1"); /* autocomplete bbcode */ $(this).bbco_autocomplete('bbcode'); this.autocomplete_handled = true; } }); $(document).on('keydown', '.comment-edit-form textarea.expanded', function (e) { if (e.ctrlKey && e.keyCode === 13) { post_comment(this.id.replace('comment-edit-text-','')); } }); // @hilmar |-> if ( typeof(window.tao) == 'undefined' ) { window.tao = {}; } if ( typeof(window.tao.zin) == 'undefined' ) { tao.zin = { syslc: '', syslcs: {}, htm: '', me: '', debug: '' }; tao.zin.axim = '
(.*?)<\/code>/gi,"[code]$1[/code]");
rep(/<\/(strong|b)>/gi,"[/b]");
rep(/<(strong|b)>/gi,"[b]");
rep(/<\/(em|i)>/gi,"[/i]");
rep(/<(em|i)>/gi,"[i]");
rep(/<\/u>/gi,"[/u]");
rep(/(.*?)<\/span>/gi,"[u]$1[/u]");
rep(//gi,"[u]");
rep(/]*>/gi,"[quote]");
rep(/<\/blockquote>/gi,"[/quote]");
rep(/
/gi,"[hr]");
rep(/
/gi,"\n");
rep(/
/gi,"\n");
rep(/
/gi,"\n");
rep(//gi,"");
rep(/<\/p>/gi,"\n");
rep(/ /gi," ");
rep(/"/gi,"\"");
rep(/</gi,"<");
rep(/>/gi,">");
rep(/&/gi,"&");
return y;
}
function b2h(s) {
var y = s;
function rep(re, str) {
y = y.replace(re,str);
}
rep(/\&/gi,"&");
rep(/\/gi,">");
rep(/\"/gi,""");
rep(/\n/gi,"
");
rep(/\[b\]/gi,"");
rep(/\[\/b\]/gi,"");
rep(/\[i\]/gi,"");
rep(/\[\/i\]/gi,"");
rep(/\[u\]/gi,"");
rep(/\[\/u\]/gi,"");
rep(/\[hr\]/gi,"
");
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"$2");
rep(/\[url\](.*?)\[\/url\]/gi,"$1");
rep(/\[img=(.*?)x(.*?)\](.*?)\[\/img\]/gi,"");
rep(/\[img\](.*?)\[\/img\]/gi,"");
rep(/\[zrl=([^\]]+)\](.*?)\[\/zrl\]/gi,"$2");
rep(/\[zrl\](.*?)\[\/zrl\]/gi,"$1");
rep(/\[zmg=(.*?)x(.*?)\](.*?)\[\/zmg\]/gi,"");
rep(/\[zmg\](.*?)\[\/zmg\]/gi,"");
rep(/\[list\](.*?)\[\/list\]/gi, '$1
');
rep(/\[list=\](.*?)\[\/list\]/gi, '$1
');
rep(/\[list=1\](.*?)\[\/list\]/gi, '$1
');
rep(/\[list=i\](.*?)\[\/list\]/gi,'$1
');
rep(/\[list=I\](.*?)\[\/list\]/gi, '$1
');
rep(/\[list=a\](.*?)\[\/list\]/gi, '$1
');
rep(/\[list=A\](.*?)\[\/list\]/gi, '$1
');
rep(/\[li\](.*?)\[\/li\]/gi, '- $1
');
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"$2");
rep(/\[size=(.*?)\](.*?)\[\/size\]/gi,"$2");
rep(/\[code\](.*?)\[\/code\]/gi,"$1
");
rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"$1
");
rep(/\[video\](.*?)\[\/video\]/gi,"$1");
rep(/\[audio\](.*?)\[\/audio\]/gi,"$1");
rep(/\[\&\;([#a-z0-9]+)\;\]/gi,'&$1;');
rep(/\<(.*?)(src|href)=\"[^hfm](.*?)\>/gi,'<$1$2="">');
return y;
}
function zid(s) {
if((! s.length) || (s.indexOf('zid=') != (-1)))
return s;
if(! zid.length)
return s;
var has_params = ((s.indexOf('?') == (-1)) ? false : true);
var achar = ((has_params) ? '&' : '?');
s = s + achar + 'f=&zid=' + zid;
return s;
}
function makeid(length) {
var result = '';
var characters = 'abcdef0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
function push_notification_request(e) {
if (!('Notification' in window)) {
alert('This browser does not support push notifications');
}
else if (Notification.permission !== 'granted') {
Notification.requestPermission(function(permission) {
if(permission === 'granted') {
$(e.target).closest('div').hide();
}
});
}
}
function push_notification(title, body, href) {
let options = {
body: body,
data: href,
icon: '/images/hz-64.png',
silent: false
}
let n = new Notification(title, options);
n.onclick = function (e) {
window.location.href = e.target.data;
}
}