- Code:
$(function() {
var style = document.createElement("style"),
oCat = $('#main-content .forabg'),
oThis = null;
style.type = "text/css";
style.innerHTML =
'div.forabg .contract, div.forabg .expand {' +
' background: url("http://2img.net/i/fa/invision/exp_minus.gif") no-repeat scroll 50% 50% rgba(0, 0, 0, 0);' +
' cursor: pointer;' +
' float: right;' +
'}' +
'div.forabg .expand {' +
' background: url("http://2img.net/i/fa/invision/exp_plus.gif") no-repeat scroll 50% 50% rgba(0, 0, 0, 0);' +
'}';
document.getElementsByTagName("head")[0].appendChild(style);
for (var i = 0, len = oCat.length; i < len; i++) {
oThis = $(oCat[i]);
oThis.find('ul.topiclist:first dl.icon')
.append('<div onclick="toggleCategory(\'c' + i + '\');" id="bc' + i + '" class="contract"> </div>');
oThis.find('ul.topiclist.forums').attr('id', 'c' + i);
}
});
// by invision.js
function initCategories() {
var id;
cookies = document.cookie.split('; ');
for (var i = 0; i < cookies.length; i++) {
if (cookies[i].charAt(0) == '_') {
cookie = cookies[i].split('=');
if (cookie[1] == '1') {
id = cookie[0].substring(1);
if (document.getElementById(id)) {
toggleCategory(id)
}
}
}
}
}
// by invision.js
function toggleCategory(id) {
var obj = document.getElementById(id);
var button = document.getElementById('b' + id);
var toggle = obj.style.display == 'none';
obj.style.display = toggle ? '' : 'none';
button.className = toggle ? 'contract' : 'expand';
my_setcookie('_' + id, toggle ? '' : '1', true);
return false
}
initCategories();
3 posters
Category Toggle - No Appearance
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
- Post n°1
Category Toggle - No Appearance
SLGray- Administrator
- Posts : 51498
Reputation : 3523
Language : English
Location : United States
- Post n°2
Re: Category Toggle - No Appearance
Where did you get this code?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
- Post n°3
Re: Category Toggle - No Appearance
SLGray- Administrator
- Posts : 51498
Reputation : 3523
Language : English
Location : United States
- Post n°4
Re: Category Toggle - No Appearance
Is your forum version: phpBB 3? Also did you use this code: https://help.forumotion.com/t139656-categories-hide-show#950025 ?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
- Post n°5
Re: Category Toggle - No Appearance
Yes and yes.
SLGray- Administrator
- Posts : 51498
Reputation : 3523
Language : English
Location : United States
- Post n°6
Re: Category Toggle - No Appearance
Do you have the codes installed now?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
- Post n°7
Re: Category Toggle - No Appearance
Deleted it earlier but just added it back now.
SLGray- Administrator
- Posts : 51498
Reputation : 3523
Language : English
Location : United States
- Post n°8
Re: Category Toggle - No Appearance
Do you have other JavaScripts?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
- Post n°9
Re: Category Toggle - No Appearance
Yes I do.
Ange Tuteur- Forumaster
- Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania
- Post n°10
Re: Category Toggle - No Appearance
@Forumedic,
Try using the following for phpbb3 instead.
Go to Modules > JS codes management > New
Placement : In all the pages
FYI if you want to change the icon HTML replace the following :
Minus :
Plus :
They're using FontAwesome, so if you're not using that I suggest replacing the icons.
Lastly, add this to your CSS stylesheet :
Try using the following for phpbb3 instead.
Go to Modules > JS codes management > New
Placement : In all the pages
- Code:
$(function() {
if (_userdata.page_desktop) return;
// start up variables
var a = $('.forabg'), i = 0, j = a.length, button, list, dd;
for (; i < j; i++) {
// create and get the needed elements
list = a[i].getElementsByTagName('UL'); // header[0] and category[1]
button = document.createElement('A'); // toggler
dd = document.createElement('DD'); // toggler container
button.innerHTML = '';
button.href = '#';
button.className = 'fa fa_toggle';
button.id = 'fa_toggle-' + i;
list[1].id = 'fa_catg-' + i;
// if the category is hidden in the cookie, we'll change the image and hide it
if (my_getcookie('fa_catg-' + i) == 'hidden') {
button.innerHTML = '';
list[1].style.display = 'none';
}
// yummy toggle logic
button.onclick = function() {
// get the current id number and category for manipulation
var id = this.id.replace(/.*?(\d+)/, '$1'), catg = document.getElementById('fa_catg-' + id);
// if the category is hidden, we'll update the cookie and show it
// the else statement does the opposite ;)
if (/none/.test(catg.style.display)) {
this.innerHTML = '';
catg.style.display = 'block';
my_setcookie('fa_catg-' + id, 'shown');
} else {
this.innerHTML = '';
catg.style.display = 'none';
my_setcookie('fa_catg-' + id, 'hidden');
}
return false;
};
dd.appendChild(button); // add the button to its container
list[0].firstChild.firstChild.appendChild(dd); // and finally add it to the category header
}
'par ange tuteur';
});
FYI if you want to change the icon HTML replace the following :
Minus :
|
Plus :
|
They're using FontAwesome, so if you're not using that I suggest replacing the icons.
Lastly, add this to your CSS stylesheet :
- Code:
a.fa_toggle {
color:#39C;
font-size:10px;
background:#FFF;
border-radius:20px;
display:inline-block;
line-height:20px;
height:20px;
width:20px;
text-align:center;
position:absolute;
margin-top:-5px;
}
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
- Post n°11
Re: Category Toggle - No Appearance
I added it and then CSS and it said "Error..." It also ruined my login widget thing on index that is like Forumotion. Now says "undefined"
Ange Tuteur- Forumaster
- Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania
- Post n°12
Re: Category Toggle - No Appearance
What's the URL of the forum ?
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
- Post n°13
Re: Category Toggle - No Appearance
It's in my profile, www.clashmune.forumotion.com
Ange Tuteur- Forumaster
- Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania
- Post n°14
Re: Category Toggle - No Appearance
I'm getting an error from this script which is enabled in all the pages :
- Code:
$(function() {
var CopyrightNotice = 'Quick Quote in Quick Reply for forumotion boards. Copyright © by AvacWeb. All Rights Reserved. Use and modification of this script is not allowed without this entire copyright notice in the original, copied, or modified script. No distribution without consent.';
for (var quote = $('.i_icon_quote'), i = 0, qr = document.getElementById('quick_reply'), q, t = qr.offsetTop - 200; (q = quote[i++]) ; ) {
$(q.parentNode).click(function(e) {
e.preventDefault();
var selection = (function() {
if (window.getSelection) {
var e = document.activeElement;
return (e && e.tagName.toLowerCase() in {
textarea: 1,
input: 1
}) ? e.value.substring(e.selectionStart, e.selectionEnd) : window.getSelection().toString()
} else if (document.selection.createRange) {
return (document.selection.createRange()).text || ''
}
return null
})()
, sc = $("#text_editor_textarea").sceditor("instance");
if (selection && selection.length)
return sc.insert('[quote]' + selection + '[/quote]');
var div = document.createElement('div')
, s = setInterval(function() {
document.body.scrollTop < t ? document.body.scrollTop += 10 : clearInterval(s)
}, 5);
$(div).load(this.href + ' #text_editor_textarea', function() {
sc.insert(div.getElementsByTagName('textarea')[0].value)
})
})
}
});
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
- Post n°15
Re: Category Toggle - No Appearance
Will try this soon, haven't got to it yet.