$(function() { if (/\/c\d+-/.test(window.location.href)) return; // return if category
// automatically detects the version var version = $('.bodylinewidth')[0] ? 0 : document.getElementById('wrap') ? 1 : $('div.pun')[0] ? 2 : document.getElementById('ipbwrapper') ? 3 : document.getElementById('fa_edge') ? 4 : 'badapple';
// error notifications if (version == 'badapple' || !window.JSON || !window.localStorage) { var errString = 'The plugin "fa_starred" could not be executed because : ';
if (version == 'badapple') errString += '\nYour forum version is not supported.'; if (!window.JSON) errString += '\nJSON is not supported by your browser'; if (!window.localStorage) errString += '\nThe Storage API is not support by your browser.';
// get fontawesome if unavailable if (!$('link[href$="font-awesome.min.css"]')[0]) { document.getElementsByTagName('HEAD')[0].insertAdjacentHTML('beforeend', '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css" />'); }
window.fa_starred = { version : version, // forum version forums : localStorage.fa_starred_forums ? JSON.parse(localStorage.fa_starred_forums) : null,
// language settings lang : { star : 'Star this forum', unstar : 'Unstar this forum', starred : 'Starred Forums' },
// move the selected forum to the "starred" category star : function(that, id, startup) { if (!fa_starred.forums) fa_starred.forums = {}; if (!fa_starred.board) fa_starred.createStarBoard();
if (!fa_starred.forums[id]) { // clone the row and add it to the star board var clone = $(that).closest(fa_starred.select.row)[0].cloneNode(true), rows = $(that).closest(fa_starred.select.row).parent().find(fa_starred.select.row);
// update the star attributes for the clone $('.fa_star', clone).attr({ 'onclick' : 'fa_starred.unstar(this, ' + id + '); return false', 'class' : 'fa_unstar', 'title' : fa_starred.lang.unstar }).html('<i class="fa">' + fa_starred.icon.unstar + '</i>');
fa_starred.list.appendChild(clone); // append the clone to the starred category
$(that).closest(fa_starred.select.row)[0].style.display = 'none'; // hide the original row
// check if all forums are hidden for this category for (var i = 0, j = rows.length, k = 0; i < j; i++) { if (/none/.test(rows[i].style.display)) k++; }
// hide the category if all forums are hidden if (i == k) { $(that).closest(fa_starred.select.category)[0].className += ' fa_star_hidden'; }
// jump to the star board if it's out of sight if (!startup && document.getElementById('fa_star_board').getBoundingClientRect().top < 0) { window.location.hash = ''; window.location.hash = '#fa_star_board'; }
// update variables forum = $(fa_starred.select.forum + '[href^="/f' + id + '-"]')[0]; // original forum catg = $(forum).closest(fa_starred.select.category)[0]; // original category
$(forum).closest(fa_starred.select.row)[0].style.display = ''; // show the original forum's row
// show the category if all forums were hidden if (/fa_star_hidden/.test(catg.className)) { catg.className = catg.className.replace(/fa_star_hidden/, ''); }
// delete the starred forum and check if there are anymore stars delete fa_starred.forums[id]; for (j in fa_starred.forums) { if (fa_starred.forums[j]) i++; }
// general startup var a = $(fa_starred.select.forum, fa_starred.select.content), i = 0, j = a.length, k, id;
// setup star board and reset forum states if starred if (fa_starred.forums) { if (!fa_starred.board) fa_starred.createStarBoard(); for (k in fa_starred.forums) { fa_starred.forums[k] = 0; } }
// setup stars and starred forums for (; i < j; i++) { id = a[i].href.replace(/.*?\/f(\d+).*/, '$1');
$(function() { if (/\/c\d+-/.test(window.location.href)) return; // return if category
// automatically detects the version var version = $('.bodylinewidth')[0] ? 0 : document.getElementById('wrap') ? 1 : $('div.pun')[0] ? 2 : document.getElementById('ipbwrapper') ? 3 : document.getElementById('fa_edge') ? 4 : 'badapple';
// error notifications if (version == 'badapple' || !window.JSON || !window.localStorage) { var errString = 'The plugin "fa_starred" could not be executed because : ';
if (version == 'badapple') errString += '\nYour forum version is not supported.'; if (!window.JSON) errString += '\nJSON is not supported by your browser'; if (!window.localStorage) errString += '\nThe Storage API is not support by your browser.';
// get fontawesome if unavailable if (!$('link[href$="font-awesome.min.css"]')[0]) { document.getElementsByTagName('HEAD')[0].insertAdjacentHTML('beforeend', '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css" />'); }
window.fa_starred = { version : version, // forum version forums : localStorage.fa_starred_forums ? JSON.parse(localStorage.fa_starred_forums) : null,
// language settings lang : { star : 'Star this forum', unstar : 'Unstar this forum', starred : 'Starred Forums' },
// move the selected forum to the "starred" category star : function(that, id, startup) { if (!fa_starred.forums) fa_starred.forums = {}; if (!fa_starred.board) fa_starred.createStarBoard();
if (!fa_starred.forums[id]) { // clone the row and add it to the star board var clone = $(that).closest(fa_starred.select.row)[0].cloneNode(true), rows = $(that).closest(fa_starred.select.row).parent().find(fa_starred.select.row);
// update the star attributes for the clone $('.fa_star', clone).attr({ 'onclick' : 'fa_starred.unstar(this, ' + id + '); return false', 'class' : 'fa_unstar', 'title' : fa_starred.lang.unstar }).html('<i class="fa">' + fa_starred.icon.unstar + '</i>');
fa_starred.list.appendChild(clone); // append the clone to the starred category
$(that).closest(fa_starred.select.row)[0].style.display = 'none'; // hide the original row
// check if all forums are hidden for this category for (var i = 0, j = rows.length, k = 0; i < j; i++) { if (/none/.test(rows[i].style.display)) k++; }
// hide the category if all forums are hidden if (i == k) { $(that).closest(fa_starred.select.category)[0].className += ' fa_star_hidden'; }
// jump to the star board if it's out of sight if (!startup && document.getElementById('fa_star_board').getBoundingClientRect().top < 0) { window.location.hash = ''; window.location.hash = '#fa_star_board'; }
// update variables forum = $(fa_starred.select.forum + '[href^="/f' + id + '-"]')[0]; // original forum catg = $(forum).closest(fa_starred.select.category)[0]; // original category
$(forum).closest(fa_starred.select.row)[0].style.display = ''; // show the original forum's row
// show the category if all forums were hidden if (/fa_star_hidden/.test(catg.className)) { catg.className = catg.className.replace(/fa_star_hidden/, ''); }
// delete the starred forum and check if there are anymore stars delete fa_starred.forums[id]; for (j in fa_starred.forums) { if (fa_starred.forums[j]) i++; }
// general startup var a = $(fa_starred.select.forum, fa_starred.select.content), i = 0, j = a.length, k, id;
// setup star board and reset forum states if starred if (fa_starred.forums) { if (!fa_starred.board) fa_starred.createStarBoard(); for (k in fa_starred.forums) { fa_starred.forums[k] = 0; } }
// setup stars and starred forums for (; i < j; i++) { id = a[i].href.replace(/.*?\/f(\d+).*/, '$1');
اهلا اخي المبدع تصميم الفئات لمنتداك غير ملائم لكود قسمي المفضل ولا لكود تبويبات الاقسام وحتى لو يعمل لن يكون معروف بسبب طريقة التصميم المستخدمة بمنتداك
ولهذا لا انصحك بتركيب كود قسمي المفضل ولا كود تبويبات الاقسام