/* Target all Firefox */ #selector[id=selector] { color: red; } /* Target all Firefox */ @-moz-document url-prefix() { .selector { color: red; } } /* Target all Gecko (includes Firefox) */ *>.selector { color: red; } |
среда, 13 февраля 2013 г.
хак для firefox или как применить стиль только для firefox
создание многоуровневых раскрывающихся списков на jquery
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | <!--DOCTYPE HTML--> <meta charset= "UTF-8" > <title></title> <script type= "text/javascript" src= "https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js" > </script> ‹script type= "text/javascript" > $( function (){ $( 'li:has(ul.li-slider)' ) .click( function (event){ if (this == event.target) { if ($(this).children().is( ':hidden' )) { $(this) .css( 'list-style-image' , 'url(minus.gif)' ) .children().slideDown(); } else { $(this) .css( 'list-style-image' , 'url(plus.gif)' ) .children().slideUp(); } } return false; }) .css({cursor: 'pointer' , 'list-style-image' : 'url(plus.gif)' }) .children().hide(); $( 'li:not(:has(ul.li-slider))' ).css({ cursor: 'default' , 'list-style-image' : 'none' }); }); ‹/script> <ul class = "li-slider" > <li style= "cursor: default; list-style-image: none;" >Авто <ul class = "li-slider" > <li style= "cursor: default; list-style-image: none;" >1</li> <li style= "cursor: default; list-style-image: none;" >2</li> <li style= "cursor: default; list-style-image: none;" >3</li> <li style= "cursor: default; list-style-image: none;" >4</li> <li style= "cursor: default; list-style-image: none;" >ul ниже не будет раскрываться для того чтобы он мог раскрываться добавьте ему class = "li-slider" <ul> <li style= "cursor: default; list-style-image: none;" >1</li> <li style= "cursor: default; list-style-image: none;" >2</li> <li style= "cursor: default; list-style-image: none;" >3</li> <li style= "cursor: default; list-style-image: none;" >4</li> <li style= "cursor: default; list-style-image: none;" >5</li> </ul> </li> </ul> </li> </ul> |
- Авто
- 2
- 1
- 1
- 2
- 3
- 4
- 5
- 2
- 1
- 2
- 3
- 4
- 5
- 3
- 1
- 2
- 3
- 4
- 5
- 4
- 1
- 2
- 3
- 4
- 5
- 5
- 1
- 2
- 3
- 4
- 5
- 1
- 2
пятница, 8 февраля 2013 г.
сделать подсветку синтаксиса на вашем сайте
часто возникает необходимость встроить полсветку сетаксиса на ваш блок вставте с ваш блог следующие скрипты
1 2 3 | < pre class = "brush:php" > //ваш код < pre > |
четверг, 7 февраля 2013 г.
jquery на гугле
очень удобно грузить jquery не с локала а из исходников google как миниум по тому что она может скрипт может быть закеширован как следствие снижение времени на загрузку
проверяем доступность jquery если не доступно то грузим с локала
1 | < script type = "text/javascript" src = "https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js" > < / script > |
1 | < script type = "text/javascript" >window.jQuery || document.write('< script src = "js/jquery-1.8.1.min.js" ><\/script>') </ script > |
понедельник, 4 февраля 2013 г.
RewriteEngine
содержимое .htaccess
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
воскресенье, 3 февраля 2013 г.
виртуальная секция
<VirtualHost *:80>
ServerAdmin mail@mail.mail
ServerName oop
DocumentRoot /home/user/www/oop
<Directory /home/user/www/oop>
Options FollowSymLinks
AllowOverride ALL
</Directory>
</VirtualHost>
паттерн command php
паттерн command php
реализация
реализация
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | "; ////////////////////////////////////////////// abstract class Command { abstract function execute( CommandContext $context ); } class LoginCommand extends Command{ function execute( CommandContext $context ){ $user = $context ->get( 'username' ); $pass = $context ->get( 'pass' ); Loger::write( "enter user: " . $user ); return true; } } class CommandContext { private $params = array (); private $error = "" ; function __construct() { $this ->params = $_REQUEST ; } function addParam( $key , $val ){ $this ->params[ $key ] = $val ; } function get( $key ){ return $this ->params[ $key ]; } function setError( $error ){ $this -> $error = $error ; } function getError(){ return $this ->error; } } class CommandNotFoundException extends Exception {} class CommandFactory { private static $dir = "commands" ; static function getCommand( $action = 'default' ){ if (preg_match( '/\W/' , $action )){ throw new CommandNotFoundExceptioin( 'Недопустимые символы в комманде' ); } $class = $action . "Command" ; /*//времено //возможен иклюдинг предусмотреть $class = $action.".ph $file = self::$dir.DIRECTORY_SEPARATOR if (!file_exists($file)){ throw new CommandNotFoundExceptioin('не найден файл '.$file); } require_once( $file ); */ if (! class_exists ( $class )){ throw new CommandNotFoundExceptioin( 'не найден класс ' . $class ); } $cmd = new $class (); return $cmd ; } } class Controller { private $context ; function __construct(){ $this ->context = new CommandContext(); } function getContext(){ return $this ->context; } function process(){ //var_dump( $this->context->get('action') ); $cmd = CommandFactory::getCommand( $this ->context->get( 'action' ) ); if ( ! $cmd ->execute( $this ->context) ){ //обработка ошибок } else { //все прошло успешно //Теперь отобразим результаты } } } $controler = new Controller(); //эмулируем действия пользователя $context = $controler ->getContext(); $context ->addParam( 'action' , 'Login' ); $context ->addParam( 'username' , 'jo' ); $context ->addParam( 'pass' , '1' ); $controler ->process(); ?> |
Подписаться на:
Сообщения (Atom)