Community Forum

User info

Welcome, Guest! Please login or register.


You are here » Community Forum » New Forum Features » Requests for Scripts


Requests for Scripts

Posts 31 to 45 of 45

31

All Working, thank you

0

32

kami
You can get the exact selectors via developer tools (right-click on a page element and select Inspect element), for example:
http://sm.uploads.im/lDBj0.png
(Click to view the full-size image)

0

33

I want to display some ad script in the footer of all pages, except in the Register.php and Login.Php.
is there  html / js code that i can use to implement ..?

Last edited by kami (2017-12-28 23:21:19)

0

34

kami
Hello  :flag:
Do you still need it? I can try to make it.

0

35

C3La-NS wrote:

Do you still need it? I can try to make it.

YES, I do,,, i still need it.... Thank You Very Much

0

36

kami
rough but working

<script>
    (function() {
        var countup = this;
        var ads = document.createElement('div');
        ads.className = 'my_ads';
        ads.innerHTML = 'YourAdsGoHere';
        document.getElementById('html-footer').appendChild(ads);

        if (document.URL.indexOf("register.php") >= 0) {
            ads.style.display = "none";
        }
        if (document.URL.indexOf("login.php") >= 0) {
            ads.style.display = "none";
        }
    })();
</script>

To HTML-bottom

Use .my_ads class in case you need to customize CSS.
YourAdsGoHere -- here go your ads. (!) use double quotes à la " " inside to avoid any breaks.

Spoiler

It were better if I could make this part not repeating twice.
"
        if (document.URL.indexOf("register.php") >= 0) {
            ads.style.display = "none";
        }
        if (document.URL.indexOf("login.php") >= 0) {
            ads.style.display = "none";
        }
"

If I have any idea, I'll notify you.

+1

37

I tried like this:

Spoiler

<script>
        (function() {
            var countup = this;
            var ads = document.createElement('div');
            ads.className = 'my_ads';
            ads.innerHTML = '<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-24426533458390521"
     data-ad-slot="1499301319"
     data-ad-format="auto"></ins>
';
            document.getElementById('html-footer').appendChild(ads);

            if (document.URL.indexOf("register.php") >= 0) {
                ads.style.display = "none";
            }
            if (document.URL.indexOf("login.php") >= 0) {
                ads.style.display = "none";
            }
        })();
    </script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

ad does not appear

Original Code:

Spoiler

<ins class="adsbygoogle"
     style="display:block; text-align:center;"
     data-ad-client="ca-pub-24426533458390521"
     data-ad-slot="1499301319"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

Last edited by kami (2018-02-20 04:09:39)

0

38

kami
Seems like you need to write the code inline

<script>
        (function() {
            var countup = this;
            var ads = document.createElement('div');
            ads.className = 'my_ads';
            ads.innerHTML = '<ins class="adsbygoogle" data-ad-client="ca-pub-24426533458390521" data-ad-format="auto" data-ad-slot="1499301319" style="display:block"></ins>';
            document.getElementById('html-footer').appendChild(ads);

            if (document.URL.indexOf("register.php") >= 0) {
                ads.style.display = "none";
            }
            if (document.URL.indexOf("login.php") >= 0) {
                ads.style.display = "none";
            }
        })();
    </script>

now the appended "my_ads" div appears in footer but I cannot check if google ads work. Some time's needed before the advertisement starts to display for users.

Added after 4 minutes 41 second:

you can check if the div is appended properly by adding some css styling to it.
In example

<style>
.my_ads {
width: 100%;
height: 60px;
background: yellow;
}
</style>

0

39

C3La-NS
Thats work well thank you

0

40

is there any script that can be used to display topic description ?
http://sk.uploads.im/t/in7VP.png

0

41

Hi ho!

I've enabled the "HTML in posts" option in my forum to allow video embeds.

However, that script wraps whatever is added between the [html] bbcode tags in an <iframe> that does not have the "allowfullscreen" attribute. Result is embedded videos cannot be viewed fullscreen.

Can that script please be modified so that the iframe wrapper includes the allowfullscreen attribute?

NSFW

http://thumbs2.imagebam.com/b2/08/ef/a6e86f913873704.jpg
http://thumbs2.imagebam.com/a4/fd/37/283264913867744.jpg

Last edited by Buzzer (2018-07-20 20:27:14)

0

42

Buzzer
Hello.
I tried to set allowfullscreen data to the current script with jquery, but no luck.

This is a messy a little bit, but you may use different script, probably disabling current.

<script>
hArr = ['Admin', 'User2', 'User3'];
$('.post-content p:not(.post-sig p, .quote-box p)').each(function() {
  if($.inArray($(this).parents('.post').find('.pa-author a').text(), hArr)!=-1) {
    $(this).html($(this).html().replace(/(&lt;)(.*?)(&gt;)/g,'<$2>')
                                       .replace(/(&nbsp;)/gm,' ')
                                       .replace(/(&gt;)/gm,'>'));
    $(this).find('style, div').each(function() {
      $(this).html($(this).html().replace(/(<br>)/gm,'\n'));
    });
  }
});
</script>


You must specify allowed usernames to prevent major security issues.

Then you do not need to use any tags, add html code like you do it on admin-options page.
That is:

<iframe src="SOME URL" frameborder="0" width="640" height="360" scrolling="no" allowfullscreen></iframe>


Note. This script works poorly with new lines for HTML, if you make some it is likely to break your html.
Prob any html-compressor may be useful.

+1

43

C3La-NS
Excellent, thanks, that alternate script works just fine!  :cool:

Oh, and thanks for wrapping the preview images I had posted in a spoiler; totally neglected NSFW, sorry. ;)

Last edited by Buzzer (2018-07-09 18:26:04)

0

44

When I use this code

Code:
[video]Youtube URL[/video] 

then I just want to display youtube videos without including the recommended videos. Because I don't want to recommend videos from other youtube users

Current Mybb forum settings
Code:
<iframe width="480" height="284" src="http://www.youtube.com/embed/_oM0ROPgVq0" frameborder="0" allowfullscreen></iframe>
I want to Without Recommended Videos: rel=0
Code:
<iframe width="100%" height="315" src="https://www.youtube.com/embed/_oM0ROPgVq0?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

or if possible you are willing to change the appearance of youtube videos without including the recommended videos  (NEWSetting  on mybbforum)

From the example:

Code:
http://www.youtube.com/embed/_oM0ROPgVq0


to the example:

Code:
https://www.youtube.com/embed/_oM0ROPgVq0?rel=0

0

45

kami
I think it's easier to use HTML in posts for this purpose and then insert the code you need.

Because global changes for the whole service are very unlikely.

0


You are here » Community Forum » New Forum Features » Requests for Scripts