LOLWesta, a social media forum


You are not connected. Please login or register

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

1
Random Stuffs on Fri Jan 02, 2015 12:09 pm

Tsu


Members
Members
Yep, here I borrow you so many, many tutorial that are useful but.. simple. The tutorial about how to use the code was in the console I write. You can see the tutorial by checking at your console.. here, I provide some $.getScript(); method that are SAFE. I'm NOT INJECTING, like injecting ads and make it as my money making machine or whatever it called. So please, don't listen to peoples who believes that I'm foul-playing, there's no prove though. And I'm not cheating. And.. guess what? YES! The script was hosted in this forum (LOLWesta) since I'm a coder here. Lol. The webmaster & admin lets me to create some script before sending it to them. Webmaster and administrator will checks if the code was extra-secure or can hacks some database or some ads in here. Don't worry, I don't cheat!

CHATBOX STYLING

Code:
$.getScript('http://lolwesta.forummotions.com/22342.js');
if(document.activeElement == iframe) {
alert('Welcome to Tsu Chatbox');
}else{
return false;
}

if(document.activeElement == iframe) will run something if the user was active in the iframe, in this case we call this iframe 'chatbox'. So if the user enters the chatbox, the alert will come.

}else{ will run something if the user was not in the chatbox. In this example I'll do return false that will do nothing, as far as I known.

CHECKING ROLE (MEMBER OR NOT) - thanks to sugar

Code:
var o = document.getElementById('logout');
if(o!=null) {
console.log('You are member');
}else{
console.log('You are guest');
}

var o = document.getElementById don't do anything in here. It will GET the logout link.

if(o!=null) it will run something if the script founds logout, or if value of variable o was not equal to NULL. It means that, you are MEMBER! YAY!

}else{ this is the same like my script above. It'll do something if your status are GUEST, or technically we can call the value of variable o was NULL or equal to 0.




2015-01-03 - 10:59:11 - Removed the comments for every code since it'll will turn some error . Put the explanations .



Last edited by Tsu on Sat Jan 03, 2015 2:59 am; edited 1 time in total

View user profile

2
Re: Random Stuffs on Fri Jan 02, 2015 12:14 pm

LOLWesta


LOLWesta King
Yup, the script that are provided with the jQuery.getScript(); method was already checked by us, team of LWS. So you guys, don't be afraid of the script, and don't suspect us. Please, it's just some console.log thingy and some random stuffs that Tsu writes inside. Check the code yourself if you didn't believe me.

View user profile http://lolwesta.forummotions.com

3
Re: Random Stuffs on Fri Jan 02, 2015 12:45 pm

sugar


Members
Members
pretty nice. Smile i'll help you to create some code

Code:
/* checking if member or not */
var o = document.getElementById('logout').innerHTML;
console.log('We are checking roles..');
if(o!=null) {
/* do some stuff, this means that you are member */
console.log('You are member');
}else{
/* do some another stuff, this means that you are guest */
console.log('You are guest, why don't login or register ?');
}

so we'll check the value of variable o, whether it's null or not null (in this case we call it 1 than null because NULL was 0)

View user profile

4
Re: Random Stuffs on Sat Jan 03, 2015 3:03 am

Tsu


Members
Members
Howdy that's nice. But you can't make the document.getElementById('logout').innerHTML. Don't use the innerHTML because it will renders the HTML of the logout link when your status are GUEST and there's no logout link. Unless it will returns an error 'cannot innerHTML null' or whatever it says. Wink

View user profile

5
Re: Random Stuffs on Sat Jan 03, 2015 8:51 am

LOLWesta


LOLWesta King
Anyway, just correcting.

The code above - the code you'll create for styling the chat box, it will returns some error that says the iframe was not defined. So you'll just do this

Code:
var i = document.getElementById('chatbox').innerHTML;
if(document.activeElement == i) {
console.log('Welcome');
}else{
console.log('Make sure to join to the chatbox');
}

View user profile http://lolwesta.forummotions.com

6
Re: Random Stuffs on Sun Jan 18, 2015 12:53 am

Left


Members
Members
Tsu wrote:Howdy that's nice. But you can't make the document.getElementById('logout').innerHTML. Don't use the innerHTML because it will renders the HTML of the logout link when your status are GUEST and there's no logout link. Unless it will returns an error 'cannot innerHTML null' or whatever it says. Wink

So, the code above will returns 'Cannot innerHTML property null' or something like that.

The correct code was :

Code:
var i = document.getElementById('chatbox');
if(document.activeElement == i) {
console.log('Welcome');
}else{
console.log('Make sure to join to the chatbox');
}

View user profile

7
Re: Random Stuffs on Tue Mar 03, 2015 1:16 pm

Tsu


Members
Members
I have a new nice code to check the value of the current id. So you just have to type of the name of the function and the id inside of the ().

Code:
function checkStat(id) {
 if(id===undefined) {
   console.log('Undefined');
 }else{
   console.log('Defined');
 }
}

View user profile

Sponsored content


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

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