$(document).ready(function() {
// Get each div
var url = window.location.search;
if (url == '?tid=2137&pid=24269') {
$('.post_body:eq( 0 )').each(function() {
// Get the content
var str = $(this).html();
// Set the regex string
var regex = /(https?:\/\/([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?)/ig
// Replace plain text links by hyperlinks
var replaced_text = str.replace(regex, "<a href='$1' target='_blank'>$1</a>");
// Echo link
$(this).html(replaced_text);
});
}
});
$(function() {
/* ~~ Enable and configure plugin for new titles ~~ */
$('a').tipsy({
fade: true,
gravity: 'n',
html: true,
delayOut: 250
});
$('i').tipsy({
fade: true,
gravity: 'n'
});
$('span').tipsy({
fade: true,
gravity: 's'
});
$('label').tipsy({
fade: true,
gravity: 's'
});
/* ~~ Choose your own background ~~ */
if ($.cookie('background')) {
$("body").css("backgroundImage", "url(" + "images/" + $.cookie("background") + ".jpg)");
};
$(".bg_style").click(function() {
$(".bg_preview").slideToggle('fast');
return false;
});
$(".bg_preview a").click(function() {
var bg_id = $(this).attr("id");
$("body").css("backgroundImage", "url(" + "images/" + bg_id + ".jpg)");
$.cookie('background', bg_id, {
expires: 365,
path: '/'
});
});
/* ~~ Image MyCode - made for shoutbox, however, it works anywhere else as well ~~ */
$("body").on("click", ".img-spoiler", function() {
$(this).children("img").toggle(250);
});
/* ~~ Tabs in members' profiles ~~ */
$('.tab-container .tab').click(function() {
var tabVal = $(this).attr('value');
var panel = $('.panel' + ' #' + tabVal);
var tabContent = $('.tab-content' + '#' + tabVal);
if (tabContent.is(':hidden')) {
tabContent.slideDown('200');
} else {
tabContent.slideUp('200');
}
});
/* ~~ Show modal with emoticons (the one in shoutbox) ~~*/
$('.show-modalEx').click(function(event) {
event.preventDefault();
$('.modalEx').css("display", "block");
});
$('.close-modalEx').click(function(event) {
event.preventDefault();
$('.modalEx').css("display", "none");
})
$('.smilie_dvz').click(function() {
var smilie = $(this).attr("alt"),
inputValue = $('#dvz_input').val();
$('#dvz_input').val(inputValue + smilie);
});
}); // <-- document ready end
/*
************ START *************
*** ~~ dvz_shoutbox stuff ~~ ***
********************************
*/
/* ~~ Play sound on new message ~~ */
/* ~~ Change website title on new message (just when window is inactive) ~~ */
var defaultTitle = $(document).find("title").text(),
s = 0,
sT = null;
function changeTitle() {
if (document.hasFocus()) {
document.title = defaultTitle;
} else {
s++;
if (s > 2) {
s = 1;
}
if (s == 1) {
document.title = 'Nowa wiadomość w SB';
}
if (s == 2) {
document.title = defaultTitle;
}
sT = setTimeout("changeTitle()", 2500);
}
}
$(function() {
var url = window.location.pathname;
if (url == '/forum/index.php') {
if ($.cookie('dvz_play') == 1) {
$("input#sound_dvz").prop("checked", true);
}
$(document).on('change', '#sound_dvz', function() {
if ($('#sound_dvz').is(':checked')) {
$.cookie('dvz_play', '1', {
expires: 365,
path: '/'
});
} else {
$.cookie('dvz_play', '0', {
expires: 365,
path: '/'
});
}
});
if ($.cookie('dvz_play') == 1) {
dvz_shoutbox.callbacks['update'].push(function() {
if ($('#shoutbox .entry.new').length) {
var audio = new Audio(rootpath + '/images/dvz_shoutbox.mp3');
audio.volume = 0.2;
audio.play();
}
});
}
//Check if window is inactive. If so, change the title
$(window).blur(function() {
dvz_shoutbox.callbacks['update'].push(function() {
if ($('#shoutbox .entry.new').length) {
changeTitle();
}
});
});
}
});
/* ~~ Open Shoutbox' panel ~~ */
$('#tog_shoutbox_panel').click(function() {
var sbPanel = $('#shoutbox_panel');
if (sbPanel.css('display') == 'none') {
sbPanel.slideDown();
} else {
sbPanel.slideUp();
}
});
/*
************* END **************
*** ~~ dvz_shoutbox stuff ~~ ***
********************************
*/
/*
************ START ************
**** ~~ sidebar (aside) ~~ ****
*******************************
*/
var sidebox = $('aside'),
toggleBox = $('#toggle-aside i'),
forumBox = $("#forum-box");
function asideHidden() {
sidebox.hide();
toggleBox.toggleClass('fa-arrow-right fa-arrow-left');
forumBox.css({
width: "100%"
});
$.cookie('aside', '0', {
expires: 365,
path: '/'
});
}
function asideVisible() {
sidebox.fadeIn(250);
toggleBox.toggleClass('fa-arrow-left fa-arrow-right');
forumBox.css({
width: "75%"
});
$.removeCookie('aside', {
path: '/'
});
}
if ($.cookie('aside')) {
asideHidden();
};
$(function() {
$("#toggle-aside").click(function() {
if (sidebox.is(':hidden')) {
asideVisible();
} else {
asideHidden();
}
});
});
Kod:
<label original-title="Wymaga odświeżenia strony">
Sound:
<input type="checkbox" id="sound_dvz" name="sound">
</label>
Możesz sobie wyciągnać z tego (szukaj dvz_sound).
Po zaznaczeniu boxa musisz odświeżyć stronę, aby działało poprawnie.