<?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>BG Tech Blog &#187; JavaScript</title>
	<atom:link href="http://bgtechblog.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://bgtechblog.com</link>
	<description>Проблемите, с които се сблъскваме всеки ден</description>
	<lastBuildDate>Fri, 18 May 2012 22:33:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>iFrame or not?</title>
		<link>http://bgtechblog.com/2011/04/07/iframe-or-not/</link>
		<comments>http://bgtechblog.com/2011/04/07/iframe-or-not/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 10:11:23 +0000</pubDate>
		<dc:creator>Благомир Иванов</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://bgtechblog.com/?p=480</guid>
		<description><![CDATA[How to detect if our website is opened inside an iFrame? if &#40; window != window.top &#41; &#123; alert&#40;&#34;I'm in a frame!&#34;&#41;; &#125; No tags for this post.]]></description>
			<content:encoded><![CDATA[<p>How to detect if our website is opened inside an iFrame?</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> window <span style="color: #339933;">!=</span> window.<span style="color: #660066;">top</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;I'm in a frame!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></div></div>

No tags for this post.]]></content:encoded>
			<wfw:commentRss>http://bgtechblog.com/2011/04/07/iframe-or-not/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Analytics код в vBulletin 4</title>
		<link>http://bgtechblog.com/2011/03/12/google-analytics-%d0%ba%d0%be%d0%b4-%d0%b2-vbulletin-4/</link>
		<comments>http://bgtechblog.com/2011/03/12/google-analytics-%d0%ba%d0%be%d0%b4-%d0%b2-vbulletin-4/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 22:43:41 +0000</pubDate>
		<dc:creator>Благомир Иванов</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[vBulletin]]></category>

		<guid isPermaLink="false">http://bgtechblog.com/?p=392</guid>
		<description><![CDATA[При опит да поставим Google Analytics tracking pixel чрез редакция на template в админа се получава следната грешка: Parse error: syntax error, unexpected '[' in /var/www/vhosts/path/to/includes/adminfunctions_template.php&#40;4667&#41; : eval&#40;&#41;'d code on line 133 За да избегнем това, заграждаме GA кода следният таг < vb:literal > &#60;vb:literal&#62; &#60;script type=&#34;text/javascript&#34;&#62; &#160; var _gaq = _gaq &#124;&#124; &#91;&#93;; _gaq.push&#40;&#91;'_setAccount', [...]]]></description>
			<content:encoded><![CDATA[<p>При опит да поставим Google Analytics tracking pixel чрез редакция на template в админа се получава следната грешка:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">Parse error<span style="color: #339933;">:</span> syntax error<span style="color: #339933;">,</span> unexpected <span style="color: #0000ff;">'['</span> in <span style="color: #339933;">/</span><span style="color: #000000; font-weight: bold;">var</span><span style="color: #339933;">/</span>www<span style="color: #339933;">/</span>vhosts<span style="color: #339933;">/</span>path<span style="color: #339933;">/</span>to<span style="color: #339933;">/</span>includes<span style="color: #339933;">/</span>adminfunctions_template<span style="color: #339933;">.</span>php<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">4667</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #990000;">eval</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #0000ff;">'d code on line 133</span></pre></div></div>

<p>За да избегнем това, заграждаме GA кода следният таг <strong><em>< vb:literal ></em></strong></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&lt;vb:literal&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #003366; font-weight: bold;">var</span> _gaq <span style="color: #339933;">=</span> _gaq <span style="color: #339933;">||</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  _gaq.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'_setAccount'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'UA-ХХХХХХХХ-У'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  _gaq.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'_trackPageview'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> ga <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'script'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> ga.<span style="color: #660066;">type</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'text/javascript'</span><span style="color: #339933;">;</span> ga.<span style="color: #660066;">async</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    ga.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'https:'</span> <span style="color: #339933;">==</span> document.<span style="color: #660066;">location</span>.<span style="color: #660066;">protocol</span> <span style="color: #339933;">?</span> <span style="color: #3366CC;">'https://ssl'</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'http://www'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'.google-analytics.com/ga.js'</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> s <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'script'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> s.<span style="color: #660066;">parentNode</span>.<span style="color: #660066;">insertBefore</span><span style="color: #009900;">&#40;</span>ga<span style="color: #339933;">,</span> s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;/vb:literal&gt;</pre></div></div>

No tags for this post.]]></content:encoded>
			<wfw:commentRss>http://bgtechblog.com/2011/03/12/google-analytics-%d0%ba%d0%be%d0%b4-%d0%b2-vbulletin-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Разбирате ли JavaScript ?</title>
		<link>http://bgtechblog.com/2010/03/07/%d1%80%d0%b0%d0%b7%d0%b1%d0%b8%d1%80%d0%b0%d1%82%d0%b5-%d0%bb%d0%b8-javascript/</link>
		<comments>http://bgtechblog.com/2010/03/07/%d1%80%d0%b0%d0%b7%d0%b1%d0%b8%d1%80%d0%b0%d1%82%d0%b5-%d0%bb%d0%b8-javascript/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 11:01:15 +0000</pubDate>
		<dc:creator>Благомир Иванов</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://bgtechblog.com/?p=265</guid>
		<description><![CDATA[Посочените по-долу тестове са написани от Dmitry Baranovskiy в неговия блог под заглавието &#8220;So, you think you know JavaScript?&#8220;. Интересни са и затова ги copy/paste-вам тук. Можете ли да отговорите какво ще върне всеки alert() докато четете кода, без да го тествате? if &#40;!&#40;&#34;a&#34; in window&#41;&#41; &#123; var a = 1; &#125; alert&#40;a&#41;; var a [...]]]></description>
			<content:encoded><![CDATA[<p>Посочените по-долу тестове са написани от Dmitry Baranovskiy в неговия блог под заглавието &#8220;<a href="http://dmitry.baranovskiy.com/post/91403200">So, you think you know JavaScript?</a>&#8220;. Интересни са и затова ги copy/paste-вам тук.</p>
<p>Можете ли да отговорите какво ще върне всеки alert() докато четете кода, без да го тествате?</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span> <span style="color: #000066; font-weight: bold;">in</span> window<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span>
    b <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> a<span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        x <span style="color: #339933;">&amp;&amp;</span> a<span style="color: #009900;">&#40;</span><span style="color: #339933;">--</span>x<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> a<span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> x <span style="color: #339933;">*</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">var</span> a<span style="color: #339933;">;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> b<span style="color: #009900;">&#40;</span>x<span style="color: #339933;">,</span> y<span style="color: #339933;">,</span> a<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    arguments<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
b<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> a<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
a.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

No tags for this post.]]></content:encoded>
			<wfw:commentRss>http://bgtechblog.com/2010/03/07/%d1%80%d0%b0%d0%b7%d0%b1%d0%b8%d1%80%d0%b0%d1%82%d0%b5-%d0%bb%d0%b8-javascript/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

