Menu button to open popup window v2.09

Started by Jaknet, April 18, 2015, 11:16:07 PM

Previous topic - Next topic

Jaknet

Hi

I'm very sorry if this has been asked already, I've spent the last 2 1/2 days searching for a way to do this and apart from finding loads of methods for older versions I was unable to find anything that works with 2.09 and the subs.php, or more to the point anything that I can get working. My biggest problem is that while I'm a qualified Cobol programmer and experienced in various other "vintage" languages, I've very little experience with modern languages and working with .php is something that I'd never touched until 3 days ago  ???

Using the wiki I've got a button for the hxxp:blueimp.net [nonactive] ajax chat working and opening in a new tab, but I'm trying to get it to open in a popup window that the user can drag where they want and resize to suit themselves with the window content resizing to fit, very much the same as the help buttons open into a new, resizeable window. Is this possible ?

Here is my current code I've added to the subs.php which gives me the button between messages and members.

'Chat' => array(
            'title' => $txt['new_button'],
            'target' => '_blank',
            'href' => '/testsmf/chat/',
            'show' => true,
            'sub_buttons' => array(
               ),
            ),


Many thanks for any help.

margarett

Hi.

Sorry but your post was unapproved because, well, you posted in a moderated board :P

As for your question, this should help you
http://www.simplemachines.org/community/index.php?topic=451488.0
;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Jaknet

Thank you ever so much, sorry for the mistake with the boards, good start, not

Sir Osis of Liver



'uploader' => array(
'title' => 'Uploader',
'href' => 'javascript:window.open(\'http://www.domain.com/upload.htm\',\'popup_uploader\',\'height=460,width=620,top=120,left=200,scrollbars=yes\');void(0);',
'show' => !$user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),



Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Jaknet

Krash, you are an absolute hero... Thank you.  ;D

I came to ask for more help as with my limited know how I could not get the void to work where ever I stuck it, and here is the answer ready to paste straight in, wonderful.

I did still have a lot of problems with the address to the chat client (Ajax chat by hxxp:blueimp.net [nonactive]) as their instructions are to just link to the folder and not to the index file. so while the actual address is this

http://thegrimcompendium.co.uk/testsmf/chat/index.php

I have to use this for it to work correctly

http://thegrimcompendium.co.uk/testsmf/chat/

No matter how I tried I could not get the window to open the address, it was either 404 or forbidden, getting desperate I removed the .htm and suddenly everything works perfectly. I've just no idea how or why, it just does  ;)

This is what is working for me now.

(\'http://thegrimcompendium.co.uk/testsmf/chat/\',\'popup_uploader...etc

I thought it was worth posting this so if anyone else is using the same chat client this seems to work for the address. Also to check that I haven't done anything that will cause later problems with this.

Thank you again for your time and help with this margarett and Krash.

Jaknet

Just when I thought everything was working the first comment I get is "this has broken my middle click on this button...rant..rant"

Apart from wanting to kill some members is there anything code wise I can do to try to change/fix this.

Cheers, yet again

Sir Osis of Liver

What are they trying to do with middle (scrollbutton?) click?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Jaknet

From what I can gather yes, and complaining that it opens a new blank tab with this in the address bar

javascript:window.open('http://thegrimcompendium.co.uk/forum/chat/','popup_uploader','height=460,width=620,top=120,left=200,scrollbars=yes');void(0);

Sir Osis of Liver

Not seeing the problem.  Chat opens correctly in either popup or new tab.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Jaknet

It could be because I'm using firefox and if I middle click I get the same blank new tab and the popup blocker message comes up saying it has blocked the popup, but I get an option to whitelist the site, I'm not sure what browser he's using, I think it was chrome last time he said.

If it is just that I'll try to explain that to him, but he's a young lad just finishing school and thinks he's the world expert on coding and is never wrong  ::)

Sir Osis of Liver

Popup blocker shouldn't block it because it's user requested, you have to click on a button to launch it.  I'm looking at it in IE11 with blocker enabled, and it works fine.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Jaknet

Weird, in firefox current 37.0.2 if I middle click I get a new blank tab with the javascript in the address bar tab with a message about firefox blocking a popup.

Still it works otherwise, so unless you have any ideas to hand I feel rude wasting your time on this.

If it makes any difference I changed the code to include a drop down menu so the current code for the chat button is this and middle clicking either of the java links gives the blank new tab and the new_tab works fine on a middle click


'chat' => array(
'title' => $txt['chat_main_button'],
'href' => 'javascript:window.open(\'http://thegrimcompendium.co.uk/forum/chat/\',\'popup_uploader\',\'height=460,width=620,top=120,left=200,scrollbars=yes\');void(0);',
'show' => true,
'sub_buttons' => array(
'chat_popup' => array(
'title' => $txt['chat_popup_button'],
'href' => 'javascript:window.open(\'http://thegrimcompendium.co.uk/forum/chat/\',\'popup_uploader\',\'height=460,width=620,top=120,left=200,scrollbars=yes\');void(0);',
'show' => true,
),
'chat_tab' => array(
'title' => $txt['chat_tab_button'],
'target' => '_blank',
'href' => '/forum/chat',
'show' => true,
'is_last' => true,
),
),
),


Illori

you cant open a new tab for a javascript link like that. it just will not work as you are seeing.

Kindred

javascript are not real "links" -- so you can not tell your browser to open it in a new window...

javascript is completely defined by the script itself and will ignore a user's attempt to override the script settings.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Jaknet

Thank you everyone for your time and help, it's been much appreciated.

Advertisement: