collapse

* User Info

 
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

* Who's Online

  • Dot Guests: 74
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • BCNPalomino: lol, that search doe :O
    July 18, 2014, 09:26:27 AM
  • RohailPro23: hi all
    July 18, 2014, 08:09:00 AM
  • samborabora: sorry, thought this was search, lol
    June 29, 2014, 04:45:12 AM
  • samborabora: sp_embed_image
    June 29, 2014, 04:45:01 AM
  • stanyy: Was it merely correcting the mistake made in 2.0.7 or is 2.0.8 actually faster than 2.0.6?
    June 20, 2014, 07:51:21 AM
  • AngelinaBelle: Smf 2.0.8 has been released. -- uses less memory than 2.0.7 [link]
    June 19, 2014, 03:46:47 PM
  • iSamp: [link]
    June 14, 2014, 06:42:38 AM
  • iSamp: SiNaN Plz Help
    June 14, 2014, 06:42:12 AM
  • iSamp: I need Help Plz Help Me I posted a Thing In English Support Plz read it
    June 14, 2014, 06:21:15 AM
  • Cyberkid: hey!
    June 12, 2014, 02:29:42 AM
  • AngelinaBelle: Hello!
    June 03, 2014, 01:06:04 PM
  • kal: also, hello. :)
    June 03, 2014, 08:36:43 AM
  • kal: I haven't been here in a couple months I don't think.
    June 03, 2014, 08:36:35 AM
  • AngelinaBelle: Welcome back, David
    June 02, 2014, 06:18:46 AM
  • David: I've missed this place!
    June 02, 2014, 01:04:01 AM

* Team Blog

* Recent Posts

How can we contribute to Simple Portal? by processor
[Today at 05:25:46 AM]


Re: Letra na shoutbox by kanlanazz
[Yesterday at 10:07:00 PM]


Re: Re-Installation issues by kanlanazz
[Yesterday at 10:06:29 PM]


Re: Home Theme not working by phasitboon
[Yesterday at 09:53:58 PM]


Re: Editing shouts via the database by phasitboon
[Yesterday at 09:53:03 PM]

Blocks speak! Do you have an interest in getting more blocks - or even making your own? The Blocks Board is for you!

Author Topic: Changing forum title if there is new shout  (Read 1711 times)

0 Members and 1 Guest are viewing this topic.

Offline phantomm

  • Translator
  • *
  • Posts: 362
  • Gender: Male
  • Smile, tomorrow will be worse...
    • Polish ElkArte community
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Changing forum title if there is new shout
« on: February 28, 2013, 09:18:03 AM »
Hi, so I've been trying to make something like this:

If there is new shout in SP Shoutbox forum title would be changed to "New shout!", but when you visit tab/window with this shourbox it should be changed to default forum title.

I know how and where* use document.title = 'New shout!';. Problem is how to reset forum title to default after visiting page, without need to refresh whole page?

* - you need to add document.title before this code in portal.js
Code: [Select]
}

setInnerHTML(document.getElementById('shouts_' + shoutbox_id), new_body);
« Last Edit: February 28, 2013, 09:20:31 AM by phantomm »

Offline Underdog

  • Support
  • *
  • Posts: 772
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: Changing forum title if there is new shout
« Reply #1 on: February 28, 2013, 10:32:27 AM »
phantomm,

  Imo use DOM or javascript.

Here it is using javascript:
Code: [Select]
echo '<script type="text/javascript">
    document.title = "New Page Title";
  </script>';


Offline phantomm

  • Translator
  • *
  • Posts: 362
  • Gender: Male
  • Smile, tomorrow will be worse...
    • Polish ElkArte community
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Changing forum title if there is new shout
« Reply #2 on: February 28, 2013, 12:01:50 PM »
Thanks for repy, but this code will change title right after page will be loaded.
What I need to have here is JS to set specified forum title when user will go to already open tab.

Offline Underdog

  • Support
  • *
  • Posts: 772
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: Changing forum title if there is new shout
« Reply #3 on: March 04, 2013, 01:49:42 AM »
Thanks for repy, but this code will change title right after page will be loaded.
What I need to have here is JS to set specified forum title when user will go to already open tab.

phantomm,

  My apologies for the late reply as I am working on a project as of late.
I have not tested it but you put what I posted in a js function & have it execute the function when the shout button or ie. onkeydown keycode 13 (return/enter) is executed if I understand you correctly.

Code: [Select]
echo '<script type="text/javascript">
onLoad = function changeTitle() {
    document.title = "New Page Title";
}
  </script>';
.. then in the js for what I mentioned prior you execute changeTitle()