0 Improve the game guessing number



In previous game, we have leant some new properties of HTML 5.
In this version, we learn some new function in javascript below:
 - to generate a random number from 1 to 100: Math.floor(Math.random() * 100);
 - to catch the event keydown in all over the site: window.addEventListener("keydown", keydownHandler, false);
- to remove event Handler when we don't want that element (ex: button) catch an event: button.removeEventListener("click", clickHandler, false);
Example:


I am thinking of a number between 0 and 99.
 

[Read More...]


0 HTML5 - Guessing number game




In this game, we will familiar with properties placeholder of HTML 5 and javascript function querySelector instead of selectElementById in previous version.
<!doctype html>
<title>Number guessing game</title>
<p id="output">I am thinking of a number between 0 and 99.</p>
<input id="input" type="text" placeholder="Enter your guess...">
<button>guess</button>
<script type="text/javascript">
//Game variables
var mysteryNumber = 50;
var playersGuess = 0;
//The input and output fields
var input = document.querySelector("#input");
var output = document.querySelector("#output");
//The button
var button = document.querySelector("button");
button.style.cursor = "pointer";
button.addEventListener("click", clickHandler, false);
function clickHandler()
{
playGame();
}
function playGame()
{
playersGuess = parseInt(input.value);
if(playersGuess > mysteryNumber)
{
output.innerHTML = "That's too high.";
}
else if(playersGuess < mysteryNumber)
{
output.innerHTML = "That's too low.";
}
else if(playersGuess === mysteryNumber)
{
output.innerHTML = "You got it!";
}
}
</script>
 In this game, when users fill textbox a number, and click on guess button, it will return the result of number. Effect of properties placeholder is take a lot of command in javascript in the pass, now it is so easy.
Finally, in this example, we know how to add an event on a button by command button.addEventListener("click", clickHandler, false);

[Read More...]


0 Beat monster game by HTML5



From last article about animation, today we move to the game beat monster.
In this game, we create a map as matrix 4x4. Then, each time users click or mouse over monster, we change its location. If user click on head of monster, he ore she get one point. In this game, we learn how to make sound every click of user.
First of all, check over the game as below:




[Read More...]


3 How to remove FaLang traduction system by Faboba?




Joomla 2.5! Yes, we are moving onjoomla 2.5, but many extensions don't go as fast as us. Today, I need build an multi-language site, but joomfish is still onjoomla 1.5 . After searching, I decide to use com_falang with free version.
It still be good until the link at bottom site:



After searching every where I found where to remove it.
It is on file: administrator/components/com_falang/classes/falangmanager.class.php at line 464:



$cachBuf2 is the variable which content the link "FaLang traduction system by Faboba". Now you just delete base64_decode($cacheBuf2) is ok, it will be remove for all pages of your website.

[Read More...]


0 How to modify object link of jcomment?



JComment is a big components for joomla, bothjoomla 1.5 andjoomla 2.5. It also means that it is so complicated.

Today, I want to change the object link of each comment. Because, each time, users click on this link, I want it open with a better link than jcomment did.But it's really hard to find out where it is. First I look at object.php of models folder, object.php of class folder in admin. Finally I know it is folder com_jcomment/plugins.

In this folder you have a list of components that jcomment integrated.

I, myself want to modify admanagers link, so I open com_adsmanager.plugin.php file.

In this file you 'll see a line like this:

1.$info->link = JRoute::_("index.php?option=com_adsmanager&view=details&id=" . $row->id . "&catid=" .$row->category . $Itemid);

This is the link of object, now, you can edit as you like.

Hope this is helpful for you.


[Read More...]


0 How to fix joomsocial core app does not display in sitebar position?



the new version of joomsocial has some error, and someone can not wait will be angry about it. I have write a new own application, and i want it displays in sitebar-top position. Although I choose the position is sidebar-top, or sidebar-bottom it's not display. After that, if i set it is not a core app, and user can cofig by their own app, it can display it these both position. I'm really disappointed.

In the internet, question about joomsocial is hard to find an answer. I decide to find out by myself. Finally I figure out why it's not display. when we set our apps to be core, that means that their positions become sidebar-top-core or sidebar-bottom-core or content-core, but in the view.html.php of profile and in template profile.index.php don't include them. Now I will show you how to fix it.

First, go to com_community/views/profile/view.html.php, find these code, and add the three new position: 'content-core', 'sidebar-top-core', and 'sidebar-bottom-core'

01.// Split the apps into different list for different positon
02.$appsInPositions = array();
03.foreach( $appData as &$app )
04.{
05.if( !in_array($app->position, array('content','content-core', 'sidebar-top','sidebar-top-core', 'sidebar-bottom','sidebar-bottom-core')) ) {
06.$app->position = 'content';
07.}
08.$appsInPositions[$app->position][] = $app;
09.}

then, add three more item in the code below:

1.$contenHTML['content'] = '';
2.$contenHTML['sidebar-top'] = '';
3.$contenHTML['sidebar-bottom'] = '';
4.$contenHTML['content-core'] = '';
5.$contenHTML['sidebar-top-core'] = '';
6.$contenHTML['sidebar-bottom-core'] = '';

and finally, you transfer it to template by these code:

1.->set ( 'contentcore' , $contenHTML['content-core'] )
2.->set ( 'sidebarTopcore' , $contenHTML['sidebar-top-core'] )
3.->set ( 'sidebarBottomcore' , $contenHTML['sidebar-bottom-core'] )
4.->set ( 'content' , $contenHTML['content'] )
5.->set ( 'sidebarTop' , $contenHTML['sidebar-top'] )
6.->set ( 'sidebarBottom' , $contenHTML['sidebar-bottom'] )

All things in view.html.php is done.


Now, please open the com_community/template/profile.index.php, find this code

1.echo $sidebarTop; ?>

and add this

1.echo $sidebarTopcore; ?>
2.echo $sidebarTop; ?>

and like others, we get this:

1.echo $sidebarBottomcore; ?>
2.echo $sidebarBottom; ?>

and

1.echo $contentcore; ?>
2.echo $content; ?>

Now you can try again and see how it runs. Hope this helpful for you.

[Read More...]


0 How to set order of module position in joomla 1.7 and joomla 2.5?



If people are too familiar withjoomla 1.5 , it is a bit difficult to set order of modules inJoomla 1.7 andjoomla 2.5. In the modules order position, we now can not enter number to set its order.

How to set order of these module?

Please click at Ordering, it will enable these inputs, and you now can enter the number of these modules like in below image:

We hope that this small tip help you reduce time of finding.

[Read More...]


 

Link Liên kết

Thông tin liên hệ

YH: huonggiangdhtn
Skype: tthuonggiang
Return to top of page Copyright © 2010 | joomla extensions jw-extension.net