newsblog
Fri, 28 Jul 2017, 00:41 *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Hi gusy!
 
   Home   Help Search Login Register  
Pages: [1] 2   Go Down
  Print  
Author Topic: JS bits  (Read 6353 times)
0 Members and 1 Guest are viewing this topic.
wooptoo
Baistruc

Offline Offline

Posts: 6 203


◕ ◡ ◕


View Profile WWW
« on: Tue, 22 Jan 2008, 14:09 »

post yer JavaScript bits here


protect mail with js
Scrie adresele de mail folosind document.write(). Spam bots nu stiu JS (inca) deci e safe for now...

Code: (mail.js)
mail='@example.org' //@server
mail='test' + mail //username
mail='<a href="mailto:' + mail + '">' + mail + '</a>'
imparte adresa de mail pe bucati, just in case. simbolul "@" nu e folosit in js, deci adresa poate fi gasita f usor daca e dintr-o bucata.

Code: (html)
<head>


    <script type="text/javascript" src="mail.js"></script>


</head>

<body>
    <p><script type="text/javascript">document.write(mail)</script></p>

    <noscript><p><img src="mail.png" alt="enable JS or images to view mail"></p></noscript>
</body>
in caz ca JS nu e activat, e afisata o imagine cu adresa... in caz ca nici imaginile nu-s activate apare mesaju de la "alt"

Am atasat fisierele. Daca stie cineva cum sa faca chestia asta incat sa nu mai trebuiasca da pui "<script type="text/javascript">document.write(mail)</script>" acolo unde vrei sa afiseze adresa ar fi perfect. Adica mail.js sa caute clasa "mail" a elementului <p> si sa scrie in <p> adresa.

* mailjs.zip (2.52 KB - downloaded 194 times.)
« Last Edit: Tue, 22 Jan 2008, 14:13 by wooptoo » Logged
punkt
personal space invader
Baistruc

Offline Offline

Gender: Male
Posts: 1 458



View Profile
« Reply #1 on: Tue, 22 Jan 2008, 14:24 »

in caz ca JS nu e activat, poti sa generezi o imagine in PHP ce poate sa contina adresa de mail:
Code:
<noscript><p><img src="genmail.php" alt="enable JS or images to view mail"></p></noscript>
Oricum, e calumea snippet-ul, nu stiam asta grin
« Last Edit: Tue, 22 Jan 2008, 14:26 by punkt » Logged
yoshi
fap -> ∞
Coșcojemete

Offline Offline

Gender: Male
Posts: 10 713


| (• ◡•)|/ \(❍ᴥ❍ʋ)


View Profile
« Reply #2 on: Tue, 22 Jan 2008, 14:36 »

Daca stie cineva cum sa faca chestia asta incat sa nu mai trebuiasca da pui "<script type="text/javascript">document.write(mail)</script>" acolo unde vrei sa afiseze adresa ar fi perfect. Adica mail.js sa caute clasa "mail" a elementului <p> si sa scrie in <p> adresa.

var rawr = document.getElementById('mail');

cu clase nu stiu daca merge, never tried. foloseam id pt js si clase pt css
Logged
wooptoo
Baistruc

Offline Offline

Posts: 6 203


◕ ◡ ◕


View Profile WWW
« Reply #3 on: Tue, 22 Jan 2008, 14:42 »

punkt: De ce sa te complici cu php? nu ii adauga nici un fel de protectie.
yosh: pt clase e getElementByClass
Logged
punkt
personal space invader
Baistruc

Offline Offline

Gender: Male
Posts: 1 458



View Profile
« Reply #4 on: Tue, 22 Jan 2008, 15:44 »

de unde getElementByClass ?! tot ce am gasit au fost functii custom, dar nu exista getElementByClass in JS....
http://www.w3schools.com/htmldom/dom_obj_document.asp

edit: poti folosi Prototype (js framework) pt lucrul cu elemente:
Quote
The biggest part of the Prototype framework are its DOM extensions. Prototype adds many convenience methods to elements returned by the $() function: for instance, you can write $('comments').addClassName('active').show() to get the element with the ID 'comments', add a class name to it and show it (if it was previously hidden). The 'comments' element didn't have those methods in native JavaScript; how is this possible? This document reveals some clever hacks found in Prototype.

sau mootools
« Last Edit: Tue, 22 Jan 2008, 17:03 by punkt » Logged
punkt
personal space invader
Baistruc

Offline Offline

Gender: Male
Posts: 1 458



View Profile
« Reply #6 on: Thu, 23 Oct 2008, 10:23 »

John Resig's Flexible Javascript Events

http://ejohn.org/projects/flexible-javascript-events/

This is the project page for my entry into the addEvent() recoding contest. It works in all of the modern browsers: Windows IE 5+, Mozilla, Opera, and Safari. The code meets every item outlined in the guideline - attempting to be as short and simple as possible. You can view a demo of it in action.

This library consists of two functions: addEvent and removeEvent. To use them, simply copy the code from below, paste it into your Javascript code, and call it using these methods:
Code:
addEvent( object, eventType, function );

The 'object' parameter should be the object upon which you want the event to be called.
The 'eventType' parameter should hold the name of the event, for example: 'click', 'mouseover', 'load', 'submit', etc. More can be found here.
The 'function' parameter should be a reference to a function that you wish to have called whenever the event fires. One parameter will be passed to 'function' - the event object.

Some examples of addEvent in use:
Code:
addEvent( document.getElementById('foo'), 'click', doSomething );
addEvent( obj, 'mouseover', function(){ alert('hello!'); } );
removeEvent( object, eventType, function );
removeEvent is virtually identical to addEvent, with the obvious difference: Instead of the function being added to the event handler, it is removed instead. All of the above code and parameters applies to this function.

The code, itself, is very short and simple - only 15 lines long:
Code:
function addEvent( obj, type, fn ) {
  if ( obj.attachEvent ) {
    obj['e'+type+fn] = fn;
    obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
    obj.attachEvent( 'on'+type, obj[type+fn] );
  } else
    obj.addEventListener( type, fn, false );
}
function removeEvent( obj, type, fn ) {
  if ( obj.detachEvent ) {
    obj.detachEvent( 'on'+type, obj[type+fn] );
    obj[type+fn] = null;
  } else
    obj.removeEventListener( type, fn, false );
}
Much of the above code is trying to fix a serious problem with Internet Explorer. The code has to be this troublesome due to the fact that when your attached function gets fired, the 'this' reference refers to the worthless 'window', when, in fact, it should refer to the parent object. An explanation of the key points:
Code:
obj['e'+type+fn] = fn;

This makes the function a child of the specified object. The key, which is placed in the object hash, is (hopefully) unique and won't collide with any other function additions.
Code:
obj[type+fn] = function(){ obj['e'+type+fn]( window.event ); }

This line creates an anonymous function who, once executed, will fire the previously attached function - passing it the global event object. This whole function is being attached to the object so that it can be removed later, using the removeEvent() function.

Finally, for more information on the attachEvent, detachEvent, addEventListener, and removeEventListener functions - please refer to the excellent resource at Quirksmode.
Logged
wooptoo
Baistruc

Offline Offline

Posts: 6 203


◕ ◡ ◕


View Profile WWW
« Reply #7 on: Sun, 13 Dec 2009, 05:55 »

Guys, take a look at this:
Quote
Node is a framework to build server-side event-driven JavaScript applications. Developed in C++ on top of Google’s V8 JavaScript engine and accompanied by a set of JavaScript libraries Node seems to make building distributed (over a network), fast applications a piece of cake even for inexperienced developers.

