• Страница 1 из 1
  • 1
"Получить код" для ucoz в ajax
Дмитрий Дата: Пятница, 31.08.2012, 10:19 | Сообщение # 1 | Сообщить о нерабочей теме


Аватар для Дмитрий



Скрипт "Получить код" поможет Вам и Вашим пользователям быстро выделить нужный код. При нажатии на кнопку получить код открывается код в отдельном ajax окне. Скрипт "Получить код" можно использовать на сайте и на форуме. Об установке ниже. Скрипт ucoz увидеть в работе можно на нашем сайте.

Скрипт "Получить код" для сайта

Quote
П.У - Дизайн - Управление дизайном - Страница материала и комментариев к нему(для любого модуля) после $MESSAGE$ вставляем:


Code
<span class="xml-punctuation"><</span><span class="xml-tagname">script </span><span class="xml-attname">type</span><span class="xml-punctuation">=</span><span class="xml-attribute">"text/javascript"</span><span class="xml-punctuation">> </span>  
<span class="whitespace"> </span><span class="js-variable">$</span><span class="js-punctuation">(</span><span class="js-string">".bbCodeName:contains('Code')"</span><span class="js-punctuation">)</span><span class="js-punctuation">.</span><span class="js-property">html</span><span class="js-punctuation">(</span><span class="js-string">"<a href='javascript://' style='color:#2C68A6;font-weight:bold;text-decoration:none;margin-left:5px;' id='getcode'>Получить код</a>"</span><span class="js-punctuation">)</span><span class="js-punctuation">; </span>  
<span class="whitespace"> </span><span class="js-variable">$</span><span class="js-punctuation">(</span><span class="js-string">"#getcode"</span><span class="js-punctuation">)</span><span class="js-punctuation">.</span><span class="js-property">live</span><span class="js-punctuation">(</span><span class="js-string">"click"</span><span class="js-punctuation">,</span><span class="js-keyword">function</span><span class="js-punctuation">(</span><span class="js-punctuation">) </span><span class="js-punctuation">{ </span>  
<span class="whitespace"> </span><span class="js-variable">codes </span><span class="js-operator">= </span><span class="js-variable">$</span><span class="js-punctuation">(</span><span class="js-localvariable">this</span><span class="js-punctuation">)</span><span class="js-punctuation">.</span><span class="js-property">parent</span><span class="js-punctuation">(</span><span class="js-punctuation">)</span><span class="js-punctuation">.</span><span class="js-property">next</span><span class="js-punctuation">(</span><span class="js-punctuation">)</span><span class="js-punctuation">.</span><span class="js-property">html</span><span class="js-punctuation">(</span><span class="js-punctuation">)</span><span class="js-punctuation">; </span>  
<span class="whitespace"> </span><span class="js-variable">lencodes </span><span class="js-operator">= </span><span class="js-variable">codes</span><span class="js-punctuation">.</span><span class="js-property">length</span><span class="js-punctuation">; </span>  
<span class="whitespace"> </span><span class="js-variable">replcode </span><span class="js-operator">= </span><span class="js-string">/<!--uzc-->/ </span>  
<span class="whitespace"> </span><span class="js-variable">replcode2 </span><span class="js-operator">= </span><span class="js-string">/<!--\/uzc-->/ </span>  
<span class="whitespace"> </span><span class="js-variable">replcode3 </span><span class="js-operator">= </span><span class="js-string">/<br>/g </span>  
<span class="whitespace"> </span><span class="js-variable">resultCode </span><span class="js-operator">= </span><span class="js-variable">codes</span><span class="js-punctuation">.</span><span class="js-variable">replace</span><span class="js-punctuation">(</span><span class="js-variable">replcode</span><span class="js-punctuation">, </span><span class="js-string">""</span><span class="js-punctuation">)</span><span class="js-punctuation">.</span><span class="js-variable">replace</span><span class="js-punctuation">(</span><span class="js-variable">replcode2</span><span class="js-punctuation">, </span><span class="js-string">""</span><span class="js-punctuation">)</span><span class="js-punctuation">.</span><span class="js-variable">replace</span><span class="js-punctuation">(</span><span class="js-variable">replcode3</span><span class="js-punctuation">, </span><span class="js-string">"\n"</span><span class="js-punctuation">)</span><span class="js-punctuation">; </span>  
<span class="whitespace"> </span><span class="js-keyword">new </span><span class="js-variable">_uWnd</span><span class="js-punctuation">(</span><span class="js-string">'getC'</span><span class="js-punctuation">,</span><span class="js-string">'Получение кода для "$ENTRY_TITLE$"'</span><span class="js-punctuation">,</span><span class="js-atom">600</span><span class="js-punctuation">,</span><span class="js-atom">100</span><span class="js-punctuation">,</span><span class="js-punctuation">{</span><span class="js-property">align</span><span class="js-punctuation">:</span><span class="js-atom">0</span><span class="js-punctuation">,</span><span class="js-property">shadow</span><span class="js-punctuation">:</span><span class="js-atom">0</span><span class="js-punctuation">,</span><span class="js-property">close</span><span class="js-punctuation">:</span><span class="js-atom">1</span><span class="js-punctuation">,</span><span class="js-property">autosize</span><span class="js-punctuation">:</span><span class="js-atom">1</span><span class="js-punctuation">,</span><span class="js-property">maxh</span><span class="js-punctuation">:</span><span class="js-atom">500</span><span class="js-punctuation">,</span><span class="js-property">minh</span><span class="js-punctuation">:</span><span class="js-atom">100</span><span class="js-punctuation">,</span><span class="js-property">resize</span><span class="js-punctuation">:</span><span class="js-atom">0</span><span class="js-punctuation">}</span><span class="js-punctuation">, </span><span class="js-string">'<fieldset><legend>Код:</legend><textarea onfocus="select(this)" id="codes">'</span><span class="js-operator">+</span><span class="js-variable">resultCode</span><span class="js-operator">+</span><span class="js-string">'</textarea></fieldset><fieldset>Символов: <b>'</span><span class="js-operator">+</span><span class="js-variable">lencodes</span><span class="js-operator">+</span><span class="js-string">'</b></fieldset>' </span><span class="js-punctuation">)</span><span class="js-punctuation">; </span>  
<span class="whitespace"> </span><span class="js-punctuation">}</span><span class="js-punctuation">)</span><span class="js-punctuation">; </span>  
<span class="whitespace"> </span><span class="xml-punctuation"></</span><span class="xml-tagname">script</span><span class="xml-punctuation">> </span>  
<span class="whitespace"> </span><span class="xml-punctuation"><</span><span class="xml-tagname">style</span><span class="xml-punctuation">> </span>  
<span class="whitespace"> </span><span class="css-selector">#codes</span><span class="css-punctuation">{</span><span class="css-identifier">width</span><span class="css-punctuation">:</span><span class="css-unit">100%</span><span class="css-punctuation">;</span><span class="css-identifier">height</span><span class="css-punctuation">:</span><span class="css-unit">180px</span><span class="css-punctuation">;</span><span class="css-punctuation">} </span>  
<span class="whitespace"> </span><span class="xml-punctuation"></</span><span class="xml-tagname">style</span><span class="xml-punctuation">> </span>  
   


