The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

JavaScript problem!

View previous topic View next topic Go down

Solved JavaScript problem!

Post by udarsha45 on October 17th 2016, 4:39 pm

I tried to add this code, which is located on this site; http://www.punbb.biz/t331-javascript-ipb-sticky-announce-global-announce-style

However the desired results are not appearing for some reason.

Please do help.


Last edited by udarsha45 on October 18th 2016, 4:27 am; edited 1 time in total

udarsha45
Forumember

Male Posts : 479
Reputation : 2
Language : English
Location : Sri Lanka

http://bleach.5forum.net

Back to top Go down

Solved Re: JavaScript problem!

Post by Ch@lo Valdez on October 17th 2016, 4:59 pm

please post your url forum

Ch@lo Valdez
Forumember

Male Posts : 100
Reputation : 31
Language : spanish

Back to top Go down

Solved Re: JavaScript problem!

Post by udarsha45 on October 17th 2016, 5:21 pm

@Ch@lo Valdez wrote:please post your url forum


Here; http://www.bleachstory.net

udarsha45
Forumember

Male Posts : 479
Reputation : 2
Language : English
Location : Sri Lanka

http://bleach.5forum.net

Back to top Go down

Solved Re: JavaScript problem!

Post by Ch@lo Valdez on October 17th 2016, 6:11 pm

try

Code:

function ann_replace() {
    console.log('//----- Written by Chalo - Open Source 2014-2016 -----//');
    console.log('//--------- http://www.opensourcephpbb3.com ----------//');
    console.log('//------------------- Version: 1.0 -------------------//');
    console.log('//------------------- All version --------------------//');
    var e, a = document.getElementsByTagName('strong'),
        b = 'Global announcement', //<---change it with your custom titles
        c = 'Sticky', //<---change it with your custom titles
        d = 'Announcement', //<---change it with your custom titles
        f = 'Poll',//<---change it with your custom titles
        g = '</span>',
        h = document.createElement('style');
    for (var i = 0; i < a.length; i++) e = a[i], e.innerHTML.match(/(Global announcement)/g) ? e.innerHTML = '<span class="g_a">' + b + g : e.innerHTML.match(/(Sticky)/g) ? e.innerHTML = '<span class="s_a">' + c + g : e.innerHTML.match(/(Announcement)/g) ? e.innerHTML = '<span class="a_a">' + d + g : e.innerHTML.match(/(Poll)/g) && (e.innerHTML = '<span class="p_a">' + f + g);
    h.innerHTML = '.g_a,.s_a,.a_a,.p_a{color:#fff;background:url("http://i57.servimg.com/u/f57/17/68/86/50/stk1010.png")repeat-x0-1px;border-radius:2px;display:inline-block;font-size:9px;font-weight:bold;height:16px;line-height:16px;padding:0 5px;text-shadow:0-1px0rgba(0,0,0,0.2);text-transform:uppercase;vertical-align:middle}.g_a{background-color:#FF4000;}.s_a{background-color:#3693d3;}.a_a{background-color:#ffa500;}.p_a{background-color:pink}';
    document.head.appendChild(h)
};
$(document).ready(function ($) {
    /\/f(\d+).+/g.test(window.location.href) && ann_replace()
});


Ch@lo Valdez
Forumember

Male Posts : 100
Reputation : 31
Language : spanish

Back to top Go down

Solved Re: JavaScript problem!

Post by udarsha45 on October 18th 2016, 4:26 am

@Ch@lo Valdez wrote:try

Code:

function ann_replace() {
    console.log('//----- Written by Chalo - Open Source 2014-2016 -----//');
    console.log('//--------- http://www.opensourcephpbb3.com ----------//');
    console.log('//------------------- Version: 1.0 -------------------//');
    console.log('//------------------- All version --------------------//');
    var e, a = document.getElementsByTagName('strong'),
        b = 'Global announcement', //<---change it with your custom titles
        c = 'Sticky', //<---change it with your custom titles
        d = 'Announcement', //<---change it with your custom titles
        f = 'Poll',//<---change it with your custom titles
        g = '</span>',
        h = document.createElement('style');
    for (var i = 0; i < a.length; i++) e = a[i], e.innerHTML.match(/(Global announcement)/g) ? e.innerHTML = '<span class="g_a">' + b + g : e.innerHTML.match(/(Sticky)/g) ? e.innerHTML = '<span class="s_a">' + c + g : e.innerHTML.match(/(Announcement)/g) ? e.innerHTML = '<span class="a_a">' + d + g : e.innerHTML.match(/(Poll)/g) && (e.innerHTML = '<span class="p_a">' + f + g);
    h.innerHTML = '.g_a,.s_a,.a_a,.p_a{color:#fff;background:url("http://i57.servimg.com/u/f57/17/68/86/50/stk1010.png")repeat-x0-1px;border-radius:2px;display:inline-block;font-size:9px;font-weight:bold;height:16px;line-height:16px;padding:0 5px;text-shadow:0-1px0rgba(0,0,0,0.2);text-transform:uppercase;vertical-align:middle}.g_a{background-color:#FF4000;}.s_a{background-color:#3693d3;}.a_a{background-color:#ffa500;}.p_a{background-color:pink}';
    document.head.appendChild(h)
};
$(document).ready(function ($) {
    /\/f(\d+).+/g.test(window.location.href) && ann_replace()
});


It's working!

Thanks a lot mate!

udarsha45
Forumember

Male Posts : 479
Reputation : 2
Language : English
Location : Sri Lanka

http://bleach.5forum.net

Back to top Go down

Solved Re: JavaScript problem!

Post by brandon_g on October 20th 2016, 4:45 pm

Thanks for the help @Ch@lo Valdez . Very Happy

Topic solved and archived ~ brandon_g
Please read our forum rules: ESF General Rules


Remember to mark your topic when a solution is found.

brandon_g
Support Moderator
Support Moderator

Male Posts : 5359
Reputation : 489
Language : English
Location : USA

http://broadcastingduo.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum