collapse

* User Info

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

* Who's Online

  • Dot Guests: 59
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • oNLy1: thought the 'Blocks In Blocks' was going to be complicated - easy peasy - and was exactly what my site needed - ty
    September 20, 2014, 01:13:44 PM
  • P flex: Xup guys
    September 18, 2014, 08:29:06 AM
  • P flex: Xup
    September 18, 2014, 08:28:38 AM
  • Mstcool: :p *
    September 13, 2014, 07:55:49 PM
  • Mstcool: so when is a new version coming out? :o
    September 13, 2014, 07:55:45 PM
  • USFA: sorry thought was search no glasses
    September 06, 2014, 08:48:23 PM
  • USFA: rename forum
    September 06, 2014, 08:47:40 PM
  • Mstcool: Oh, ok, Sinan
    August 25, 2014, 10:19:15 PM
  • ArsenArsen: When i make them
    August 19, 2014, 12:20:20 AM
  • ArsenArsen: I had some mod ideas, i will put them.
    August 19, 2014, 12:19:45 AM
  • [SiNaN]: We could, but it's there as a reminder of some kind, that we should fill it in, somehow.
    August 18, 2014, 09:57:14 PM
  • Mstcool: Y don't u guys remove the customization section since it has no files?
    August 17, 2014, 10:27:28 PM
  • ArsenArsen: Ok, Great!
    August 15, 2014, 03:13:18 PM
  • [SiNaN]: We have the translators' names listed in the downloads area.
    August 15, 2014, 03:05:39 PM
  • ArsenArsen: Never Mind, i wont, noone did.
    August 15, 2014, 02:22:32 PM
  • ArsenArsen: Can i put mz name on translation
    August 15, 2014, 02:21:06 PM
  • [SiNaN]: You can only change your forum profile options once you have 5 posts. I have made an exception for Translator group though, so you should be able to do it now.
    August 13, 2014, 03:32:17 PM
  • ArsenArsen: Cant find where to change avatar
    August 13, 2014, 03:12:38 PM
  • ArsenArsen: Ok
    August 11, 2014, 05:17:55 AM
  • Underdog: there is a documentation link on your top-right
    August 10, 2014, 08:48:45 PM

* Team Blog

* Recent Posts

Installation errors? Mod incompatibilities? Upgrade problems? Make your way over to the Install and Upgrade Support board for all your solutions!

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

0 Members and 1 Guest are viewing this topic.

Offline phantomm

  • Support
  • *
  • Posts: 384
  • 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: 808
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.8
  • 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

  • Support
  • *
  • Posts: 384
  • 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: 808
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.8
  • 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()