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.

change the <iframe></iframe> with BBCode

View previous topic View next topic Go down

In progress change the <iframe></iframe> with BBCode

Post by erchima on May 21st 2014, 8:14 am

how to make iframe with BBCode?

erchima
Forumember

Female Posts : 629
Reputation : 15
Language : INDONESIAN | Lua Script | Visual Basic | and Coding
Location : Under your bed xD

http://erchimacute.forumid.net

Back to top Go down

In progress Re: change the <iframe></iframe> with BBCode

Post by Ange Tuteur on May 21st 2014, 9:21 pm

Hello erchima,

You could probably write a small bit of javascript to convert your bbcode in posts to HTML.

For example :

Write
Code:
[iframe src="/myurl"][/iframe]

This will just display as plain text since we have nothing to parse the bbcode server side.

We can add a small script :
Modules > javascript codes management > create a new script

Title : your choice
Placement : either in the topics or in all pages
Paste the code below and submit :
Code:
$(function() {
  var frameHeight = 250;
  var frameWidth = 500;
  var d = document.getElementsByTagName('DIV');
  for (i = 0; i < d.length; i++) {
  if (d[i].className == 'postbody') {
  if (/\[iframe src="(.*?)"\]\[\/iframe\]/.test(d[i].innerHTML)) {
  d[i].innerHTML = d[i].innerHTML.replace(/\[iframe src="(.*?)"\]\[\/iframe\]/ig,'<iframe src="$1" height="'+frameHeight+'" width="'+frameWidth+'"></iframe>');
  }
  }
  }
});

frameHeight and frameWidth are the dimensions of the iframe. Change these in the script to the size of your choice.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

In progress Re: change the <iframe></iframe> with BBCode

Post by erchima on May 23rd 2014, 1:14 pm

thank you very muchkisskisskiss

erchima
Forumember

Female Posts : 629
Reputation : 15
Language : INDONESIAN | Lua Script | Visual Basic | and Coding
Location : Under your bed xD

http://erchimacute.forumid.net

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