Here is an example of a simple TCP server which listens on port 7000 and echos whatever you send it:
Code:
var tcp = require('tcp');
var server = tcp.createServer(function (socket) {
  socket.setEncoding("utf8");
  socket.addListener("connect", function () {
    socket.send("hello\r\n");
  });
  socket.addListener("receive", function (data) {
    socket.send(data);
  });
  socket.addListener("eof", function () {
    socket.send("goodbye\r\n");
    socket.close();
  });
});
server.listen(7000, "localhost");

MOAR:
http://nodejs.org/
awesome demo: http://chat.nodejs.org/

http://sapessi.com/2009/11/server-side-javascript-with-node-js/
http://simonwillison.net/2009/Nov/23/node/
http://hornbeck.wordpress.com/2009/07/19/node-js/
Logged
wooptoo
Baistruc

Offline Offline

Posts: 6 203


◕ ◡ ◕


View Profile WWW
« Reply #8 on: Sun, 13 Dec 2009, 06:13 »

Raphaël—JavaScript Library  http://raphaeljs.com/

Quote
Raphaël is a small JavaScript library that should simplify your work with vector graphics on the web. If you want to create your own specific chart or image crop and rotate widget, for example, you can achieve it simply and easily with this library.

http://raphaeljs.com/
I like this demo http://raphaeljs.com/analytics.html
Logged
yoshi
fap -> ∞
Coșcojemete

Offline Offline

Gender: Male
Posts: 10 713


| (• ◡•)|/ \(❍ᴥ❍ʋ)


View Profile
« Reply #9 on: Tue, 22 Dec 2009, 21:09 »


http://www.jscharts.com/ found this....but...lol, money for js lib sau altfel te scuipa ala? lol grin
Logged
wooptoo
Baistruc

Offline Offline

Posts: 6 203


◕ ◡ ◕


View Profile WWW
« Reply #10 on: Tue, 22 Dec 2009, 21:22 »

MilkChart for MooTools is also awesome http://code.google.com/p/milkchart/ smile (face charts din tabele normale, which is the way to go IMHO).
But nothing beats this http://highcharts.com/
Logged
yoshi
fap -> ∞
Coșcojemete

Offline Offline

Gender: Male
Posts: 10 713


| (• ◡•)|/ \(❍ᴥ❍ʋ)


View Profile
« Reply #11 on: Tue, 22 Dec 2009, 22:58 »

But nothing beats this http://highcharts.com/
si astia vor bani. wankers grin
Logged
wooptoo
Baistruc

Offline Offline

Posts: 6 203


◕ ◡ ◕


View Profile WWW
« Reply #12 on: Wed, 23 Dec 2009, 00:46 »

DURR AJAX


* IMG_7681_ajax_small.jpg (27.62 KB, 333x500 - viewed 292 times.)
Logged
wooptoo
Baistruc

Offline Offline

Posts: 6 203


◕ ◡ ◕


View Profile WWW
« Reply #13 on: Thu, 21 Jan 2010, 22:39 »

http://commonjs.org/

Quote
CommonJS

JavaScript is a powerful object oriented language with some of the fastest dynamic language interpreters around. The official JavaScript specification defines APIs for some objects that are useful for building browser-based applications. However, the spec does not define a standard library that is useful for building a broader range of applications.

The CommonJS API will fill that gap by defining APIs that handle many common application needs, ultimately providing a standard library as rich as those of Python, Ruby and Java. The intention is that an application developer will be able to write an application using the CommonJS APIs and then run that application across different JavaScript interpreters and host environments. With CommonJS-compliant systems, you can use JavaScript to write:

    * Server-side JavaScript applications
    * Command line tools
    * Desktop GUI-based applications
    * Hybrid applications (Titanium, Adobe AIR)

Awesome! can't wait for this grin

n: iar o sa sara skee si o sa zica ca JS nu e pentru server-side tongue
Logged
yoshi server side js? cum e asta?O_o
Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Designed by | Licensed under Creative Commons BY-NC-ND 3.0 | Powered by SMF 1.1.21 | SMF © 2015, Simple Machines