FlashApplications

J.Sontag
  • Home
  • Site Notice
  • About Me
  • Write Me

Archiv

Artikel Tagged ‘jQuery’

JavaScript import class function like in ActionScript

26. Mai 2011 Jörg Sontag Kommentare ausgeschaltet

Here is a little Class for dynamic import an JavaScript Class in the “<head>” Tag:



/*
* Simple Import Class
*
* Version 1.0 J.Sontag
* usage:
*  $.classimport('your path to the file.js');
*/

(function($){

$.classimport = function(filename) {
try {
var write = true;
var check = $('head').find('script');
var len = check.length;
for ( var int = 0; int < len; int++) {
var root = check[int].src;
var index = root.lastIndexOf('/');
var src = root.substr(index+1,root.length);
var file = filename.substr(filename.lastIndexOf("/")+1,filename.length);
if(src == file){
write = false;
break;
}
}
if(write){
var head = document.getElementsByTagName('head')[0];
script = document.createElement('script');
script.src = filename;
script.type = 'text/javascript';
if ($.browser.mozilla) {
head.appendChild(script);
}else $('head').append(script);
return true;
}
else {
$.trace(file+" is already imported", "WARNING");
return false;
}
} catch (e) {
$.trace(e, "ERROR");
}

};

})(jQuery);


KategorienJavaScript, News Tags: Javascript, jQuery, Snippets, usefull

jQuery trace window

20. Mai 2011 Jörg Sontag Kommentare ausgeschaltet

 

 

 

 

 

 

 

 

 

I developed a simple jQuery trace window for better debugging in JavaScript

Features:

use trace like in ActionScript anywhere in your js code:

$.trace(“something”);

turn all traces off just write:

$.setTrace(false);

Error & Warning in diffrent Colors write:

$.trace(“ERROR World”, “ERROR”);

$.trace(“Warning World”, “WARNING”);

if you want to see where the trace comes from:

$.setClassPath(value); here you can set a ClassPath if you want as ‘test.jquery.test.js’;

 

How to use it:



/*
* Dialog Trace Window
*
* usage:
*
* $.setTrace(value); true = on  / false = off
* $.setClassPath(value); here you can set a ClassPath if you want as 'test.jquery.test.js';
* $.trace('your message',type); type = 'ERROR' or type= 'WARNING' not set = Normal Trace!
*
*/

<link rel="stylesheet" href="themes/trace.css">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.trace.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.13.custom.min.js"></script>
<script type="text/javascript">

$(function() {
$.setTrace(true);
$.setClassPath("your.path.to.show");
$.trace("Hello World");
$.trace("ERROR World", "ERROR");
$.trace("Warning World", "WARNING");
});
</script>


Try it out!

Download Demo

KategorienJavaScript, News Tags: Javascript, jQuery, Technik, usefull
RSS
  • Google
  • Youdao
  • Xian Guo
  • Zhua Xia
  • My Yahoo!
  • newsgator
  • Bloglines
  • iNezha
Twitter

Champions-League Final 25.05.2013

Wave Ya Flag by Joerg Sontag Flashapplications requires Flash Player 10 or better.

Tag Cloud

3D 3DText ActionScript2.0 ActionScript3 ActionScript 3.0 Air Android Applikation AS3 Autorennen Begeisterung Corona DesignPattern E-Paper Experiment Five3D Flash Framework Fun Game HTML5 iOS iPad iPhone Javascript jQuery Kinect Leidenschaft Light Lua Mixer Molehill MySQL online PHP Portal Rechner Schieberegler Snippets Sound Technik Typo3 usefull Wordpress XML

WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.

Categories

  • Air (1)
  • Android (1)
  • Art (1)
  • BookLists (1)
  • Desktop (2)
  • FlashLab (35)
    • ActionScript3 (30)
    • AS3 Snippets (3)
  • Games (8)
  • iPhone/iPad (7)
  • JavaScript (6)
  • News (53)
  • References (13)

Flash-Blogs:

  • actionscript microcosmos
  • AlecMcE.com
  • Beautify Code
  • blog.joa-ebert.com
  • ByteArray
  • FlashRealTime
  • gBlog
  • Hawaii Flash User Group
  • John Lindquist
  • Mario Klingemann
  • NIKLAS KNAACK
  • Seb Lee-Delisle Blog
  • The Way of Flex
  • theFlashBlog
  • unitzeroone

Flash-Links:

  • Beautifl-Flash Gallery
  • Creative Applications
  • FIVe3D
  • Flash & Math
  • Flashforum
  • gotoandlearm.com
  • Papervision3D
  • Powerflasher FDT 3
  • RobotLegs AS3
  • wonderfl

Flash-Talks

  • 101 Particles
  • FFK Talks
  • Grant Skinner Talks
Oben WordPress
Theme by NeoEase. Valid XHTML 1.1 and CSS 3.