Good art is a taste, good design is an opinion.


Come as guest, stay as family.
Board Index

Come as guest, stay as family.


You are not connected. Please login or register

Foto

[Archived] Code only for member



View previous topic View next topic Go down Message [Page 1 of 1]

1
Offline

  tommycoo

avatar
Punbb Senior
Punbb Senior

  • Description:

Can someone of you make my code only can seeing by member not for guest ? that will have a text that tell if you want to see you must be register ?

i've my code for code member is this not the original
Code:
jQuery(function () {
                        jQuery('code').each(function () {
                            var sContent = jQuery(this).html();
                            var codebox = jQuery(this).parent().parent();
                            codebox.before('<div class="punbbtop">PunBB        <button onclick="punbbExpand(this); return false;">expand</button><button style="display: none" onclick="punbbCollapse(this); return false;">collapse</button>  <button onclick="punbbSelect(this); return false;">select</button>  <button onclick="punbbPopup(this); return false;">popup</button>  <button style="margin-right: 50px; float: right;" onclick="punbbAbout(this); return false;">?</button></div></div></div><pre class="highlight punbb_block">' + sContent + '</pre>');
                            codebox.remove();
                        });
                        jQuery.getScript('http://balupton.github.com/jquery-syntaxhighlighter/scripts/jquery.syntaxhighlighter.min.js', function () {
                            jQuery.SyntaxHighlighter.init({
                                'wrapLines': false
                            })
                        })
                    });
                    function punbbExpand(oThis) {
                        jQuery(oThis).css('display', 'none');
                        jQuery(oThis).next().css('display', '');
                        jQuery(oThis).parent().next('pre.punbb_block').addClass('expand');       
                    }
                    function punbbCollapse(oThis) {
                        jQuery(oThis).css('display', 'none');
                        jQuery(oThis).prev().css('display', '');
                        /*jQuery(oThis).parent().parent().find('pre.punbb_block').css('height', '250px;');*/
                        jQuery(oThis).parent().next('pre.punbb_block').removeClass('expand');
                    }
                    function punbbPopup(oThis) {
                        var content = jQuery(oThis).parent().next('pre.punbb_block').html();
                        var my_window = window.open("", "PunBB code - To select the code: [Ctrl] + [A]", "scrollbars=1toolbar=no,menubar=no,personalbar=no,status=0,left=0,location=0,menubar=0,top=0,width=640,height=480");
                        my_window.document.write('<pre>'+content+'</pre>');
                    }
                    function punbbAbout(oThis) {
                        alert('Code syntax for atlanta\n\nBy tommycoo 2014\n');
                    }
                    function punbbSelect(oThis) {
                        var doc = document;
                        var text = jQuery(oThis).parent().next('pre.punbb_block')[0];
                        if (doc.body.createTextRange) {
                            var range = doc.body.createTextRange();
                            range.moveToElementText(text);
                            range.select();
                        } else if (window.getSelection) {
                            var selection = window.getSelection();
                            var range = doc.createRange();
                            range.selectNodeContents(text);
                            selection.removeAllRanges();
                            selection.addRange(range);       
                        }
                    }

can someone upgrade it



  • Information:

Forum:http://atlanta.forumid.net/Version:PUNBB
Type:Errors in codeTags:member

Powered by PunBB
Currently 0 users have thanked tommycoo for this post:

2
Offline

  Guest

avatar
Guest
Not sure if I understood your question good, but this is an example for hiding code content.

Code:
[panda=js]        $(function() {
        if(!document.getElementById('logout')) {
        $('.cont_code').text("Please login or register, to see code content.");
        }
        });

Powered by PunBB
Currently 0 users have thanked Guest for this post:

3
Offline

  tommycoo

avatar
Punbb Senior
Punbb Senior
i know that code but it require original navbar, in my forum i don't have it

Powered by PunBB
Currently 0 users have thanked tommycoo for this post:

4
Offline

  Daemon


Punbb Rookie
Punbb Rookie
Here my friend:
Code:
        $(function() {
        if(_userdata["session_logged_in"] === 0) {
        $('.cont_code').text("Please login or register, to see code content.");
        }
        });
Wink

Powered by PunBB
Currently 0 users have thanked Daemon for this post:

5
Offline

  Tommy Lee

avatar
Punbb Senior
Punbb Senior
Hello,

Is this topic solved?

Powered by PunBB
Currently 0 users have thanked Tommy Lee for this post:

6
Offline

  Virus

avatar
★Moderator★
★Moderator★
[aviso="Thread Archived"]Original poster seems to be inactive and did not respond within 7 days in this thread. Because of this, the topic has been Archived.

If you have further questions, please open a new topic.[/aviso]

Powered by PunBB
Currently 0 users have thanked Virus for this post:

7
Offline

  Sponsored content



Powered by PunBB
Currently 0 users have thanked Sponsored content for this post:

View previous topic View next topic Back to top Message [Page 1 of 1]


Topic URL's

URL
BBcode
HTML

Permissions in this forum:
You cannot reply to topics in this forum