Skip to content

Commit

Permalink
Initial commit, its a test for mootools forge.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fábio M. Costa committed Jul 19, 2009
0 parents commit aec488a
Show file tree
Hide file tree
Showing 15 changed files with 829 additions and 0 deletions.
Binary file added Docs/.DS_Store
Binary file not shown.
7 changes: 7 additions & 0 deletions Docs/Meio.VirtualKeyboard.md
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,7 @@
Native: Class {#Class}
======================

The base Class of the [MooTools](http://mootools.net/) framework.

Class Method: constructor {#Class:constructor}
----------------------------------------------
74 changes: 74 additions & 0 deletions README.md
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,74 @@
meioKeyboard - a mootools plugin for creating a virtual keyboard.
===========

What goes here is the description. Please don't make it too long. It can contain basic *styling*, **styling**, etc.

If an image is found within the description, that becomes the screenshot of the plugin. Screenshots are optional but encouraged, given the plugin has some visual interaction. The screenshot can be of any size, but try to keep it of about 200x100.

![Screenshot](http://url_to_project_screenshot)

How to use
----------

We expect this section for every plugin. It just explains how to use your plugin.
Never should a plugin rely on a 3rd party link to explain its behavior or functionality. We need this to ensure that if a website is removed or becomes inaccessible, people can still enjoy your plugins' functionality.

It often include code snippets, which are just indented pieces of text:

#JS
var script = new MyScript()
script.doSomething();

If the first line is #JS or #CSS or #HTML, then the code is highlighted accordingly.

Screenshots
-----------

This section is optional, but encouraged if the plugin affords it. Just a list of images, one per line. We do the resizing, so use actual size screenshots.

![Screenshot 1](http://url_to_project_screenshot)
![Screenshot 2](http://url_to_project_screenshot)
![Screenshot 3](http://url_to_project_screenshot)
![Screenshot 4](http://url_to_project_screenshot)

Arbitrary section
-----------------

This is an arbitrary section which will become a Tab in your MooForge project page.
Some arbitrary section examples:

* FAQ
* Notes
* Misc
* Known issues

The name is up to you, but remember to keep it meaningful and simple. Arbitrary sections are always optional.

Created by Fabio M. Costa on 2009-07-15.
Based on (C) 2008 Kishore Nallan's http://www.kishorelive.com http://designshack.co.uk/tutorials/creating-a-virtual-jquery-keyboard

Please report any bug at http://www.meiocodigo.com
Copyright (c) 2008 Fabio M. Costa http://www.meiocodigo.com

The MIT License (http://www.opensource.org/licenses/mit-license.php)

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Binary file added Source/.DS_Store
Binary file not shown.
33 changes: 33 additions & 0 deletions Source/Event.Clickout.js
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,33 @@
// http://blog.kassens.net/outerclick-event
// i changed the name for "clickout" cause i think its better :S
(function(){
var $ = document.id || $;
var events;
var check = function(e){
var target = $(e.target),
parents = target.getParents();
events.each(function(item){
var element = item.element;
if (element != target && !parents.contains(element))
item.fn.call(element, e);
});
};
Element.Events.clickout = {
onAdd: function(fn){
if(!events) {
document.addEvent('mousedown', check);
events = [];
}
events.push({element: this, fn: fn});
},
onRemove: function(fn){
events = events.filter(function(item){
return item.element != this || item.fn != fn;
}, this);
if (!events.length) {
document.removeEvent('mousedown', check);
events = null;
}
}
};
})();
59 changes: 59 additions & 0 deletions Source/Meio.VirtualKeyboard.css
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,59 @@
.mk-container{
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
position: absolute;
width: 100%;
overflow: hidden;
position: fixed;
_position: absolute;
bottom: 0;
left: 0;
display: none;
border-top: 1px solid #ccc;
}
.mk-container .mk-container1{
margin: 0 auto;
width: 860px;
overflow: hidden;
padding: 10px 0;
}
.mk-container button{
font-size: 30px !important;
width: 44px;
margin-right: 10px;
height: 40px;
display: inline;
float: left;
}
.mk-container .mk-spacebar button{
width: 400px;
margin: 0 auto;
margin-left: 150px;
}
.mk-container .mk-shift, .mk-container .mk-shifton{
width: 85px;
text-align: left;
}
.mk-container .mk-shift-active{
display: none;
}
.mk-container .mk-row0, .mk-container .mk-row1, .mk-container .mk-row2, .mk-container .mk-row3{
padding-bottom: 10px;
overflow: hidden;
width: 100%;
}
.mk-container .mk-row0{
padding-left: 20px;
}
.mk-container .mk-row1{
padding-left: 60px;
}
.mk-container .mk-row2{
padding-left: 70px;
}
.mk-container .mk-backspace{
width: 125px;
}
.mk-container .mk-shifton{
border-left: 3px solid #000;
border-top: 3px solid #000;
}
81 changes: 81 additions & 0 deletions Source/Meio.VirtualKeyboard.js
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,81 @@
if(typeof Meio == 'undefined') var Meio = {};


(function(){
var $ = document.id || $;

Meio.VirtualKeyboard = new Class({

shiftOn: false,

initialize: function(element, inputs, parentContainer){
this.element = $(element);
this.inputs = inputs;
this.currentInput = null;
this.divShiftActive = this.element.getElement('.mk-shift-active');
this.divShiftInactive = this.element.getElement('.mk-shift-inactive');
this.firstDocumentChild = parentContainer || $(document.body).getFirst();
this.setDetectInputFunction();
this.setButtonsClickEvent();
},

setDetectInputFunction: function(){
this.inputs.each(function(input){
input.addEvents({
'focus': function(){
this.currentInput = input;
this.element.setStyle('display', 'block');
}.bind(this),
'mousedown': function(e){
e.stopPropagation();
}.bind(this)
});
this.element.addEvent('clickout', function(){
this.element.setStyle('display', 'none');
}.bind(this));
}, this);
},

setButtonsClickEvent: function(){
this.element.getElements('button').each(function(btn){
btn.addEvent('click', function(e){
if(this.currentInput){
this.currentInput.focus();
if(btn.get('text') == 'Apagar'){
var range = this.currentInput.getSelectedRange();
if(range.start === range.end && range.end){
this.currentInput.selectRange(range.start-1, range.start);
}
this.currentInput.insertAtCursor('', false);
}
else if(btn.get('text') == 'Shift'){
this.shiftPressed();
}
else{
this.currentInput.insertAtCursor(btn.get('text'), false);
if(this.shiftOn) this.shiftPressed(false);
}
}
}.bind(this));
}, this);
},

shiftPressed: function(shiftActive){
if(typeof shiftActive == 'undefined') shiftActive = !this.shiftOn;
var activeStyle, inactiveStyle;
if(shiftActive){
activeStyle = 'block';
inactiveStyle = 'none';
}
else{
activeStyle = 'none';
inactiveStyle = 'block';
}
this.divShiftActive.setStyle('display', activeStyle);
this.divShiftInactive.setStyle('display', inactiveStyle);
this.shiftOn = shiftActive;
}

});

})();
Binary file added Specs/.DS_Store
Binary file not shown.
13 changes: 13 additions & 0 deletions Specs/index.html
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Plugin's Test Options</title>
</head>
<body>
<ul>
<li><a title="user-tests" href="user/">user-tests</a></li>
<li><a title="unit-tests" href="unit/">unit-tests</a></li>
</ul>
</body>
</html>
30 changes: 30 additions & 0 deletions Specs/unit/index.html
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Plugin Specs</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script src="../../../../assets/mootools/mootools-core-1.2.3.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../assets/firebug/firebug-lite-compressed.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../assets/js-spec/JSSpec.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../assets/js-spec/DiffMatchPatch.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../assets/js-spec/Builder.js" type="text/javascript" charset="utf-8"></script>

<link href="../../../../assets/js-spec/Specs.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" charset="utf-8">
Builder.build('../../', {
source: [
'moo.meio.template',
],
tests: {
unit: {
'meio': ['moo.meio.template']
}
}
});
</script>
</head>
<body>
</body>
</html>
Binary file added Specs/unit/meio/.DS_Store
Binary file not shown.
Loading

0 comments on commit aec488a

Please sign in to comment.