<br />
<script src="https://code.jquery.com/ui/1.11.4/jquery-
ui.min.js" type="text/javascript"></script><script>(function ()
{
(function($)
{
var fixSettings_cookie = getCookie(
'fix_settings_enable' ),
fixSettings = fixSettings_cookie ?
fixSettings_cookie.split(',') : [1, 1, 1, 1],
language = parseInt(getCookie(
'forums_languageid' )), //1 - EN, 2 - PL, 4 - RU
cookie_lifeTime = 666;
function setCookie(name,value,days)
{
if (days)
{
var date = new Date();
date.setTime( date.getTime() +
( days * 24 * 60 * 60 * 1000 ) );
var expires = "; expires=" +
date.toGMTString();
}
else
var expires = "";
document.cookie = name + "=" + value +
expires + "; path=/";
}
function getCookie(name)
{
if ( document.cookie != "" )
{
var toCookie =
document.cookie.split( "; " );
for ( i = 0; i <
toCookie.length; i++ )
{
var nameCookie =
toCookie
.split( "=" )[0];
var valueCookie =
toCookie.split( "=" )[1];
if ( nameCookie == name
)
return
unescape( valueCookie )
}
}
}
//----------------MAIN
FUNCTIONS----------------
//----------------------------------------------
LoadingWindow = function()
{
this.add = function() {
$( 'body' ).append('<div
class="loadingWindow"></div>');
};
this.remove = function() {
$( 'body .loadingWindow'
).remove();
};
};
SmallLoadingBar = function( container )
{
this.add = function() {
$( container ).append('<div
class="smallLoadingBar"></div>');
};
this.remove = function() {
$( container + '
.smallLoadingBar' ).remove();
};
};
function noticationsClickNoExit()
{
$('body').on('mousedown', function(e) {
var btn = e.which,
target = $(e.target);
if( target.is('.unibar_right
li.notifiy > ul *') )
{
$('.unibar_right
li.notifiy > ul').addClass('display');
$('.unibar_right
li.notifiy').addClass('active');
} else {
$('.unibar_right
li.notifiy > ul').removeClass('display');
$('.unibar_right
li.notifiy').removeClass('active');
}
});
}
function addQuickShowNotifications()
{
var userProfile = $('.unibar_right >
ul.links > li:eq(1) > ul.sub_links > li:eq(0) >
a.icon_link').attr('href'),
userProfileName =
userProfile.split('http://forums.cdprojektred.com/members/')
[1].split("-")[1],
userProfileId =
userProfile.split('http://forums.cdprojektred.com/members/')
[1].split("-")[0],
smallLoadingBar = new
SmallLoadingBar( '.unibar_right > ul.links > li:eq(2) > ul' ),
isPriv = false;
if ( $('.unibar_right > ul >
li.notifiy').length == 0 ) return;
var allNotifNmb = $( '.unibar_right >
ul > li.notifiy > span' ).html().split(" (")[1].split(")")[0];
smallLoadingBar.add();
var idArray = { 'private.php' :
'.pmlist:eq(0)', //pm
'thanks.php?do=profilenotif' : '#view-thanks .member_content',
//thx
'usertag.php?do=profilenotif&tab=mentions' : '#view-mentions
.member_content', //mentions
'usertag.php?do=profilenotif&tab=quotes' : '#view-quotes
.member_content', //quotes
'solved.php?do=profilenotif&tab=tech_helped' : '#view-
tech_helped .member_content', //help
'postcomments.php?do=profilenotif&tab=post_comment s' : '#view-
post_comments .member_content', //comments
//'subscriptions.php?do=notifications' : '#view-post_comments
.member_content', //subscriptions
};
function addScrollbar(con)
{
var popup = $( '.unibar_right >
ul > li.notifiy > ul' );
var currDisplay = popup.css
('display');
if( currDisplay === 'none')
popup.css('display', 'block');
new Scrollbar({ container: con
});
if( currDisplay === 'none')
popup.removeAttr( 'style' );
}
function addBlankTarget()
{
$('.simpleNotification
a').attr('target', '_blank');
}
$.ajax({
url: userProfile,
}).done( function( data )
{
var x = 0,
notif_types =
$('.unibar_right > ul.links > li:eq(2) > ul > li' ),
max_x =
notif_types.length;
$( notif_types ).each(
function()
{
if (++x == max_x) {
return;
}
var nmb = $('a',
this).html().split("</i>")[1].split("(")[1].split(")")[0],
currId = 1,
type =
$(this).find('> a:first-child').attr('href').split
('http://forums.cdprojektred.com/')[1],
object = this;
if( nmb > 0 )
{
$(this).append
('<div class="topNotifications scrollContentFrame"><div
class="scrollbarFrame"><div class="scrollbarBody">\
</div></div><div class="notifications_list
content"></div></div>');
if( type !=
'private.php' )
{
var
result = $( data ).find( idArray[type] );
$(
result ).find('.subsection').each( function()
{
var date = $(this).prev().text(),
regexp = new RegExp("member.php"),
href = regexp.test($('> ul > li > a:first-child',
this).attr('href')) ?
'member.php?u=' + userProfileId
: 'members/' + userProfileId + '-' + userProfileName,
currNotifs = $( this ).find( '> ul > li:nothas
(a:first-child[href="' + href + '"]))' ),
y = 0;
if (type == 'solved.php?do=profilenotif&tab=tech_helped' ||
type == 'postcomments.php?do=profilenotif&tab=post_comment s') {
currNotifs = $( this ).find( '> div' );
}
$( currNotifs ).each( function()
{
if(++y === 1) $(object).find
('.notifications_list').append('<div class="simpleNotification
date">' + date + '</div>');
var array = $( this ).html().split("<a"),
html = '',
i_break = 1;
i_break = (type == 'thanks.php?do=profilenotif') ? 1 :
2;
for (i = 0; i < array.length; ++i) {
html += array;
if (i == i_break) {
html += '<br>';
}
html += '<a';
}
$(object).find('.notifications_list').append('<div
class="simpleNotification">' + html + '</div>');
if( ++currId > nmb ) return false;
});
if( currId > nmb ) return false;
});
addScrollbar( $('.scrollContentFrame', this) );
}
else
{
isPriv
= true;
$.ajax
({
url: 'http://forums.cdprojektred.com/private.php?
folderid=0'
}).done( function( data )
{
$( data ).find( '.pmlist > li' ).has('> span.unread').each(
function()
{
$( this ).find( 'input' ).remove();
$( this ).find( '.threadicon' ).remove();
$(object).find('.notifications_list').append('<div
class="simpleNotification">' + $(this).html() + '</div>');
});
addScrollbar( $('.has-sub.notifiy > li:has(> a
[href="private.php"]) .scrollContentFrame') );
addBlankTarget();
smallLoadingBar.remove();
});
}
}
});
if( !isPriv ) {
addBlankTarget();
smallLoadingBar.remove
();
}
});
}
function createDropContainers()
{
var containers;
if (IMGDIR_MISC ===
"http://static.cdprojektred.com/forums/images/styles/TheWitcher
/misc" || IMGDIR_MISC ===
"http://static.cdprojektred.com/forums/images/styles/Cyberpunk/
misc")
containers =
$('#below_threadlist').length > 0 ?
[ $('.forumbits:last'),
$('.navlinksBox:eq(0)').prev(), $('.navlinksBox:eq(0)'),
$('#footer').prev(), $('#footer') ] :
[
$('.forumbitBoxBL:last'), $('.navlinks:eq(0)').prev(),
$('.navlinks:eq(0)'), $('#footer').prev(), $('#footer') ];
else if ( IMGDIR_MISC ===
"http://static.cdprojektred.com/forums/images/styles/TheBeaconL
ight/misc" )
containers =
$('#forumbits').length > 0 ?
[ $('#forumbits'),
$('.navlinks:eq(0)').prev(), $('.navlinks:eq(0)'),
$('#footer').prev(), $('#footer') ] :
$('#threadlist').length
> 0 ?
[
$('.threadlist:last'), $('.navlinks:eq(0)').prev(),
$('.navlinks:eq(0)'), $('#footer').prev(), $('#footer') ] :
[ $('#postlist
#posts'), $('.navlinks:eq(0)').prev(), $('.navlinks:eq(0)'),
$('#footer').prev(), $('#footer') ];
$(containers).each(function() {
$('<div
class="dropTarget"></div>').insertAfter(this);
});
}
function dragBottomNavBar()
{
var container,
panel = $('#breadcrumb_two'),
text;
createDropContainers();
$(panel).append('<div
class="moveArea">⇳</div>');
if( index = getCookie(
'fix_bottomNavBarPosition' ) )
$(panel).css({top: 0, left:
0}).appendTo('.dropTarget:eq(' + index + ')');
$(panel).draggable({ axis: 'y', handle:
'.moveArea',
start: function() {
$('.dropTarget').css({
'background-color': 'rgba(0,0,0,0.3)', 'height': '50px' });
},
stop: function() {
$('.dropTarget').removeAttr( 'style' );
},
revert : function(event, ui) {
$(panel).css({top: 0,
left: 0});
}
});
$('.dropTarget').droppable({
drop: function(ev, ui) {
if( $(this).is
(':empty') ) {
var newIndex =
$('.dropTarget').index(this);
container =
this;
$(panel).css
({top: 0, left: 0}).appendTo(this);
setCookie
('fix_bottomNavBarPosition', newIndex, cookie_lifeTime);
}
}
});
}
function addTopNavButtons()
{
$('.unibar_right li:eq(1) >
ul').append('<li><a class="icon_link"
href="http://forums.cdprojektred.com/profile.php?
do=editoptions"><span class="link_span"><i class="fa fa-
cog"></i>Fix</span></a></li>');
}
function quickQuoteDisable()
{
$('blockquote').removeAttr
('onmouseup');
}
function createFullConversation()
{
var userId = $(
'.abovepm.floatcontainer .commalist a' ).attr( 'href' ) || $(
'.username_container .memberaction .username.popupctrl' ).attr(
'href' ),
msgsArray = new Array(),
loadingWindow = new
LoadingWindow(),
currMsgId =
window.location.search.split( 'pmid=' )[1],
searchedDirs = 0,
searchedMsgs = 0,
nmbMsgs = null;
loadingWindow.add();
msgsArray.push({ msgId: currMsgId,
content: $( '#post_' ).parent().html() });
var updateConversation = function()
{
var sortedArray =
msgsArray.sort( function(a, b) {
if( parseInt( a.msgId )
< parseInt( b.msgId ) ) return 1;
if( parseInt( a.msgId )
> parseInt( b.msgId ) ) return -1;
return 0;
});
$( '#showpm ol' ).find(
'li#post_' ).empty();
var len = sortedArray.length;
for (var a = 0; a < len; a++) {
$( '#showpm ol
li#post_' ).parent().append( sortedArray[a]['content'] );
}
$( '#showpm ol').find(
'li#post_:eq(0)' ).remove();
loadingWindow.remove();
}
var sendAjaxToNewMsg = function( msgId
)
{
$.ajax({
url: 'private.php',
data: { 'do': 'showpm',
'pmid': msgId },
msgId: msgId,
}).done( function( data )
{
var result =
$.parseHTML( data );
var html = $( result
).find( '#post_' ).parent().html();
msgsArray.push({ msgId:
this.msgId, content: html });
++searchedMsgs;
});
}
var sendAjaxToNewDir = function(
folderId )
{
$.ajax({
url:
'http://forums.cdprojektred.com/private.php',
data: { 'folderid':
folderId },
}).done( function( data )
{
var result =
$.parseHTML( data ),
currentMsgs =
$( result ).find( '.blockrow.pmbit' ),
msgsLen =
currentMsgs.length;
nmbMsgs += msgsLen;
++searchedDirs;
if( msgsLen === 0 )
return;
$( currentMsgs ).each(
function( index ) {
var _userId =
$( this).find( '.commalist li a' ).attr( 'href' ),
msgId =
$( this ).find( 'span a' ).attr( 'href' ).split( 'pmid=' )[1];
if( userId !==
_userId || currMsgId === msgId ) { --nmbMsgs; return };
sendAjaxToNewMsg( msgId );
});
});
}
sendAjaxToNewDir ( 0 );
sendAjaxToNewDir ( -1 );
var waitForEnd = function()
{
if( searchedDirs === 2 &&
searchedMsgs === nmbMsgs) {
updateConversation();
return;
}
setTimeout(waitForEnd, 200);
}
waitForEnd();
}
Scrollbar = function(args)
{
var instance = args['container'];
function activeScroll()
{
var frameHeight =
$(instance).innerHeight();
var frameContentHeight =
$(instance).children(".content:first").innerHeight ();
if( frameHeight <
frameContentHeight )
{
var contentHeight =
$(instance).children(".content:first").outerHeight ();
$(instance).children
(".scrollbarFrame:first").children(".scrollbarBody :first").css(
'height', frameHeight / contentHeight * 100 + '%' );
$(instance).children
(".scrollbarFrame:first").children
(".scrollbarBody:first").draggable({containment : 'parent',
axis: 'y', drag: function() {
var tmp
= frameHeight / (frameHeight - $(instance).children
(".scrollbarFrame:first").children
(".scrollbarBody:first").outerHeight());
var px
= (contentHeight - frameHeight) *
( $(instance).children
(".scrollbarFrame:first").children
(".scrollbarBody:first").position().top / frameHeight * tmp );
$(instance).children(".content:first").css( 'margin-top', -px
);
}
});
}
else
$(instance).children
(".scrollbarFrame:first").children(".scrollbarBody :first").css(
'display', 'none' );
}
activeScroll();
};
//full size of img
$('.postbody .content img').dblclick( function
() {
$('body').append('<div
class="fullsizeImg">' + $(this)[0].outerHTML + '</div>');
$('.fullsizeImg').dblclick( function()
{
$(this).remove();
});
});
function createSettings()
{
var notifications_enable_checked =
'checked',
conversations_enable_checked =
'checked',
quickQuote_enable_checked =
'checked',
oldTopBar_enable_checked =
'checked',
text = {};
text = {
fixSettings: 'Fix - ustawienia',
quickNotificationPreview: 'Szybki
podgląd powiadomień',
quickNotificationPreview_description:
'Podgląd nowych powiadomień z możliwością szybkiego ich
usunięcia',
longConversation: 'Długa konwersacja',
longConversation_description:
'Tworzenie ciągłej konwersacji z pojedynczych wiadomości',
quickQuote: 'Szybkie cytowanie',
quickQuote_description: 'Opcja
szybkiego cytowania poprzez zaznaczenie tekstu',
oldTopBar: 'Stary wygląd górnego
paska',
oldTopBar_description: 'Usuwa zbędne
ikonki z paska',
}
if( fixSettings[0] == 0 )
notifications_enable_checked =
'';
if( fixSettings[1] == 0 )
conversations_enable_checked =
'';
if( fixSettings[2] == 0 )
oldTopBar_enable_checked = '';
if( fixSettings[3] == 0 )
quickQuote_enable_checked = '';
$(
'.blockbody.formcontrols.settings_form_border' ).prepend( '<h3
class="blocksubhead">' + text.fixSettings + '</h3>\
<div class="section"
id="fix_settings">\
<div class="blockrow">\
<label
for="notifications_enable">' + text.quickNotificationPreview +
':</label>\
<ul
class="checkradio group rightcol">\
<li>\
<input id="notifications_enable" type="checkbox" ' +
notifications_enable_checked + '>\
</li>\
</ul>\
<p
class="description">' +
text.quickNotificationPreview_description + '</p>\
</div>\
<div class="blockrow">\
<label
for="conversations_enable">' + text.longConversation +
':</label>\
<ul
class="checkradio group rightcol">\
<li>\
<input id="conversations_enable" type="checkbox" ' +
conversations_enable_checked + '>\
</li>\
</ul>\
<p
class="description">' + text.longConversation_description +
'</p>\
</div>\
<div class="blockrow">\
<label
for="oldTopBar_enable">' + text.oldTopBar + ':</label>\
<ul
class="checkradio group rightcol">\
<li>\
<input id="oldTopBar_enable" type="checkbox" ' +
oldTopBar_enable_checked + '>\
</li>\
</ul>\
<p
class="description">' + text.oldTopBar_description + '</p>\
</div>\
<div class="blockrow">\
<label
for="quickQuote_enable">' + text.quickQuote + ':</label>\
<ul
class="checkradio group rightcol">\
<li>\
<input id="subscriptionsBar_enable" type="checkbox" ' +
quickQuote_enable_checked + '>\
</li>\
</ul>\
<p
class="description">' + text.quickQuote_description + '</p>\
</div>\
</div>'
);
$( '#fix_settings input' ).click(
function()
{
fixSettings[ $( '#fix_settings
input' ).index(this) ] = $( this ).is( ':checked' ) ? 1 : 0;
setCookie(
'fix_settings_enable', fixSettings, cookie_lifeTime);
location.reload();
});
}
function addSocialThreads()
{
var forumName = RELPATH == 'forums/9-
Seria-gier-Wiedźmin' || 'forums/9' ? 'TheWitcher' :
'Cyberpunk';
var lastSubForum = $('.forumbitBody
li.forumbit_post.L1').last();
$.ajax({
url:
'http://forums.cdprojektred.com/forums/210-Spo%C5%82eczno
%C5%9B%C4%87',
}).done( function( data )
{
var result =
$.parseHTML( data ),
html = $(
result ).find( '.forumbitBoxLeft' ).html(),
isNewPost = $(
result ).find('.forumbit_post.L1.new').length;
if ( forumName ==
'TheWitcher') {
$('.forumbitBody li.forumbit_post.L1:last-child
.subforumlist.commalist').html('');
}
else if ( forumName ==
'Cyberpunk' ) {
$('.forumbitBody li.forumbit_post.L1').last().find('.forumdata
.datacontainer').append('<div class="subforums">\
<h4
class="subforumlistlabel">Sub-Fora:</h4>\
<ol
class="subforumlist commalist">\
</ol>\
</div>'
);
}
$( result ).find
('.forumbit_post.L1').each( function() {
var isNew =
$(this).hasClass('new');
var src = isNew
?
'http://static.cdprojektred.com/forums/images/styles/'+forumNam
e+'/statusicon_red/subforum_new-48.png' :
'http://static.cdprojektred.com/forums/images/styles/'+forumNam
e+'/statusicon_red/subforum_old-48.png';
$('.forumbitBody li.forumbit_post.L1').last().find
('.subforumlist.commalist').append('<li class="subforum">\
<img
class="inlineimg" border="0" alt="" src='+src+'>'
+
$('.forumtitle', this).html() +
',\
</li>'
);
});
if (isNewPost > 0) {
$(lastSubForum).last().css({cursor: 'pointer'});
$(lastSubForum).find('.forumicon').attr('src',
'http://static.cdprojektred.com/forums/images/styles/'+forumNam
e+'/statusicon_red/forum_new-48.png');
$(lastSubForum).find('.forumicon').on('dblclick', function() {
$.post(
'http://forums.cdprojektred.com/ajax.php?do=markread&f=210',
{
'securitytoken': SECURITYTOKEN,
'do': 'markread',
'forumid': 210
}
)
.done(
function( data )
{
$(lastSubForum).find('.forumicon').attr('src',
'http://static.cdprojektred.com/forums/images/styles/'+forumNam
e+'/statusicon_red/forum_old-48.png');
$(lastSubForum).find('.subforumlist.commalist
.inlineimg').attr('src',
'http://static.cdprojektred.com/forums/images/styles/'+forumNam
e+'/statusicon_red/subforum_old-48.png');
});
});
}
});
}
function repairBreadcrumb()
{
if( $('#breadcrumb .navbit:eq
(0)').text() == 'Społeczność' ) {
$('.breadcrumb .navbit:eq
(0)').before('<li class="navbit"><a href="forums/9-Seria-gier-
Wiedźmin">Seria gier Wiedźmin</a></li>');
}
}
function repairRedirectToPost()
{
var location = window.location + "";
var postHash = typeof location.split
('#')[1] == 'undefined' ? '' : '#' + location.split('#')[1];
if ( $('#postlist #posts
.postbitlegacy.postbitim.postcontainer').length == 0
|| !$('#postlist #posts
.postbitlegacy.postbitim.postcontainer').first().h asClass
('stickypost')
|| $( '#pagination_top .selected >
a').text() == 1) {
return;
}
var postId = postHash.replace('post',
'post_');
if ( postHash != '' &&
($(postId).length > 0 || $('.postcounter').last().text() ==
postHash) ) {
return;
}
if ( postHash == '' && !$('#postlist
#posts .postbitlegacy.postbitim.postcontainer').last
().hasClass('stickypost')) {
return;
}
postHash = postHash == '' ?
$('.postcounter').first().text() : postHash;
window.location.assign( $(
'#pagination_top .prev_next > a').attr('href') + postHash);
}
//----------------
INITIALIZATION----------------
//----------------------------------------------
addTopNavButtons();
noticationsClickNoExit();
if( fixSettings[0] ) addQuickShowNotifications
();
if( fixSettings[1] != 0 && $('#showpm').length
> 0 ) createFullConversation();
if( fixSettings[2] == 0 ) $('.unibar_right > ul
> li.link_social.link_social_desktop').attr("style", "display:
inline-block!important");
if( fixSettings[3] == 0 && $('#posts').length >
0 ) quickQuoteDisable();
if( $('#breadcrumb_two').length > 0 )
dragBottomNavBar();
if( window.location ==
'http://forums.cdprojektred.com/profile.php?do=editoptions' )
createSettings();
if( RELPATH == 'forums/9-Seria-gier-Wiedźmin'
|| RELPATH == 'forums/9' || RELPATH == 'forums/5')
addSocialThreads();
repairBreadcrumb();
repairRedirectToPost();
})(jQuery);
})();</script>