<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nova blog &#187; Javascript</title>
	<atom:link href="http://blog.tlsys.hu/cimke/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tlsys.hu</link>
	<description></description>
	<lastBuildDate>Mon, 17 Oct 2011 19:44:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Prototye dialógus ablak</title>
		<link>http://blog.tlsys.hu/prototye-dialogus-ablak/</link>
		<comments>http://blog.tlsys.hu/prototye-dialogus-ablak/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 12:42:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Nincs kategorizálva]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://blog.tlsys.hu/?p=272</guid>
		<description><![CDATA[
			
			
			
			
			
			
			Tweet
						
						
			Szerettem volna egy nagyon egyszerű, dialógus ablakot, ami könnyen átlátható.
A legfontosabb kitétel az volt, hogy egy divet hozzon létre, amibe majd bármit bele tudok illeszteni.
Találtam is egyet
Sajnos az én stilusomnak nem felelt meg. Ezért módosítanom kellett.
A módosítás 2 fontosnak vélt ok miatt vált szükségszerűvé.

Egyrészt szeretek névtereket létrehozni
Másrészt a létrehozásnál minden alkalommal újra és újra létrehoztuk [...]]]></description>
			<content:encoded><![CDATA[<div class="bottomcontainerBox" style="border:1px solid #808080;background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.tlsys.hu%2Fprototye-dialogus-ablak%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:80px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://blog.tlsys.hu/prototye-dialogus-ablak/"></g:plusone>
			</div>
			<div style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://blog.tlsys.hu/prototye-dialogus-ablak/"  data-text="Prototye dialógus ablak" data-count="horizontal">Tweet</a>
			</div><div style="float:left; width:105px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://blog.tlsys.hu/prototye-dialogus-ablak/" data-counter="right"></script></div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://blog.tlsys.hu/prototye-dialogus-ablak/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div><p>Szerettem volna egy nagyon egyszerű, dialógus ablakot, ami könnyen átlátható.<br />
A legfontosabb kitétel az volt, hogy egy divet hozzon létre, amibe majd bármit bele tudok illeszteni.<br />
<span id="more-272"></span>Találtam is <a href="http://mattroper.co.uk/2008/05/27/javascript-overlay-using-prototype-and-scriptaculous/">egyet</a><br />
Sajnos az én stilusomnak nem felelt meg. Ezért módosítanom kellett.<br />
A módosítás 2 fontosnak vélt ok miatt vált szükségszerűvé.</p>
<ul>
<li>Egyrészt szeretek névtereket létrehozni</li>
<li>Másrészt a létrehozásnál minden alkalommal újra és újra létrehoztuk a dialógus ablakot és a layert is, így a nyitások számával nőtt az elemek száma is. <img src='http://blog.tlsys.hu/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </li>
</ul>
<pre class="brush: jscript; title: ; notranslate">
var PrototypeWindow = {
 Dialog : function (content, container)
 {
 // Manage arguments and assign defaults,
 if (typeof container == 'undefined' ) container = document.body;
 if (null == (this.container = $(container))) throw(&quot;container is not valid&quot;);

 // Assign instance variables
 this.content = content;
 if ($('dialogBoxOverlay') == null)
 {
   this.overlay = new Element('div', {'id':'dialogBoxOverlay', 'class': 'overlay' }).hide();
 }
 else
 {
   this.overlay = $('dialogBoxOverlay').hide();
 }
 if ($('dialogBox') == null)
 {
   this.dialog  = new Element('div', {'id':'dialogBox', 'class': 'dialog' }).hide();
 }
 else
 {
   this.dialog = $('dialogBox').hide();
 }

 // Hide the overlay when clicked. Ignore clicks on the dialog.
 Event.observe(this.overlay, 'click', this.hide.bindAsEventListener(this));
 Event.observe(this.dialog, 'click',  function(event) { Event.stop(event) });

 // Insert the elements into the DOM
 this.dialog.insert(this.content);
 this.container.insert(this.overlay);
 this.container.insert(this.dialog);

 // Content may have been hidden if it is embedded in the page
 content.show();
 this.dialog.hide();

 }
}

PrototypeWindow.Dialog.prototype.show = function() {
 new Effect.Appear(this.overlay, { duration: 0.5,  to: 0.8 });
 this.dialog.show();
 return this;
};
PrototypeWindow.Dialog.prototype.hide = function(event) {
 this.dialog.hide();
 this.overlay.hide();
 this.dialog.innerHTML='';
 return this;
};
</pre>
<p>A dialógus ablak használata egyszerű</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
  var dialog = new Element('div'); // létrehozzunk egy divet
  dialog.insert(new Element('h2').insert('Dialogue')); // felötljük adatokkal, ez a sor opcionális...
  var overlay = new DialogOverlay(dialog); // divünket beletesszük a dialógus ablakba
  overlay.show(); // megjelenítjük a dialógus ablakot
&lt;/script&gt;
</pre>
<p>Szükségünk lehet még némi css-re a működéshez:</p>
<pre class="brush: css; title: ; notranslate">
.overlay {
 width: 100%;
 height: 100%;
 background: black;
 position: fixed;
 top: 0;
 left: 0;
 z-index: 2;
}
.dialog {
 width: 50%;
 min-height: 50%;
 background: white;
 position: fixed;
 top: 25%;
 left: 25%;
 z-index: 3;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.tlsys.hu/prototye-dialogus-ablak/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript leírások</title>
		<link>http://blog.tlsys.hu/javascript_leirasok/</link>
		<comments>http://blog.tlsys.hu/javascript_leirasok/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 14:55:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Nincs kategorizálva]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://blog.tlsys.hu/?p=53</guid>
		<description><![CDATA[
			
			
			
			
			
			
			Tweet
						
						
			Ide kerülnek azok a javascriptes megoldások, amiket hasznosnak vélek, de nem érdemelnek egy komplett bejegyzést

Prototype Tabla rendezés példák:
Egyszerű Példa
JSON-os példa
Javascript függvény létezésének vizsgálata:

if(typeof yourFunctionName == 'function')
{
  yourFunctionName();
}


&#60;div id=&#34;datepicker&#34;&#62;&#60;/div&#62;
&#60;script type=&#34;text/javascript&#34;&#62;
jQuery(function() {
	jQuery( &#34;#datepicker&#34; ).datepicker({
	  dateFormat: 'yy-mm-dd',
	  onSelect: function(dateText, inst) {
             // a [...]]]></description>
			<content:encoded><![CDATA[<div class="bottomcontainerBox" style="border:1px solid #808080;background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.tlsys.hu%2Fjavascript_leirasok%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:80px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://blog.tlsys.hu/javascript_leirasok/"></g:plusone>
			</div>
			<div style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://blog.tlsys.hu/javascript_leirasok/"  data-text="Javascript leírások" data-count="horizontal">Tweet</a>
			</div><div style="float:left; width:105px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://blog.tlsys.hu/javascript_leirasok/" data-counter="right"></script></div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://blog.tlsys.hu/javascript_leirasok/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div><p>Ide kerülnek azok a javascriptes megoldások, amiket hasznosnak vélek, de nem érdemelnek egy komplett bejegyzést<br />
<span id="more-53"></span><br />
Prototype Tabla rendezés példák:<br />
<a href="http://www.s2factory.co.jp/books/prototype/code/prototype/intro/table_sorter/index.html">Egyszerű Példa</a><br />
<a href="http://prototools.negko.com/demo/tableorderer/">JSON-os példa</a><br />
<a href="http://www.idealog.us/2007/02/check_if_a_java.html">Javascript függvény létezésének vizsgálata:</a></p>
<pre class="brush: jscript; title: ; notranslate">
if(typeof yourFunctionName == 'function')
{
  yourFunctionName();
}
</pre>
<pre class="brush: jscript; title: ; notranslate">
&lt;div id=&quot;datepicker&quot;&gt;&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
jQuery(function() {
	jQuery( &quot;#datepicker&quot; ).datepicker({
	  dateFormat: 'yy-mm-dd',
	  onSelect: function(dateText, inst) {
             // a kiválasztott hónap utolsó napja
	     var d = (new Date((new Date(inst.currentYear, inst.currentMonth+1, 1))-1)));
             // a datepicker használható a formázáshoz
	     console.log( jQuery.datepicker.formatDate( 'yy-mm-dd', d );
	  }
	});
});
&lt;/script&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.tlsys.hu/javascript_leirasok/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XML lekérése &#8211; Ajax helyett</title>
		<link>http://blog.tlsys.hu/xml-lekerese-ajax-helyett/</link>
		<comments>http://blog.tlsys.hu/xml-lekerese-ajax-helyett/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 05:53:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Nincs kategorizálva]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Xml]]></category>

		<guid isPermaLink="false">http://blog.tlsys.hu/?p=3</guid>
		<description><![CDATA[
			
			
			
			
			
			
			Tweet
						
						
			Az alábbi kis javascript kóddal lehet egy xml objektumot(fájlt) letölteni és feldolgozni

Az xml dokumentum lekérése

function loadXMLDoc(dname)
{
var xmlDoc;
// code for IE
if (window.ActiveXObject)
{
  xmlDoc=new ActiveXObject(&#34;Microsoft.XMLDOM&#34;);
}
else
{ // code for Mozilla, Firefox, Opera, etc.
  if (document.implementation &#38;&#38; document.implementation.createDocument)
  {
    xmlDoc=document.implementation.createDocument(&#34;&#34;,&#34;&#34;,null);
  }
  else
  {
    alert('Your browser cannot handle [...]]]></description>
			<content:encoded><![CDATA[<div class="bottomcontainerBox" style="border:1px solid #808080;background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.tlsys.hu%2Fxml-lekerese-ajax-helyett%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:80px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://blog.tlsys.hu/xml-lekerese-ajax-helyett/"></g:plusone>
			</div>
			<div style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://blog.tlsys.hu/xml-lekerese-ajax-helyett/"  data-text="XML lekérése &#8211; Ajax helyett" data-count="horizontal">Tweet</a>
			</div><div style="float:left; width:105px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://blog.tlsys.hu/xml-lekerese-ajax-helyett/" data-counter="right"></script></div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://blog.tlsys.hu/xml-lekerese-ajax-helyett/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div><p>Az alábbi kis javascript kóddal lehet egy xml objektumot(fájlt) letölteni és feldolgozni<br />
<span id="more-3"></span></p>
<p>Az xml dokumentum lekérése</p>
<pre class="brush: jscript; title: ; notranslate">
function loadXMLDoc(dname)
{
var xmlDoc;
// code for IE
if (window.ActiveXObject)
{
  xmlDoc=new ActiveXObject(&quot;Microsoft.XMLDOM&quot;);
}
else
{ // code for Mozilla, Firefox, Opera, etc.
  if (document.implementation &amp;&amp; document.implementation.createDocument)
  {
    xmlDoc=document.implementation.createDocument(&quot;&quot;,&quot;&quot;,null);
  }
  else
  {
    alert('Your browser cannot handle this script');
  }
}
xmlDoc.async=false;
xmlDoc.load(dname);
cleanWhitespace(xmlDoc); // itt törlöm a white space karaktereket
return(xmlDoc);
};
</pre>
<p>lekérem az webpage xml-ből az adatokat egy tömbbe</p>
<pre class="brush: jscript; title: ; notranslate">
function XMLtoArray(webpage)
{
var data=new Array();
try {
     xmlDoc=loadXMLDoc(webpage);
     var x=xmlDoc.documentElement;
     //document.location.href = webpage;
	 for (j=0;j&lt;x.childNodes[0].childNodes.length;j++)
     {
       data[x.childNodes[0].childNodes[j].getAttribute(&quot;name&quot;)] =
	     x.childNodes[0].childNodes[j].childNodes[0].nodeValue;
	 }
	 return data;
	 }
catch(err)
    {
	  return data
	};
};
</pre>
<p>Amikor ezt a scriptet írtam, a firefox még nem volt képes feldolgozni az xml fájlt, ha az white space karaktereket tartalmazott. Azóta nem tudom, hogy változott-e, de íme a kód, ami törli és amire az első függvényünk hivatkozik:</p>
<pre class="brush: jscript; title: ; notranslate">
var notWhitespace = /\S/
function cleanWhitespace(node) {
  for (var x = 0; x &lt; node.childNodes.length; x++) {
    var childNode = node.childNodes[x]
    if ((childNode.nodeType == 3)&amp;&amp;(!notWhitespace.test(childNode.nodeValue)))
	{	// that is, if it's a whitespace text node
	  node.removeChild(node.childNodes[x]);
      x--;
    }
    if (childNode.nodeType == 1)
	{ // elements can have text child nodes of their own
      cleanWhitespace(childNode)
    }
  }
}
</pre>
<h2>Teszt</h2>
<p>Legyen ez a teszt.xml fájlunk. Mint látható 2 mezőt tartalmaz: város és irányítószám.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version='1.0' encoding='UTF-8' standalone='yes'?&gt;
&lt;select&gt;
&lt;record id='1'&gt;
&lt;field name='varos' type='string'&gt;&lt;![CDATA[Budapest]]&gt;&lt;/field&gt;
&lt;field name='iraszam' type='int'&gt;1131&lt;/field&gt;
&lt;/record&gt;
&lt;/select&gt;
</pre>
<p>tesztlejük le, hogy működik-e. Tegyük be a javascript függvényeket egy xmldom.js nevű fájlba. És hozzuk létre az alábbi html fájlt (index.html):</p>
<pre class="brush: xml; title: ; notranslate">
&lt;html&gt;
&lt;head&gt;
 &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
 &lt;script type=&quot;text/javascript&quot; src=&quot;xmldom.js&quot;&gt;&lt;/script&gt;
 &lt;script type=&quot;text/javascript&quot;&gt;
 console.log(XMLtoArray(&quot;/teszt.xml&quot;));
 &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>A console.log használatához szükségünk lesz a Firefox Firebug nevű kiegészítőjére. Annak a konzolján fog megjelenni a tömb.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tlsys.hu/xml-lekerese-ajax-helyett/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

