TinyPortal

Development => Support => Topic started by: lyer on July 27, 2009, 06:03:43 AM

Title: javascript on portal block
Post by: lyer on July 27, 2009, 06:03:43 AM
smf 1.1.9
tinyportal v1.0 beta 4

I use this code in the <head>

<script type="text/javascript">
<!--
var newwindow;
function poptastic(url)
{
  newwindow=window.open(url,'name','height=400,width=200');
  if (window.focus) {newwindow.focus()}
}
// -->
</script>


i put this in tinyportal block in right panel using HTML & Javascript code

<a href="javascript:poptastic('poppedexample.html');">Pop it</a>

tinyportal block doesnt call this code..what is the caus of the problem?
Title: Re: javascript on portal block
Post by: Zetan on July 27, 2009, 08:37:27 AM
Looks like you are trying to use some sort of Popup window?

Have a look here:
http://www.tinyportal.net/index.php?topic=29849.0

It might do what you need, or you might get an idea of whats wrong with the one you want to use.
Title: Re: javascript on portal block
Post by: lyer on July 27, 2009, 08:55:02 AM
Quote from: Zetan on July 27, 2009, 08:37:27 AM
Looks like you are trying to use some sort of Popup window?

Have a look here:
http://www.tinyportal.net/index.php?topic=29849.0

It might do what you need, or you might get an idea of whats wrong with the one you want to use.

thanks for replying zetan.

i can't still get...

i put this code in my <head>

<script type="text/javascript">
  <!--
  var newwindow;
  function poptastic(url)
  {
     newwindow=window.open(\'http://test/index.html,\'Radio\',\'height=620,width=500\');
     if (window.focus) {newwindow.focus()}
  }
  // -->
  </script>


and I put this code in a portal block using a HTML & Javascript code

<a href="javascript:poptastic('http://test/index.html')">Launch Popup Window</a>

the problem is the popup window doesn't work, can you please check if there's something wrong with my code?
Title: Re: javascript on portal block
Post by: Zetan on July 27, 2009, 09:57:16 AM
I know, I read it the first time.

What theme are you adding the script to?

Popup's can be really tempermental and finiky. Without playing with the code, which I can't do right now... I have no idea what the problem might be. Try mine, it should do the same as what you need, and it works.
Title: Re: javascript on portal block
Post by: lyer on July 27, 2009, 09:59:15 AM
Quote from: Zetan on July 27, 2009, 09:57:16 AM
I know, I read it the first time.

What theme are you adding the script to?

Popup's can be really tempermental and finiky. Without playing with the code, which I can't do right now... I have no idea what the problem might be. Try mine, it should do the same as what you need, and it works.

I use Megapolis by cer. thanks for keep on replying zetan
Title: Re: javascript on portal block
Post by: Zetan on July 27, 2009, 10:01:28 AM
Well, I suggest trying my popup. It needs nothing added to any theme, you just create a file and then make a call from a block or article.. or menu button.
Title: Re: javascript on portal block
Post by: ZarPrime on July 27, 2009, 02:10:06 PM
Quote from: lyer on July 27, 2009, 06:03:43 AM
I use this code in the <head>

lyer,

Zetans popup block works fine.  I know because I've tried it before.  You'r works as well, but I don't understand what you mean by you use the code in the <head>.  Do you mean you stick it in your index.php somehow?

In any case, your code works fine as well.  You can see it on my test site in a block at the top of the left panel here (click "Brown Dwarf") ...
http://talesofthehavenexpanse.com/smf1test/index.php

Instead of putting the script in the <head> somewhere, put it right in your block.  That's what I did with your code on my test site and it works just fine.  I changed the parameters for the width and height, and of course the url of the picture, but it works fine.  Here's your code that I used, in an HTML and Javascript block ...
<script type="text/javascript">
<!--
var newwindow;
function poptastic(url)
{
   newwindow=window.open(url,'name','height=600,width=800');
   if (window.focus) {newwindow.focus()}
}
// -->
</script>
<a href="javascript:poptastic('http://talesofthehavenexpanse.com/rsoph_pparc.jpg');">Brown Dwarf</a>


ZarPrime
Title: Re: javascript on portal block
Post by: mc on July 27, 2009, 04:59:46 PM
Quote from: ZarPrime on July 27, 2009, 02:10:06 PM
Quote from: lyer on July 27, 2009, 06:03:43 AM
I use this code in the <head>

lyer,

Zetans popup block works fine.  I know because I've tried it before.  You'r works as well, but I don't understand what you mean by you use the code in the <head>.  Do you mean you stick it in your index.php somehow?

Could be they're using additional <head> tags in the block?
If they were, then that could cause the javascript to fail.
Title: Re: javascript on portal block
Post by: ZarPrime on July 27, 2009, 05:20:58 PM
Correct.  Using head tags and body tags in the block are a no-no, and not necessary.

ZP
Title: Re: javascript on portal block
Post by: lyer on July 28, 2009, 03:31:11 AM
Quote from: ZarPrime on July 27, 2009, 05:20:58 PM
Correct.  Using head tags and body tags in the block are a no-no, and not necessary.

ZP

Thanks for replying ZP...

I use the code that you give and replacing my own url but still no luck.

please check the code I use if there's something wrong.


<script type="text/javascript">
<!--
var newwindow;
function poptastic(url)
{
  newwindow=window.open('http://Your_Site.net/Radio/Mp3Stream/index.html,'Radio','height=600,width=800');
  if (window.focus) {newwindow.focus()}
}
// -->
</script>
<a href="javascript:poptastic('http://Your_Site.net/Radio/Mp3Stream/index.html');">Brown Dwarf</a>


thanks...
Title: Re: javascript on portal block
Post by: ZarPrime on July 28, 2009, 01:16:44 PM
lyer,

Sorry, I had to sleep for a few hours.  You don't have to put the url and the name in the script itself, only in the link at the bottom.  Here's the code ...

<script type="text/javascript">
<!--
var newwindow;
function poptastic(url)
{
  newwindow=window.open(url,'name','height=600,width=800');
  if (window.focus) {newwindow.focus()}
}
// -->
</script>
<a href="javascript:poptastic('http://Your_Site.net/Radio/Mp3Stream/index.html');">Radio</a>


LMK when you have it, as I'm going to change the link.

ZarPrime
Title: Re: javascript on portal block
Post by: lyer on July 29, 2009, 09:06:43 AM
WOW thanks ZarPrime, your a genius...thank you so much
Title: Re: javascript on portal block
Post by: ZarPrime on July 29, 2009, 10:55:06 AM
@ lyer, NP.  Glad it works for you.  Marked solved. :up:

ZarPrime