Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl($output) in /home/mchedlishvili.com/mike/WWW/wp-includes/classes.php on line 584

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl($output) in /home/mchedlishvili.com/mike/WWW/wp-includes/classes.php on line 584

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el($output) in /home/mchedlishvili.com/mike/WWW/wp-includes/classes.php on line 584

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el($output) in /home/mchedlishvili.com/mike/WWW/wp-includes/classes.php on line 584

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el($output) in /home/mchedlishvili.com/mike/WWW/wp-includes/classes.php on line 603

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl($output) in /home/mchedlishvili.com/mike/WWW/wp-includes/classes.php on line 702

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl($output) in /home/mchedlishvili.com/mike/WWW/wp-includes/classes.php on line 702

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el($output) in /home/mchedlishvili.com/mike/WWW/wp-includes/classes.php on line 702

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el($output) in /home/mchedlishvili.com/mike/WWW/wp-includes/classes.php on line 702

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el($output) in /home/mchedlishvili.com/mike/WWW/wp-includes/classes.php on line 727

Strict Standards: Redefining already defined constructor for class wpdb in /home/mchedlishvili.com/mike/WWW/wp-includes/wp-db.php on line 58

Deprecated: Assigning the return value of new by reference is deprecated in /home/mchedlishvili.com/mike/WWW/wp-includes/cache.php on line 99

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /home/mchedlishvili.com/mike/WWW/wp-includes/cache.php on line 404

Deprecated: Assigning the return value of new by reference is deprecated in /home/mchedlishvili.com/mike/WWW/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/mchedlishvili.com/mike/WWW/wp-includes/theme.php on line 576

Deprecated: Assigning the return value of new by reference is deprecated in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/exec-php/exec-php.php on line 22

Deprecated: Assigning the return value of new by reference is deprecated in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/exec-php/includes/manager.php on line 34

Deprecated: Assigning the return value of new by reference is deprecated in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/exec-php/includes/manager.php on line 35

Deprecated: Assigning the return value of new by reference is deprecated in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/exec-php/includes/manager.php on line 36

Deprecated: Assigning the return value of new by reference is deprecated in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/exec-php/includes/admin.php on line 42

Deprecated: Assigning the return value of new by reference is deprecated in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/exec-php/includes/admin.php on line 48

Deprecated: Assigning the return value of new by reference is deprecated in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/exec-php/includes/admin.php on line 49

Deprecated: Assigning the return value of new by reference is deprecated in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/exec-php/includes/admin.php on line 50

Deprecated: Assigning the return value of new by reference is deprecated in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/exec-php/includes/ajax.php on line 61

Deprecated: Assigning the return value of new by reference is deprecated in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/exec-php/includes/cache.php on line 33

Deprecated: Assigning the return value of new by reference is deprecated in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/exec-php/includes/cache.php on line 42

Strict Standards: Redefining already defined constructor for class ngg_Tags in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/nextgen-gallery/lib/nggallery.lib.php on line 559
JavaScript | Миша.Мчедлишвили


Strict Standards: Non-static method nggallery::get_option() should not be called statically in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/nextgen-gallery/nggfunctions.php on line 10

Полезная штука. Проверено.



Strict Standards: Non-static method nggallery::get_option() should not be called statically in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/nextgen-gallery/nggfunctions.php on line 10

Evolmate решил собрать маленькую коллекцию сайтов с разного рода бесплатными шаблонами. Итак, внутри - список сайтов и короткие обзоры. Буду дополнять и обновлять. На этих сайтах представлены как сами скрипты, так и примеры их использования.


Продолжение »



Strict Standards: Non-static method nggallery::get_option() should not be called statically in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/nextgen-gallery/nggfunctions.php on line 10
  1. <script type="text/javascript">
  2. //IE5+, Mozilla 1.0+, Opera 7+
  3.  
  4. function getClientWidth()
  5. {
  6.   return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
  7. }
  8.  
  9. function getClientHeight()
  10. {
  11.   return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
  12. }
  13.  
  14. </script>


Strict Standards: Non-static method nggallery::get_option() should not be called statically in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/nextgen-gallery/nggfunctions.php on line 10

Андриенко Илье было нужно немножко изменить текст. Чтобы выглядел “по-злому”. Результатом этого “нужно” он написал следующий простенький код, приведеный ниже:

  1. <HTML>
  2. <HEAD>
  3. <TITLE>Translit</TITLE>
  4. <META http-equiv=Content-Type content=”text/html; charset=windows-1251>
  5. <link href=”style.css” rel=”stylesheet” type=”text/css”>
  6. </HEAD>
  7. <SCRIPT language=”JavaScript” type=”text/javascript”>
  8.  
  9. f = “абгдезиклмнопрстуцчшъ”;
  10. r = “a6ґgє3µЌљm#°€p©†yџ4wЂ”;
  11.  
  12. function satanize(str)
  13. {
  14. str=str.toLowerCase();
  15. var len = str.length;
  16. var new_str=”";
  17.  
  18. for (i = 0; i < len; i++)
  19. {
  20. var c = str.substr(i, 1);
  21. var pos = f.indexOf(c);
  22. if (pos < 0)
  23. new_str+= c;
  24. else
  25. new_str+= r.substr(pos, 1);
  26. }
  27. return new_str;
  28. }
  29. </script>
  30.  
  31. <form name=”form1″ id=”form1″>
  32. <input type=”text” id=”textfi”>
  33. <input type=”button” onClick=”with(document.form1.textfi) {value=satanize(value); focus(); }return false;” value=”Satanize!”>
  34. </form>