[reklama]Скрипт "Получить код" для форума [/reklama]

Quote
П.У - Дизайн - Управление дизайном - Форум - Вид материалов после $MESSAGE$ вставляем:


Code
<span class="xml-punctuation"><</span><span class="xml-tagname">script </span><span class="xml-attname">type</span><span class="xml-punctuation">=</span><span class="xml-attribute">"text/javascript"</span><span class="xml-punctuation">> </span>  
<span class="whitespace"> </span><span class="js-variable">$</span><span class="js-punctuation">(</span><span class="js-string">".bbCodeName:contains('Code')"</span><span class="js-punctuation">)</span><span class="js-punctuation">.</span><span class="js-property">html</span><span class="js-punctuation">(</span><span class="js-string">"<a href='javascript://' style='color:#2C68A6;font-weight:bold;text-decoration:none;margin-left:5px;' id='getcode'>Получить код</a>"</span><span class="js-punctuation">)</span><span class="js-punctuation">; </span>  
<span class="whitespace"> </span><span class="js-variable">$</span><span class="js-punctuation">(</span><span class="js-string">"#getcode"</span><span class="js-punctuation">)</span><span class="js-punctuation">.</span><span class="js-property">live</span><span class="js-punctuation">(</span><span class="js-string">"click"</span><span class="js-punctuation">,</span><span class="js-keyword">function</span><span class="js-punctuation">(</span><span class="js-punctuation">) </span><span class="js-punctuation">{ </span>  
<span class="whitespace"> </span><span class="js-variable">codes </span><span class="js-operator">= </span><span class="js-variable">$</span><span class="js-punctuation">(</span><span class="js-localvariable">this</span><span class="js-punctuation">)</span><span class="js-punctuation">.</span><span class="js-property">parent</span><span class="js-punctuation">(</span><span class="js-punctuation">)</span><span class="js-punctuation">.</span><span class="js-property">next</span><span class="js-punctuation">(</span><span class="js-punctuation">)</span><span class="js-punctuation">.</span><span class="js-property">html</span><span class="js-punctuation">(</span><span class="js-punctuation">)</span><span class="js-punctuation">; </span>  
<span class="whitespace"> </span><span class="js-variable">lencodes </span><span class="js-operator">= </span><span class="js-variable">codes</span><span class="js-punctuation">.</span><span class="js-property">length</span><span class="js-punctuation">; </span>  
<span class="whitespace"> </span><span class="js-variable">replcode </span><span class="js-operator">= </span><span class="js-string">/<!--uzc-->/ </span>  
<span class="whitespace"> </span><span class="js-variable">replcode2 </span><span class="js-operator">= </span><span class="js-string">/<!--\/uzc-->/ </span>  
<span class="whitespace"> </span><span class="js-variable">replcode3 </span><span class="js-operator">= </span><span class="js-string">/<br>/g </span>  
<span class="whitespace"> </span><span class="js-variable">resultCode </span><span class="js-operator">= </span><span class="js-variable">codes</span><span class="js-punctuation">.</span><span class="js-variable">replace</span><span class="js-punctuation">(</span><span class="js-variable">replcode</span><span class="js-punctuation">, </span><span class="js-string">""</span><span class="js-punctuation">)</span><span class="js-punctuation">.</span><span class="js-variable">replace</span><span class="js-punctuation">(</span><span class="js-variable">replcode2</span><span class="js-punctuation">, </span><span class="js-string">""</span><span class="js-punctuation">)</span><span class="js-punctuation">.</span><span class="js-variable">replace</span><span class="js-punctuation">(</span><span class="js-variable">replcode3</span><span class="js-punctuation">, </span><span class="js-string">"\n"</span><span class="js-punctuation">)</span><span class="js-punctuation">; </span>  
<span class="whitespace"> </span><span class="js-keyword">new </span><span class="js-variable">_uWnd</span><span class="js-punctuation">(</span><span class="js-string">'getC'</span><span class="js-punctuation">,</span><span class="js-string">'Получение кода'</span><span class="js-punctuation">,</span><span class="js-atom">600</span><span class="js-punctuation">,</span><span class="js-atom">100</span><span class="js-punctuation">,</span><span class="js-punctuation">{</span><span class="js-property">align</span><span class="js-punctuation">:</span><span class="js-atom">0</span><span class="js-punctuation">,</span><span class="js-property">shadow</span><span class="js-punctuation">:</span><span class="js-atom">0</span><span class="js-punctuation">,</span><span class="js-property">close</span><span class="js-punctuation">:</span><span class="js-atom">1</span><span class="js-punctuation">,</span><span class="js-property">autosize</span><span class="js-punctuation">:</span><span class="js-atom">1</span><span class="js-punctuation">,</span><span class="js-property">maxh</span><span class="js-punctuation">:</span><span class="js-atom">500</span><span class="js-punctuation">,</span><span class="js-property">minh</span><span class="js-punctuation">:</span><span class="js-atom">100</span><span class="js-punctuation">,</span><span class="js-property">resize</span><span class="js-punctuation">:</span><span class="js-atom">0</span><span class="js-punctuation">}</span><span class="js-punctuation">, </span><span class="js-string">'<fieldset><legend>Код:</legend><textarea onfocus="select(this)" id="codes">'</span><span class="js-operator">+</span><span class="js-variable">resultCode</span><span class="js-operator">+</span><span class="js-string">'</textarea></fieldset><fieldset>Символов: <b>'</span><span class="js-operator">+</span><span class="js-variable">lencodes</span><span class="js-operator">+</span><span class="js-string">'</b></fieldset>' </span><span class="js-punctuation">)</span><span class="js-punctuation">; </span>  
<span class="whitespace"> </span><span class="js-punctuation">}</span><span class="js-punctuation">)</span><span class="js-punctuation">; </span>  
<span class="whitespace"> </span><span class="xml-punctuation"></</span><span class="xml-tagname">script</span><span class="xml-punctuation">> </span>  
<span class="whitespace"> </span><span class="xml-punctuation"><</span><span class="xml-tagname">style</span><span class="xml-punctuation">> </span>  
<span class="whitespace"> </span><span class="css-selector">#codes</span><span class="css-punctuation">{</span><span class="css-identifier">width</span><span class="css-punctuation">:</span><span class="css-unit">100%</span><span class="css-punctuation">;</span><span class="css-identifier">height</span><span class="css-punctuation">:</span><span class="css-unit">180px</span><span class="css-punctuation">;</span><span class="css-punctuation">} </span>  
<span class="whitespace"> </span><span class="xml-punctuation"></</span><span class="xml-tagname">style</span><span class="xml-punctuation">></span>  
   


From Russia With Love!
  • Страница 1 из 1
  • 1
Поиск: