snipt

Ctrl+h for KB shortcuts

JavaScript

Thaana jQuery plugin mini

1
2
3
4
5
(function($){$.fn.Thaana=function(r){this.each(function(){var $tObj=$(this);var oText=$tObj.text();var rText=oText;if(r==1){$tObj.css("font-family","Faruma, \"MV Elaaf Normal\"");$tObj.css("text-align","right");}
else if(r==2){rText=oText.split("").reverse().join("");$tObj.css("font-family","A_Ilham, A_Randhoo, A_Faruma, A_Waheed");$tObj.css("unicode-bidi","bidi-override");}
else if(r==3){rText=oText.split("").reverse().join("");$tObj.css("font-family","Faruma, \"MV Elaaf Normal\"");$tObj.css("text-align","right");}
else{rText=oText;$tObj.css("font-family","A_Ilham, A_Randhoo, A_Faruma, A_Waheed");$tObj.css("unicode-bidi","bidi-override");}
$tObj.css("direction","rtl");$tObj.text(rText);});return this;};})(jQuery);
https://snipt.net/embed/604c4bf412f0db767484c759fcdba42e/
/raw/604c4bf412f0db767484c759fcdba42e/
604c4bf412f0db767484c759fcdba42e
js
JavaScript
5
2019-07-13T09:11:58
True
False
False
/api/public/snipt/15841/
thaana-jquery-plugin-mini
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">$</span><span class="p">){</span><span class="nx">$</span><span class="p">.</span><span class="nx">fn</span><span class="p">.</span><span class="nx">Thaana</span><span class="o">=</span><span class="kd">function</span><span class="p">(</span><span class="nx">r</span><span class="p">){</span><span class="k">this</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span><span class="p">(){</span><span class="kd">var</span> <span class="nx">$tObj</span><span class="o">=</span><span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">);</span><span class="kd">var</span> <span class="nx">oText</span><span class="o">=</span><span class="nx">$tObj</span><span class="p">.</span><span class="nx">text</span><span class="p">();</span><span class="kd">var</span> <span class="nx">rText</span><span class="o">=</span><span class="nx">oText</span><span class="p">;</span><span class="k">if</span><span class="p">(</span><span class="nx">r</span><span class="o">==</span><span class="mi">1</span><span class="p">){</span><span class="nx">$tObj</span><span class="p">.</span><span class="nx">css</span><span class="p">(</span><span class="s2">&quot;font-family&quot;</span><span class="p">,</span><span class="s2">&quot;Faruma, \&quot;MV Elaaf Normal\&quot;&quot;</span><span class="p">);</span><span class="nx">$tObj</span><span class="p">.</span><span class="nx">css</span><span class="p">(</span><span class="s2">&quot;text-align&quot;</span><span class="p">,</span><span class="s2">&quot;right&quot;</span><span class="p">);}</span> </span><span id="L-2"><a name="L-2"></a><span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="nx">r</span><span class="o">==</span><span class="mi">2</span><span class="p">){</span><span class="nx">rText</span><span class="o">=</span><span class="nx">oText</span><span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="s2">&quot;&quot;</span><span class="p">).</span><span class="nx">reverse</span><span class="p">().</span><span class="nx">join</span><span class="p">(</span><span class="s2">&quot;&quot;</span><span class="p">);</span><span class="nx">$tObj</span><span class="p">.</span><span class="nx">css</span><span class="p">(</span><span class="s2">&quot;font-family&quot;</span><span class="p">,</span><span class="s2">&quot;A_Ilham, A_Randhoo, A_Faruma, A_Waheed&quot;</span><span class="p">);</span><span class="nx">$tObj</span><span class="p">.</span><span class="nx">css</span><span class="p">(</span><span class="s2">&quot;unicode-bidi&quot;</span><span class="p">,</span><span class="s2">&quot;bidi-override&quot;</span><span class="p">);}</span> </span><span id="L-3"><a name="L-3"></a><span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="nx">r</span><span class="o">==</span><span class="mi">3</span><span class="p">){</span><span class="nx">rText</span><span class="o">=</span><span class="nx">oText</span><span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="s2">&quot;&quot;</span><span class="p">).</span><span class="nx">reverse</span><span class="p">().</span><span class="nx">join</span><span class="p">(</span><span class="s2">&quot;&quot;</span><span class="p">);</span><span class="nx">$tObj</span><span class="p">.</span><span class="nx">css</span><span class="p">(</span><span class="s2">&quot;font-family&quot;</span><span class="p">,</span><span class="s2">&quot;Faruma, \&quot;MV Elaaf Normal\&quot;&quot;</span><span class="p">);</span><span class="nx">$tObj</span><span class="p">.</span><span class="nx">css</span><span class="p">(</span><span class="s2">&quot;text-align&quot;</span><span class="p">,</span><span class="s2">&quot;right&quot;</span><span class="p">);}</span> </span><span id="L-4"><a name="L-4"></a><span class="k">else</span><span class="p">{</span><span class="nx">rText</span><span class="o">=</span><span class="nx">oText</span><span class="p">;</span><span class="nx">$tObj</span><span class="p">.</span><span class="nx">css</span><span class="p">(</span><span class="s2">&quot;font-family&quot;</span><span class="p">,</span><span class="s2">&quot;A_Ilham, A_Randhoo, A_Faruma, A_Waheed&quot;</span><span class="p">);</span><span class="nx">$tObj</span><span class="p">.</span><span class="nx">css</span><span class="p">(</span><span class="s2">&quot;unicode-bidi&quot;</span><span class="p">,</span><span class="s2">&quot;bidi-override&quot;</span><span class="p">);}</span> </span><span id="L-5"><a name="L-5"></a><span class="nx">$tObj</span><span class="p">.</span><span class="nx">css</span><span class="p">(</span><span class="s2">&quot;direction&quot;</span><span class="p">,</span><span class="s2">&quot;rtl&quot;</span><span class="p">);</span><span class="nx">$tObj</span><span class="p">.</span><span class="nx">text</span><span class="p">(</span><span class="nx">rText</span><span class="p">);});</span><span class="k">return</span> <span class="k">this</span><span class="p">;};})(</span><span class="nx">jQuery</span><span class="p">);</span> </span></pre></div> </td></tr></table>
dhivehi, jquery, plugin, thaana