Скриптик переводит строку к иному виду, “злому” ;)

Например, строка

“Карл у Клары украл Кораллы,
А Клара у Карла - украла кларнет!”

Станет строкой

“Ќapљ y Ќљapы yЌpaљ Ќ°paљљы,
a Ќљapa y Ќapљa - yЌpaљa Ќљap#є†!”

Более-менее читаемо :)



Strict Standards: Non-static method nggallery::get_option() should not be called statically in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/nextgen-gallery/nggfunctions.php on line 10

Для округления в Javascript вещественного числа до N знаков после запятой воспользуемся методом toFixed объекта Number:

  1. (3.2489).toFixed(2); //3.24
  2. Math.PI.toFixed(4); //3.1416 - число π с 4 знаками после запятой

Метод toFixed возвращает число в виде строки с заданным числом цифр после запятой.



Strict Standards: Non-static method nggallery::get_option() should not be called statically in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/nextgen-gallery/nggfunctions.php on line 10

Допустим есть основное окно которое открывает дочернее, используя window.open(). Для обращения к родительскому окну, в дочернем существует объект window.opener, который ссылается на объект window родителя. Рассмотрим пример (перезагрузить родительское окно из дочернего):

  1. /*Этот код находится в дочернем окне.
  2. Если родительское окно открыто, перегружаем его */
  3.  
  4. if(window.opener) window.opener.location.reload();


Strict Standards: Non-static method nggallery::get_option() should not be called statically in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/nextgen-gallery/nggfunctions.php on line 10
  1. String.prototype.delayingWrite = function(obj, delay)
  2. {
  3.  if (this.lengt>0)
  4.  {
  5.   if (typeof obj == 'string') obj = document.getElementById(obj);
  6.  
  7.   obj.innerHTML += this.charAt(0);
  8.   s = this.substr(1);
  9.  
  10.   if (s) setTimeout(function(){s.delayingWrite(obj, delay);},delay);
  11.  }
  12. }

Пример: "Вот такая печатная машинка!".delayingWrite('divID',50);



Strict Standards: Non-static method nggallery::get_option() should not be called statically in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/nextgen-gallery/nggfunctions.php on line 10
  1. function getRadioGroupValue(radioGroupObj)
  2. {
  3.   for (var i=0; i < radioGroupObj.length; i++)
  4.     if (radioGroupObj[i].checked) return radioGroupObj[i].value;
  5.  
  6.   return null;
  7. }

Использовать так:

  1. var v = getRadioGroupValue(document.formName.radioName);

Если не отмечен ни один элемент, функция вернет null.



Strict Standards: Non-static method nggallery::get_option() should not be called statically in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/nextgen-gallery/nggfunctions.php on line 10
  1. function mouseLayerXY(e)
  2. {
  3.   if (!e) {e = window.event; e.target = e.srcElement}
  4.   var x = 0;
  5.   var y = 0;
  6.  
  7.   if (e.layerX) // Gecko
  8.   {
  9.     x = e.layerX - parseInt(getElementComputedStyle(e.target, "border-left-width"));
  10.     y = e.layerY - parseInt(getElementComputedStyle(e.target, "border-top-width"));
  11.   }
  12.   else if (e.offsetX) // IE, Opera
  13.   {
  14.     x = e.offsetX;
  15.     y = e.offsetY;
  16.   }
  17.  
  18.   return {"x":x, "y":y};
  19. }

Функция возвращает объект со свойствами x, y, определяющими координаты курсора.

Функция getElementComputedStyle описывалась ранее



Strict Standards: Non-static method nggallery::get_option() should not be called statically in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/nextgen-gallery/nggfunctions.php on line 10

IE5+, Mozilla/Gecko, Opera 7+

  1. function mousePageXY(e)
  2. {
  3.   var x = 0, y = 0;
  4.  
  5.   if (!e) e = window.event;
  6.  
  7.   if (e.pageX || e.pageY)
  8.   {
  9.     x = e.pageX;
  10.     y = e.pageY;
  11.   }
  12.   else if (e.clientX || e.clientY)
  13.   {
  14.     x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
  15.     y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
  16.   }
  17.  
  18.   return {"x":x, "y":y};
  19. }

Функция возвращает объект со свойствами x, y, определяющими координаты курсора.

Пример использования:

  1. document.onmousemove = function(e){var mCur = mousePageXY(e); window.status = "X:"+mCur.x+" - Y:"+mCur.y;};