Guest User

one2xs.js

a guest
Jul 23rd, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.93 KB | None | 0 0
  1. $(document).ready(function(){
  2.  
  3. /*
  4.  
  5.  
  6.  
  7. Nieuwe layout voor one2xs
  8. Design en extensie door Thom Peetoom
  9.  
  10. Met dank aan Yorrick
  11.  
  12. LET OP:
  13. * #forum_title pas deleten NA de breadcrumb !!!!
  14. * Titel formaat MOET leeg zijn zodat je zoiets krijgt: one2xs | {forum/pagina} | {topic}
  15.  
  16.  
  17. */
  18.  
  19. function createMessage(message){
  20.  
  21. $('#top_info').remove();
  22. $('#logo').after("<div id='top_info'><div id='top_info_tekst'>" + message + " <strong>~ Thom</strong></div><br style='clear: both' /></div>");
  23.  
  24. }
  25.  
  26. //createMessage('Wegens eventuele 1 aprilgrappen van one2xs is de layout vandaag uitgeschakeld. De kans is namelijk groot dat deze grappen niet zichtbaar zijn met layout aan. Als deze nog wel zichtbaar zijn zal de layout later op de dag automatisch ingeschakeld worden.');
  27.  
  28. var systemOn = true;
  29. if(systemOn === true){
  30.  
  31. var ingelogd,
  32. topinfoBericht,
  33. sidebarPage,
  34. punten,
  35. priveberichten,
  36. saldo,
  37. watchlist;
  38.  
  39. // Geef body #thom zodat de styles werken
  40. $('body').attr("id", "thom");
  41.  
  42. // Verwijder elementen
  43. $('#zoek, #logo').remove();
  44. $('#sthommediv, #right').hide();
  45. $('#forum_punten').parent().hide();
  46.  
  47. /* ============================
  48. GEGEVENS
  49. ============================ */
  50.  
  51. // Ben je ingelogd?
  52. if($('body').html().indexOf('id="ingelogdals"') >= 0){
  53. ingelogd = true;
  54.  
  55. // Wat is je gebruikersnaam dan?
  56. username = $("#ingelogdals").text();
  57. } else {
  58. ingelogd = false;
  59. }
  60.  
  61. // Is er een top_info bericht?
  62. if($('body').html().indexOf('id="top_info"') >= 0){
  63. topinfoBericht = true;
  64. } else {
  65. topinfoBericht = false;
  66. }
  67.  
  68. // Heeft de pagina een sidebar?
  69. if($('#container').html().indexOf('id="left"') >= 0){
  70. sidebarPage = true;
  71. } else {
  72. sidebarPage = false;
  73. }
  74.  
  75. // Page arrays
  76. // Voor: menu en breadcrumb
  77. var pageArrayVerdienen = [
  78. 'http://www.one2xs.com/overzicht',
  79. 'http://www.one2xs.com/bellenvoorpunten',
  80. 'http://www.one2xs.com/blackjack',
  81. 'http://www.one2xs.com/bubble',
  82. 'http://www.one2xs.com/loterij',
  83. 'http://www.one2xs.com/belapi',
  84. 'http://www.one2xs.com/smsapi',
  85. 'http://www.one2xs.com/referral',
  86. 'http://www.one2xs.com/invite',
  87. 'http://www.one2xs.com/paysafecardvoorpunten',
  88. 'http://www.one2xs.com/paypalvoorpunten',
  89. 'http://www.one2xs.com/idealvoorpunten',
  90. 'http://www.one2xs.com/doe_overzicht',
  91. 'http://www.one2xs.com/dynamische_advertenties',
  92. 'http://www.one2xs.com/invite'
  93. ];
  94.  
  95. var pageArrayInbox = [
  96. 'http://www.one2xs.com/inbox',
  97. 'http://www.one2xs.com/new_pb',
  98. 'http://www.one2xs.com/verzonden',
  99. 'http://www.one2xs.com/read_pb?'
  100. ];
  101.  
  102. var pageArrayInfo = [
  103. 'http://www.one2xs.com/info/index',
  104. 'http://www.one2xs.com/hof'
  105. ];
  106.  
  107. var pageArrayForum = [
  108. 'http://www.one2xs.com/forum/index',
  109. 'http://www.one2xs.com/forum/zoek',
  110. 'http://www.one2xs.com/watchlist',
  111. 'http://www.one2xs.com/forum/recent'
  112. ];
  113.  
  114. var pageArrayUitgeven = [
  115. 'http://www.one2xs.com/domein/index',
  116. 'http://www.one2xs.com/mogelijke_extensies',
  117. 'http://www.one2xs.com/mdrcheck',
  118. 'http://www.one2xs.com/handelen',
  119. 'http://www.one2xs.com/ruilbank',
  120. 'http://www.one2xs.com/host/minecraft',
  121. 'http://www.one2xs.com/host/resellerhosting',
  122. 'http://www.one2xs.com/host/sharedwebhosting',
  123. 'http://www.one2xs.com/host/vpswebhosting',
  124. 'http://www.one2xs.com/host/info?s=11',
  125. 'http://www.one2xs.com/host/info?s=12',
  126. 'http://www.one2xs.com/host/info?s=13',
  127. 'http://www.one2xs.com/host/info?s=14',
  128. 'http://www.one2xs.com/host/info?s=15',
  129. 'http://www.one2xs.com/host/info?s=19',
  130. 'http://www.one2xs.com/host/resinfo?s=1',
  131. 'http://www.one2xs.com/host/resinfo?s=2',
  132. 'http://www.one2xs.com/host/resinfo?s=3',
  133. 'http://www.one2xs.com/host/resinfo?s=4',
  134. 'http://www.one2xs.com/host/resinfo?s=5',
  135. 'http://www.one2xs.com/host/resinfo?s=6',
  136. 'http://www.one2xs.com/tekkit'
  137. ];
  138.  
  139. /* ============================
  140. MENU
  141. ============================ */
  142.  
  143. // Advertentiebalk toevoegen
  144. $('#top-bar').before('<div id="newad"></div>');
  145.  
  146. // "Zoeken" knop toevoegen aan menu
  147. $('#top-bar ul').append('<li><a href="http://www.one2xs.com/forum/zoek" title="Zoeken op het forum">Zoeken</a></li>');
  148.  
  149. // "Ticket" knop toevoegen aan menu
  150. if(ingelogd){
  151. $('#top-bar ul').append('<li><a href="http://www.one2xs.com/ticket" title="Ticketsysteem">Tickets</a></li>');
  152. }
  153.  
  154. // Menu active class
  155. if(window.location == 'http://www.one2xs.com'
  156. || window.location == 'http://www.one2xs.com/'
  157. || window.location == 'http://www.one2xs.com/index' ) {
  158. $('#top-bar ul li:first a').attr('class', 'active');
  159. } else if(window.location == 'http://www.one2xs.com/aanmelden'
  160. && ingelogd == false){
  161. $('#top-bar ul li:eq(1) a').attr('class', 'active');
  162. } else if($.inArray(window.location.href.toString(), pageArrayVerdienen) != -1){
  163. $('#top-bar ul li:eq(1) a').attr('class', 'active');
  164. } else if(document.URL.indexOf("forum") !=-1
  165. && window.location != 'http://www.one2xs.com/forum/zoek') {
  166. $('#top-bar ul li:eq(2) a').attr('class', 'active');
  167. } else if($.inArray(window.location.href.toString(), pageArrayInfo) != -1) {
  168. $('#top-bar ul li:eq(3) a').attr('class', 'active');
  169. } else if(window.location == 'http://www.one2xs.com/linkpartners'){
  170. $('#top-bar ul li:eq(4) a').attr('class', 'active');
  171. } else if(window.location == 'http://www.one2xs.com/help'){
  172. $('#top-bar ul li:eq(5) a').attr('class', 'active');
  173. } else if(window.location == 'http://www.one2xs.com/adverteren'
  174. && ingelogd == false){
  175. $('#top-bar ul li:eq(6) a').attr('class', 'active');
  176. } else if(window.location == 'http://www.one2xs.com/forum/zoek'){
  177. $('#top-bar ul li:eq(6) a').attr('class', 'active');
  178. } else if((window.location == 'http://www.one2xs.com/ticket'
  179. || window.location == 'http://www.one2xs.com/ticket/')
  180. && ingelogd){
  181. $('#top-bar ul li:eq(7) a').attr('class', 'active');
  182. }
  183.  
  184. // Menu padding fix
  185. var beforeActiveElement = $('#top-bar .active').parent().prev().children();
  186. if(beforeActiveElement != null){
  187. $(beforeActiveElement).css("padding-right", "25px");
  188. }
  189.  
  190. /* ============================
  191. HEADER
  192. ============================ */
  193.  
  194. // Header element aanmaken
  195. $('#top-bar').after('<div id="header"></div>');
  196.  
  197. // Logo toevoegen
  198. $('#header').append('<div id="logo"><a href="http://www.one2xs.com"><img src="' + chrome.extension.getURL('images/logo.png') + '" title="One2xs" /></a></div>');
  199.  
  200. // Notificatiebalk
  201. if(topinfoBericht){
  202.  
  203. // Notificatiebalk element aanmaken
  204. $('#header').append('<div id="notificatiebalk"><div id="notif_pijl"></div></div>');
  205.  
  206. // Notificatiebericht ophalen
  207. var notifBerichtContent = $('#top_info_tekst').html(),
  208. notifBerichtTitel = '',
  209. notifBerichtSluit = '',
  210. extraclass = '';
  211.  
  212. // Titel en extra class voor juiste buttons (a[klik-ads] en a[doe-ads] mogen geen button worden)
  213. if(notifBerichtContent.indexOf('one2xs gebruikt cookies') >= 0){
  214. notifBerichtTitel = 'one2xs gebruikt cookies';
  215. extraclass = 'mooiebuttons';
  216. } else if(notifBerichtContent.indexOf('klik advertentie') >= 0){
  217. notifBerichtTitel = 'nieuwe klik advertentie(s)';
  218. } else if(notifBerichtContent.indexOf('doe advertentie') >= 0){
  219. notifBerichtTitel = 'nieuwe doe advertentie(s)';
  220. } else {
  221. notifBerichtTitel = 'let op!';
  222. extraclass = 'mooiebuttons';
  223. }
  224.  
  225. // Sluitknop
  226. if($("#top_info_img a").length != 0){
  227. var notifBerichtSluitUrl = $("#top_info_img a").attr("href"),
  228. notifBerichtSluitTitle = $("#top_info_img a img").attr("alt");
  229. }
  230.  
  231. notifBerichtSluit = '<div class="notif_kruisje" onclick="location.href=\'' + notifBerichtSluitUrl + '\'" title="' + notifBerichtSluitTitle + '">X</div>';
  232.  
  233. // Die » dingen wegfilteren omdat het in een button komt
  234. notifBerichtContent = notifBerichtContent.replace(/\»/g, ' ');
  235.  
  236.  
  237. // Notificatiebericht laten zien
  238. $('#notificatiebalk').append('<div class="notificatie ' + extraclass + '"><div class="notif_titel">' + notifBerichtTitel + notifBerichtSluit + '</div><div class="notif_bericht">' + notifBerichtContent + '</div></div>');
  239.  
  240. }
  241. else {
  242.  
  243. // Logo centreren
  244. $("#logo").css("left", "255px");
  245.  
  246. }
  247.  
  248. /* ============================
  249. USERBAR
  250. ============================ */
  251.  
  252. // Userbar element aanmaken
  253. $('#header').after('<div id="userbar"></div>');
  254.  
  255. // Vars
  256. var userbarLeft = '',
  257. userbarMiddle = '',
  258. userbarRight = '';
  259.  
  260. // Left
  261. if(ingelogd){
  262.  
  263. userbarLeft = 'Je bent ingelogd als <a href="/profiel/bekijk?gebruiker=' + username + '">' + username + '</a>.';
  264.  
  265. // Midden ophalen: saldo,punten,priveberichten.
  266. // Locatie verschilt of er een sidebar is of niet
  267. var priveberichtenstyle = '',
  268. puntenUrl = '#" onclick="indexPunten(800)',
  269. userbarAutoMiddle = '<img src="http://famfamfam.nl/famicons/email.png" /><span class="item"><a href="http://www.one2xs.com/inbox">Inbox</a></span>';
  270.  
  271. if(sidebarPage){
  272.  
  273. // Bestaat het ingelogd blokje?
  274. if($('#left').html().indexOf('<h1>Ingelogd</h1>') >= 0){
  275.  
  276. // Punten ophalen
  277. punten = $('a[onclick^="indexPunten("]').html().replace(' punten', '');
  278.  
  279. // Saldo ophalen
  280. // Ben je wel een adverteerder?
  281. if($('#left').html().indexOf('Adverteersaldo') >= 0){
  282.  
  283. saldo = $('a[href="http://www.one2xs.com/adv_admin/saldooverzicht"]').html().replace('€ ', '');
  284.  
  285. } else {
  286.  
  287. saldo = '';
  288.  
  289. }
  290.  
  291. // Priveberichten ophalen
  292. priveberichten = $('a[title="Inbox"]').html().replace('Privéberichten ', '').replace('(', '').replace(')', '');
  293.  
  294. } else {
  295.  
  296. userbarMiddle = userbarAutoMiddle;
  297.  
  298. }
  299.  
  300. } else {
  301.  
  302. // Bestaat de sthomme div?
  303. //if($('body').html().indexOf('id="sthommediv"') >= 0){
  304. //}
  305.  
  306. // Priveberichten
  307. if($('body').html().indexOf('id="newPms"') >= 0){
  308.  
  309. priveberichten = $('#newPms').html().replace(' nieuwe berichten', '').replace(' nieuw bericht', '');
  310.  
  311. } else {
  312.  
  313. if($('body').html().indexOf('id="forum_pbs"') >= 0){
  314.  
  315. priveberichten = $('#forum_pbs a').html().replace(' nieuwe berichten', '').replace(' nieuw bericht', '');
  316.  
  317. }
  318.  
  319. }
  320.  
  321. // Punten
  322. if($('body').html().indexOf('id="forum_punten"') >= 0){
  323.  
  324. punten = $('#forum_punten a').html().replace(' punten', '');
  325. puntenUrl = '#" onclick="postData(\'http://www.one2xs.com/includes/ajaxfuncties.php\', saldooverzicht, \'s=9&amp;own=1\', true);';
  326.  
  327. }
  328.  
  329. // Saldo
  330. if($('body').html().indexOf('id="forum_advsaldo"') >= 0){
  331.  
  332. saldo = $('#forum_advsaldo a').html().replace('Saldo: €', '');
  333.  
  334. }
  335.  
  336. // Watchlist
  337. if($('body').html().indexOf('<div style="background: url(http://www.one2xs.com/img/forum_read_small.gif) no-repeat; height: 16px; width: 16px; float: left; ">') >= 0){
  338.  
  339. watchlist = 'read';
  340.  
  341. } else if($('body').html().indexOf('<div style="background: url(http://www.one2xs.com/img/forum_unread_small.gif) no-repeat; height: 16px; width: 16px; float: left; ">') >= 0){
  342.  
  343. watchlist = 'unread';
  344.  
  345. }
  346.  
  347. }
  348.  
  349.  
  350. // userbarMiddle HTML genereren
  351. if(userbarMiddle != userbarAutoMiddle){
  352.  
  353. // Punten toevoegen aan userbarMiddleuserbarMiddle
  354. if(punten != '' && punten != undefined){
  355. userbarMiddle = '<img src="http://famfamfam.nl/famicons/coins.png" /><span class="item"><a href="' + puntenUrl + '">' + punten + ' punten</a></span>';
  356. }
  357.  
  358. // Saldo toevoegen aan userbarMiddle
  359. if(saldo != '' && saldo != undefined){
  360.  
  361. userbarMiddle = userbarMiddle + '<img src="http://famfamfam.nl/famicons/coins.png" /><span class="item"><a href="http://www.one2xs.com/adv_admin/saldooverzicht">&euro; ' + saldo + '</a></span>';
  362.  
  363. }
  364.  
  365. // Priveberichten toevoegen aan userbarMiddle
  366. if(priveberichten != '' && priveberichten != undefined){
  367.  
  368. if(priveberichten != '0'){
  369. priveberichtenstyle = 'font-weight: bolder';
  370. }
  371.  
  372.  
  373. userbarMiddle = userbarMiddle + '<img src="http://famfamfam.nl/famicons/email.png" /><span class="item" style="' + priveberichtenstyle + '"><a href="http://www.one2xs.com/inbox">' + priveberichten + ' priv&eacute;bericht(en)</a></span>';
  374.  
  375. }
  376.  
  377. // Watchlist toevoegen aan userbarMiddle
  378. if(watchlist != '' && watchlist != undefined){
  379.  
  380. userbarMiddle = userbarMiddle + '<img src="' + chrome.extension.getURL('images/watchlist-' + watchlist + '.png') + '" /><span class="item"><a href="http://www.one2xs.com/watchlist">Watchlist</a></span>';
  381.  
  382. }
  383.  
  384. }
  385.  
  386. // userbarMiddle fix
  387. if(userbarMiddle == ''){
  388.  
  389. userbarMiddle = userbarAutoMiddle;
  390.  
  391. }
  392.  
  393. // Watchlist link toevoegen aan userbarRight
  394. if(watchlist == undefined){
  395.  
  396. userbarRight = userbarRight + '<a href="/watchlist">Watchlist</a> - ';
  397.  
  398. }
  399.  
  400. userbarRight = userbarRight + '<a href="/profiel/index">Mijn profiel</a>';
  401.  
  402. // Uitlog link toevoegen aan userbarRight
  403. if($('body').html().indexOf('title="Uitloggen"') >= 0){
  404.  
  405. userbarRight = userbarRight + ' - <a href="' + $('#left a[title="Uitloggen"]').attr("href") + '" title="' + $('#left a[title="Uitloggen"]').attr("href") + '">Uitloggen</a>';
  406.  
  407. }
  408.  
  409. } else {
  410.  
  411. userbarMiddle = 'Je bent niet ingelogd. <a href="/login">Log in</a> of <a href="/aanmelden">maak een gratis account aan</a>.';
  412.  
  413. }
  414.  
  415. // HTML invoegen
  416. $("#userbar").html("<div id='items'>" + userbarMiddle + "</div><div class='ubar_left'>" + userbarLeft + "</div><div class='ubar_right'>" + userbarRight + "</div>");
  417.  
  418.  
  419. /* ============================
  420. BREADCRUMB
  421. ============================ */
  422.  
  423. // Breadcrumb element toevoegen
  424. $("#userbar").after("<div id='breadcrumb1' class='breadcrumb'></div>");
  425.  
  426. // Tweede Breadcrumb element toevoegen
  427. $("#container").append("<div id='breadcrumb2' class='breadcrumb'></div>");
  428.  
  429. // one2xs link toevoegen aan breadcrumb
  430. $(".breadcrumb").append("<div class='item'><a href='/'>one2xs</a></div>");
  431.  
  432. /*
  433. *
  434. * Let op: Dit script hieronder is een beetje slecht.
  435. *
  436. */
  437.  
  438. var firstpage = '',
  439. firstpageLink = '',
  440. secondpage = '',
  441. secondpageLink = '',
  442. thirdpage = '',
  443. thirdpageLink = '';
  444.  
  445. // Breadcrumn page recognizing
  446.  
  447. // Ken ik de pagina al?
  448. if(window.location == 'http://www.one2xs.com'
  449. || window.location == 'http://www.one2xs.com/'
  450. || window.location == 'http://www.one2xs.com/index' ) {
  451. firstpage = 'Home';
  452. firstpageLink = window.location;
  453. }
  454.  
  455. //
  456. // Speciale pagina's:
  457. //
  458.  
  459. var locatie = window.location.href.toString();
  460.  
  461. // Profielen:
  462. if(locatie.substr(0,29) == 'http://www.one2xs.com/profiel'){
  463.  
  464. firstpage = 'Profielen';
  465. firstpageLink = '/profiel/index';
  466.  
  467. secondpage = $('title').text().replace('one2xs | ', '');
  468. secondpageLink = window.location;
  469.  
  470. }
  471.  
  472. // Adv paneel:
  473. if(locatie.substr(0,31) == 'http://www.one2xs.com/adv_admin'){
  474.  
  475. firstpage = 'Adverteerders administratiepaneel';
  476. firstpageLink = '/adv_admin/index';
  477.  
  478. secondpage = $('title').text().replace('one2xs | ', '');
  479. secondpageLink = window.location;
  480.  
  481. if(secondpage == 'Adverteerders administratiepaneel'){
  482.  
  483. secondpage = 'Home';
  484.  
  485. }
  486.  
  487. }
  488.  
  489. // Priveberichten:
  490. if($.inArray(locatie, pageArrayInbox) != -1){
  491.  
  492. firstpage = 'Priv&eacute;berichten';
  493. firstpageLink = '/inbox';
  494.  
  495. secondpage = $('title').text().replace('one2xs | ', '').replace('Privéberichten - ', '');
  496. secondpageLink = window.location;
  497.  
  498. }
  499.  
  500. // Verdienen:
  501. if($.inArray(locatie, pageArrayVerdienen) != -1){
  502.  
  503. firstpage = 'Verdienen';
  504. firstpageLink = '/overzicht';
  505.  
  506. secondpage = $('title').text().replace('one2xs | ', '').replace('Privéberichten - ', '');
  507. secondpageLink = window.location;
  508.  
  509. }
  510.  
  511. // Info:
  512. if($.inArray(locatie, pageArrayInfo) != -1){
  513.  
  514. firstpage = 'Informatie over one2xs';
  515. firstpageLink = '/info/index';
  516.  
  517. secondpage = $('title').text().replace('one2xs | ', '');
  518. secondpageLink = window.location;
  519.  
  520. if(secondpage == 'Informatie over one2xs'){
  521.  
  522. secondpage = 'Home';
  523.  
  524. }
  525.  
  526. }
  527.  
  528. // Uitgeven:
  529. if($.inArray(locatie, pageArrayUitgeven) != -1){
  530.  
  531. firstpage = 'Uitgeven';
  532. firstpageLink = '/index';
  533.  
  534. secondpage = $('title').text().replace('one2xs | ', '');
  535. secondpageLink = window.location;
  536.  
  537. }
  538.  
  539. // Forum:
  540. if($.inArray(locatie, pageArrayForum) != -1){
  541.  
  542. firstpage = 'Forum';
  543. firstpageLink = '/forum/index';
  544.  
  545. secondpage = $('title').text().replace('one2xs | ', '');
  546. secondpageLink = window.location;
  547.  
  548. }
  549.  
  550. if(locatie.substr(0,27) == 'http://www.one2xs.com/forum'){
  551.  
  552. firstpage = 'Forum';
  553. firstpageLink = '/forum/index';
  554.  
  555. secondpage = $('title').text().replace('one2xs | ', '');
  556. secondpageLink = window.location;
  557.  
  558. }
  559.  
  560. // Forum: forum
  561. if(locatie.substr(0,37) == 'http://www.one2xs.com/forum/forum?id='){
  562.  
  563. // Bestaat het forum?
  564. if($('body').html().indexOf('Dit forum bestaat niet (meer).') >= 0){
  565.  
  566. // Bestaat niet:
  567. secondpage = 'Forum bestaat niet';
  568. secondpageLink = window.location;
  569.  
  570. } else {
  571.  
  572. // Forum ophalen uit titel
  573. secondpage = $('title').text().replace('one2xs | Forum - ', '');
  574.  
  575. }
  576.  
  577. }
  578.  
  579. // Forum: topic
  580. if(locatie.substr(0,37) == 'http://www.one2xs.com/forum/topic?id='){
  581.  
  582. // Bestaat het topic?
  583. if($('body').html().indexOf('Dit topic bestaat niet.') >= 0){
  584.  
  585. // Bestaat niet:
  586. secondpage = 'Topic bestaat niet';
  587. secondpageLink = window.location;
  588.  
  589. var topicnaam = 'Topic bestaat niet';
  590.  
  591. } else {
  592.  
  593. // Forum ophalen uit #forum_title
  594. secondpage = $('#forum_title a:eq(1)').text();
  595. secondpageLink = $('#forum_title a:eq(1)').attr("href");
  596.  
  597. // Topic ophalen uit #forum_title
  598. thirdpage = $('#forum_title a:eq(2)').text();
  599. thirdpageLink = $('#forum_title a:eq(2)').attr("href");
  600.  
  601. var topicnaam = $('#forum_title a:eq(2)').text();
  602.  
  603. }
  604.  
  605. }
  606.  
  607. // Uit titel halen omdat er anders niks is
  608. if(firstpage == ''){
  609.  
  610. firstpage = $('title').text().replace('one2xs | ', '');
  611. firstpageLink = window.location;
  612.  
  613. }
  614.  
  615. // Pagina's verwerken, html genereren en laten zien
  616. if(firstpage != ''){
  617.  
  618. $('.breadcrumb').append('<div class="sep"></div><div class="item"><a href="' + firstpageLink + '">' + firstpage + '</a></div>');
  619.  
  620. }
  621.  
  622. if(secondpage != ''){
  623.  
  624. $('.breadcrumb').append('<div class="sep"></div><div class="item"><a href="' + secondpageLink + '">' + secondpage + '</a></div>');
  625.  
  626. }
  627.  
  628. if(thirdpage != ''){
  629.  
  630. $('.breadcrumb').append('<div class="sep"></div><div class="item"><a href="' + thirdpageLink + '">' + thirdpage + '</a></div>');
  631.  
  632. }
  633.  
  634. /* ============================
  635. CONTENT
  636. ============================ */
  637.  
  638. // Advertentie weergeven
  639. if($('body').html().indexOf('id="horizontaleadvertentie"') >= 0){
  640.  
  641. $("#horizontaleadvertentie").show();
  642.  
  643. }
  644.  
  645. // Heeft de pagina een sidebar?
  646. if(sidebarPage){
  647.  
  648. // Left eerste blok en header van navigatie weghalen
  649. var allesbehalveinloggenenheader = $("#left").html().split('<h1>Navigatie</h1>');
  650. $("#left").html(allesbehalveinloggenenheader[1]);
  651.  
  652. // Navigatie blok span en strong weghalen
  653. $("#navigatie strong").each(function(){
  654. $(this).parent().html('<div class="nav-header">' + $('span', this).text() + '</div>');
  655. });
  656.  
  657. // Lijn corrigeren
  658. $("#navigatie li[style='border-top: 1px solid #CCC; height: 1px; width: 90%; overflow: hidden; margin: 5px 0 0 0;']")
  659. .attr("style", "border-top: 1px solid #CCC; height: 1px; width: 100%; overflow: hidden; margin-top: 5px; margin-bottom: 5px;");
  660.  
  661. // » voor elke link zetten
  662. $("#navigatie a").before("&#187; ");
  663.  
  664. // Advertentie toevoegen
  665. // $("#content").prepend('<script type="text/javascript"><!--
  666. //google_ad_client = "ca-pub-8826198676569410";
  667. ///* one2xs_rechts_lang_horiz */
  668. //google_ad_slot = "7619448970";
  669. //google_ad_width = 468;
  670. //google_ad_height = 60;
  671. ////-->
  672. //</script>
  673. //<script type="text/javascript"
  674. //src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
  675. //</script>'); */
  676.  
  677. }
  678.  
  679. // Buttons aanpassen
  680. $('img[src="http://www.one2xs.com/img/meer-button.gif"]').each(function(){
  681. $(this).parent().addClass('gobutton').html($(this).attr("alt"));
  682. });
  683.  
  684. $('img[src="../img/nieuw_topic.png"]').each(function(){
  685. $(this).parent().addClass('gobutton').html($(this).attr("alt"));
  686. });
  687.  
  688. $('input.login-button').attr("value", "Inloggen");
  689.  
  690. // top h1 op bepaalde pagina's aanpassen
  691. if(locatie.substr(0,32) == 'http://www.one2xs.com/forum/zoek'
  692. || locatie.substr(0,34) == 'http://www.one2xs.com/forum/bewerk'
  693. || locatie.substr(0,35) == 'http://www.one2xs.com/forum/reageer'
  694. || locatie.substr(0,32) == 'http://www.one2xs.com/forum/nieuw'
  695. || locatie == 'http://www.one2xs.com/doe_overzicht'){
  696.  
  697. $('#content-forum h1:first, #content-forum-orange h1:first').css("margin-top", "0px");
  698.  
  699. }
  700.  
  701.  
  702. /* ============================
  703. FORUM
  704. ============================ */
  705.  
  706. // Blokje-style
  707. $('[style="border: 1px solid #ce8a32; margin: 5px 0 0 0; padding: 5px 5px 5px 7px;"]')
  708. .attr("style", "").addClass("blokje");
  709.  
  710. // Blokjes titel kleur weghalen
  711. $(".blokje").each(function(){
  712. $(this).html($(this).html().replace('color: #d18120;', 'color: #484b4d;'));
  713. });
  714.  
  715. setInterval(function(){
  716.  
  717. $(".blokje").each(function(){
  718. $(this).html($(this).html().replace('color: #d18120;', 'color: #484b4d;'));
  719. });
  720.  
  721. }, 100);
  722.  
  723. // Forumindex
  724. if(locatie == 'http://www.one2xs.com/forum'
  725. || locatie == 'http://www.one2xs.com/forum/'
  726. || locatie == 'http://www.one2xs.com/forum/index'){
  727.  
  728. // h1 margin top weghalen
  729. $("#content-forum-orange h1:first").css("margin-top", "0px");
  730.  
  731. // onderste lijn van laatste categorie kleur geven
  732. $(".forum-cat-container").attr("style", "");
  733.  
  734. // Markeer alles als gelezen blokje aanpassen
  735. $('div[style="border: 1px solid #ce8a32; margin: 5px 0 0 0; padding: 5px 5px 5px 7px; text-align: center;"] a').each(function(){
  736. var reallythis = $(this);
  737. if($(this).html() == 'Markeer alle berichten als gelezen'){
  738.  
  739. $(this).parent().attr("style", "text-align: center; padding: 10px; border: 0;");
  740.  
  741. // Informatie blokje toevoegen
  742. $(this).parent().after("<h1 style='margin-bottom: 0px'>Informatie</h1>");
  743.  
  744. // Rand aanpassen van online blokje
  745. $("#usersOnline").parent().css("border-top", "0");
  746.  
  747. }
  748. });
  749.  
  750. }
  751.  
  752. // Forum pagina
  753. if(locatie.substr(0,37) == 'http://www.one2xs.com/forum/forum?id='){
  754.  
  755. $('body').addClass('forumpage');
  756.  
  757. // h1 margin top weghalen
  758. $("#content-forum-orange h1:first").css("margin-top", "0px");
  759.  
  760. // #forum_title left
  761. $("#forum_title").html($("#forum_title a:eq(1)").text()).parent().attr("class", "grijs");
  762.  
  763. // Fix op aanbiedingen forum
  764. if(locatie.substr(0,38) == 'http://www.one2xs.com/forum/forum?id=3'){
  765.  
  766. $('.recent').css({
  767. "position": "relative",
  768. "bottom": "4px"
  769. });
  770.  
  771. }
  772.  
  773. // Pagina's
  774. $("div[style='float: left; width: 50%;']").addClass('paginalinkjes');
  775.  
  776. // Markeer alles als gelezen knop beter maken
  777.  
  778. // » weghalen
  779. $('#content-forum-orange').html(
  780. $('#content-forum-orange').html()
  781. .replace('» <a href="http://www.one2xs.com/forum/gelezen?id=', '<a style="margin-top: 10px; text-align: center; display: block;" href="http://www.one2xs.com/forum/gelezen?id=')
  782. );
  783.  
  784. }
  785.  
  786. // Topic pagina
  787. if(locatie.substr(0,33) == 'http://www.one2xs.com/forum/topic'){
  788.  
  789. $('body').addClass('topicpage');
  790.  
  791. // #forum_title left
  792. $("#forum_title").parent().hide().after('<h1 id="topicnaamHolder" class="grijs" style="margin-top: 0px;">' + topicnaam + '</h1>');
  793.  
  794. // #forum_title2 veranderen naar Snel reageren
  795. $("#forum_title2").parent().text("Snel reageren").addClass("grijs").attr("style", "");
  796.  
  797. // Onder paginatie class geven
  798. $('.pagnav').parent().addClass('paginalinkjes');
  799.  
  800. // Boven paginatie
  801. $("#topicnaamHolder").after("<div id='bovenpaginatie' class='paginalinkjes'>" + $('.pagnav').parent().html() + "</div>");
  802.  
  803. // Reageren knop
  804. $('#reageer_eins').after("<a href='reageer?topic=" + $('.pagnav').attr("href").replace('?id=', '') + "' class='gobutton' style='float: right; margin-top: 20px;'>Reageren</a>").remove();
  805.  
  806. }
  807.  
  808. // Zoeken op het forum
  809. if(locatie.substr(0,32) == 'http://www.one2xs.com/forum/zoek'){
  810.  
  811. $('body').addClass('zoekpage');
  812.  
  813. }
  814.  
  815. // Posts aanpassen
  816. setInterval(function(){
  817.  
  818. // Ben je op het forum of zoek je posts?
  819. if($('body').hasClass('topicpage')
  820. || $('body').hasClass('zoekpage')){
  821.  
  822. // Posts de post class geven
  823. $('.forum-sub-top-topic').parent().addClass('forumpost');
  824.  
  825. $('.forumpost').each(function(){
  826.  
  827. // Is deze reactie al veranderd? Nee?
  828. if(!$(this).hasClass('fstt-changed')){
  829.  
  830. if($('.forum-sub-top-topic', this).html().indexOf('class="topic-icons-top"') >= 0){
  831. var icontjes = $('.topic-icons-top', this).html();
  832. } else {
  833. var icontjes = '';
  834. }
  835.  
  836. // Structuur wijzigen
  837. $('.forum-sub-top-topic', this).html(
  838. '<div class="forum-sub-top-topic-left" id="' + $('.topic-titel-top', this).attr("id") + '">'
  839. + $('.topic-gebruiker-top', this).html().replace('width: 100%', '')
  840. + ' - '
  841. + $('.topic-titel-top', this).html()
  842. + '</div>'
  843. + '<div class="forum-sub-top-topic-right">'
  844. + icontjes
  845. + '</div>');
  846.  
  847. // Over de poster structuur wijzigen
  848. if($('.topic-gebruikersinhoud', this).html().indexOf('class="topic-avatar"') >= 0){
  849. $('.topic-gebruikersinhoud', this).html(
  850. '<div class="topic-avatar">'
  851. + '<img src="' + $('.topic-avatar', this).attr("src") + '" style="margin: 0; padding: 0;" />'
  852. + '</div>'
  853. + '<div class="topic-wiebenik">'
  854. + $('.topic-usernaam', this).clone().html()
  855. + '<br /><em>' + $('.topic-userstatus', this).clone().html() + '</em>'
  856. + '<br /><br />' + $('.topic-userinformatie', this).clone().html()
  857. //+ $('.topic-gebruikersinhoud div[style="width: 119px; border: 1px solid #999; height: 6px; margin: 3px 0 0 0;"]', this).clone().html()
  858. + '</div>');
  859. } else {
  860. $('.topic-gebruikersinhoud', this).html(
  861. $('.topic-usernaam', this).clone().html()
  862. + '<br /><em>' + $('.topic-userstatus', this).clone().html() + '</em>'
  863. + '<br /><br />' + $('.topic-userinformatie', this).clone().html()
  864. //+ $('.topic-gebruikersinhoud div[style="width: 119px; border: 1px solid #999; height: 6px; margin: 3px 0 0 0;"]', this).clone().html()
  865. );
  866. }
  867.  
  868. // hr lijn wijzigen
  869. $('hr[color="#deac68"]', this).attr("color", "#c4c4c4");
  870.  
  871. // Add class
  872. $(this).addClass('fstt-changed');
  873.  
  874. // Icoontjes aanpassen
  875. var icoontjesArray = {
  876. '/img/topic-quote.gif': 'topic-quote.png',
  877. '/img/topic-pb.gif': 'topic-pb.png',
  878. '/img/topic-edit.gif': 'topic-edit.png',
  879. '/img/slotje.gif': 'slotje.png',
  880. '/img/report.png': 'report.png',
  881. '/img/watchlist.gif': 'watchlist.png'
  882. }
  883.  
  884. $.each(icoontjesArray, function(k, v) {
  885. $('img[src="http://www.one2xs.com' + k + '"]').each(function(){
  886. $(this).attr("src", chrome.extension.getURL('images/' + v));
  887. });
  888. });
  889.  
  890. // MultiQuote verwijderen
  891. $('img[alt="MultiQuote"]',this).remove();
  892.  
  893. }
  894.  
  895. });
  896.  
  897. }
  898.  
  899. }, 100);
  900.  
  901. // Reageren vak
  902. if($('body').hasClass('topicpage')
  903. //|| $('body').hasClass('zoekpage')
  904. || locatie.substr(0,35) == 'http://www.one2xs.com/forum/reageer'
  905. ){
  906.  
  907. // Vars bepalen voor topic
  908.  
  909. if($('body').hasClass('topicpage')){
  910.  
  911. var reageervak = $('#smileydiv').parent().parent().parent().parent();
  912.  
  913. var ubbButtons = $('tr:first td:first div', reageervak).html();
  914. var smileys = $('#smileydiv', reageervak).attr("style", "height: 118px").clone().html();
  915. var moreSmileys= '<a href="javascript:moresmilies" id="moresmilies">Meer smilies</a>';
  916. var right = $('tr:first td:first', reageervak).html();
  917. var right2 = '<br /><br /><strong>' + $('tr:eq(2) td:first', reageervak).html() + '</strong><br />' + $('tr:eq(2) td:last', reageervak).html();
  918. var textarea = '<textarea style="height: 220px; width: 595px;" name="bericht" id="bericht" tabindex="2"></textarea>';
  919. var buttons = '<div class="pb_buttons">' + $('tr:eq(1) td', reageervak).html() + '</div>';
  920.  
  921.  
  922. } else {
  923.  
  924. // En ook voor /reageer...
  925. var reageervak = $('form[name="postform"] table tbody');
  926.  
  927. var ubbButtons = $('tr:first td:first div', reageervak).html();
  928. var smileys = $('#smileydiv', reageervak).attr("style", "height: 118px").clone().html();
  929. var moreSmileys= '<a href="javascript:moresmilies" id="moresmilies">Meer smilies</a>';
  930. var right = $('tr:eq(1) td:first', reageervak).html();
  931. var right2 = '<br /><br /><br />' + $('tr:first td:last', reageervak).html();
  932. var textarea = '<textarea style="height: 220px; width: 595px;" name="bericht" id="bericht" tabindex="2"></textarea>';
  933. var buttons = '<div class="pb_buttons">' + $('tr:eq(2) td:last', reageervak).html() + '</div>';
  934.  
  935. }
  936.  
  937. var HTML = '<div class="postblock">'
  938. + '<div class="pb_left">'
  939. + textarea
  940. + buttons
  941. + '</div>'
  942. + '<div class="pb_right">'
  943. + right
  944. + '<br />'
  945. + right2
  946. + '</div>'
  947. + '<div style="clear: both;"></div>'
  948. + '</div>';
  949.  
  950. $(reageervak).replaceWith(HTML);
  951.  
  952. }
  953.  
  954.  
  955. /* ============================
  956. FOOTER
  957. ============================ */
  958.  
  959. // | veranderen in -
  960. $('#footer_right li').each(function(){
  961. $(this).html($(this).html().replace('|', ' -&nbsp;'));
  962. });
  963.  
  964. // Mijn copyright erbij zetten
  965. $('#breadcrumb2').append('<div class="item" style="float: right; color: rgb(173, 147, 103);">Design en extensie door <a href="http://www.one2xs.com/profiel/bekijk?gebruiker=Thom">Thom</a>. Met dank aan <a href="http://www.one2xs.com/profiel/bekijk?gebruiker=Yorrick">Yorrick</a>.</div>');
  966.  
  967.  
  968. } else {
  969. $('#top_info').show();
  970. }
  971.  
  972. /* ============================
  973. FINAL
  974. ============================ */
  975.  
  976. // Laat pagina weergeven
  977. $('body').css("display", "block");
  978.  
  979.  
  980. /* ============================
  981. BUG FIXES
  982. ============================ */
  983.  
  984. // Anchor scroll fix
  985. if(window.location.hash.replace("#", "") != ''){
  986. var selector = '[name="' + window.location.hash.replace("#", "") + '"]';
  987. if($('body').html().indexOf('name="' + window.location.hash.replace("#", "") + '"') >= 0){
  988. $('html, body').animate({
  989. scrollTop: $( selector ).offset().top
  990. }, 1);
  991. }
  992. }
  993.  
  994. });
Advertisement
Add Comment
Please, Sign In to add comment