<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    倉藍

    日記本

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      23 Posts :: 0 Stories :: 1 Comments :: 0 Trackbacks

    2014年1月6日 #

         摘要: 適合Linux系統使用的命令,本文以亞馬遜的Amazon Linux 為用例,希望對朋友們有點幫助!切換至root用戶    sudo su  安裝screen    yum install screen       yum update  安裝Apache,MySQL...  閱讀全文
    posted @ 2014-01-10 10:45 cangshi 閱讀(1763) | 評論 (0)編輯 收藏

    希望WP愛好者能夠喜歡并嘗試一下‘

    1.樣式表

    1. /*SidebarTabsAd*/  
    2. #cwpad_box{width:100%;text-align:center}   
    3. #cwpad_box ul, #cwpad_box dd, #cwpad_box tt{   
    4.     margin:0px;   
    5.     padding:0px;   
    6.     float:left;   
    7.     list-style: none;   
    8. }   
    9. #cwpad_box{   
    10.     width:313px;/*250px+(n-1)*21px*/  
    11.     height:250px;   
    12.     border-left: 1px solid #740a20;   
    13. }   
    14. #cwpad_box dd{   
    15.     width:21px;   
    16.     height:250px;   
    17.     overflow:hidden;   
    18.     position:relative;   
    19. }   
    20. #cwpad_box dd.hove{   
    21.     width:250px;   
    22.     text-align:rightright;   
    23. }   
    24. #cwpad_box dd tt{   
    25.     width:20px;   
    26.     height:250px;   
    27.     top:0px;   
    28.     left:0px;   
    29.     color:#fff;   
    30.     cursor:pointer;   
    31.     text-align:center;   
    32.     padding:20px 0 0 0;   
    33.     background:#b9000d;   
    34.     position:absolute;   
    35.     border-right:1px solid #740a20;   
    36. }   
    37. #cwpad_box dd tt.hove{   
    38.     background:#620317;   
    39. }  

    在上面的樣式表中,假設放置的是四個250px*250px的圖片廣告,所以250+(4-1)*21=313px。

    2.javascript代碼

    1. <script type="text/javascript">   
    2. function myAddEvent(obj, sEvent, fn){   
    3.     return obj.attachEvent ? obj.attachEvent('on' + sEvent, fn) : obj.addEventListener(sEvent, fn, false);   
    4. }   
    5. function Class(oParent, sClass){   
    6.     var aElem = oParent.getElementsByTagName('*');   
    7.     var aClass = [];   
    8.     var i = 0;   
    9.     for(i=0;i<aElem.length;i++)if(aElem[i].className == sClass)aClass.push(aElem[i]);   
    10.     return aClass;   
    11. };   
    12. function css(obj, attr, value){   
    13.     if(arguments.length == 2){   
    14.         var style = obj.style,   
    15.             currentStyle = obj.currentStyle;   
    16.         if(typeof attr === 'string')return currentStyle ? currentStyle[attr] : getComputedStyle(obj, false)[attr];   
    17.         for(var propName in attr)propName == 'opacity' ? (style.filter = "alpha(opacity=" + attr[propName] + ")", style.opacity = attr[propName] / 100) : style[propName] = attr[propName];    
    18.     }else if(arguments.length == 3){   
    19.         switch(attr){   
    20.             case "width":   
    21.             case "height":   
    22.             case "paddingTop":   
    23.             case "paddingRight":   
    24.             case "paddingBottom":   
    25.             case "paddingLeft":   
    26.             case "top":   
    27.             case "right":   
    28.             case "bottom":   
    29.             case "left":   
    30.             case "marginTop":   
    31.             case "marginRigth":   
    32.             case "marginBottom":   
    33.             case "marginLeft":   
    34.                 obj.style[attr] = value + "px";   
    35.                 break;   
    36.             case "opacity":   
    37.                 obj.style.filter = "alpha(opacity=" + value + ")";   
    38.                 obj.style.opacity = value / 100;   
    39.                 break;   
    40.             default:   
    41.                 obj.style[attr] = value   
    42.         }   
    43.     }   
    44. };   
    45. function extend(destination, source){   
    46.     for (var propName in source) destination[propName] = source[propName];   
    47.     return destination   
    48. };   
    49. function doMove(obj, json, fnEnd){   
    50.     clearInterval(obj.timer);   
    51.     obj.iSpeed = 0;   
    52.     fnEnd = extend({   
    53.         type: "buffer",   
    54.         callback: function() {}   
    55.     }, fnEnd);   
    56.     obj.timer = setInterval(function(){   
    57.         var iCur = 0,   
    58.             iStop = true;   
    59.         for(var propName in json){   
    60.             iCur = parseFloat(css(obj, propName));   
    61.             propName == 'opacity' && (iCur = Math.round(iCur * 100));   
    62.             switch(fnEnd.type){   
    63.                 case 'buffer':   
    64.                     obj.iSpeed = (json[propName] - iCur) / 5;   
    65.                     obj.iSpeed = obj.iSpeed > 0 ? Math.ceil(obj.iSpeed) : Math.floor(obj.iSpeed);   
    66.                     json[propName] == iCur || (iStop = false, css(obj, propName, iCur + obj.iSpeed));   
    67.                     break;   
    68.                 case 'elasticity':   
    69.                     obj.iSpeed += (json[propName] - iCur) / 5;   
    70.                     obj.iSpeed *= 0.75;   
    71.                     Math.abs(json[propName] - iCur) <= 1 &&  Math.abs(obj.iSpeed) <= 1 ? css(obj, propName, json[propName]) : css(obj, propName, json[propName]) || (iStop = false, css(obj, propName, iCur + obj.iSpeed));   
    72.                     break;   
    73.                 case 'accelerate':   
    74.                     obj.iSpeed = obj.iSpeed + 5;   
    75.                     iCur >= json[propName] ? css(obj, propName, json[propName]) : css(obj, propName, json[propName]) || (iStop = false, css(obj, propName, iCur + obj.iSpeed));   
    76.                 break;   
    77.             }   
    78.         }   
    79.         if(iStop){   
    80.             clearInterval(obj.timer);   
    81.             obj.timer = null;   
    82.             obj.iSpeed = 0;   
    83.             fnEnd.callback();   
    84.         }   
    85.     },30);   
    86. };   
    87.   
    88. window.onload = function(){   
    89.     var oBox = document.getElementById('cwpad_box')   
    90.     var aSpan = document.getElementsByTagName('tt');   
    91.     var aLi = document.getElementsByTagName('dd');   
    92.     var playtime = null;   
    93.     var iNow = 0;   
    94.     for(i=0;i<aSpan.length;i++){   
    95.         aSpan[i].index = i;   
    96.         aSpan[i].onclick = function(){   
    97.             for(var len=aLi.length,i=0;i<len;i++)doMove(aLi[i], {width:21});   
    98.             for(var len=aSpan.length,i=0;i<len;i++)aSpan[i].className = '';   
    99.             this.className = 'hove';   
    100.             doMove(this.parentNode, {width:250});   
    101.             iNow = this.index;   
    102.         };   
    103.     }   
    104.     playtime = setInterval(tab,3500);   
    105.     oBox.onmouseover = function(){   
    106.         clearInterval(playtime);   
    107.     }   
    108.     oBox.onmouseout = function(){   
    109.         playtime = setInterval(tab,3500);   
    110.     }   
    111.     function tab(){   
    112.         iNow == aLi.length-1 ? iNow = 0 : iNow++;   
    113.         aSpan[iNow].onclick();   
    114.     }   
    115. };   
    116.  </script>    

     

    3.示例的HTML代碼

    1. <div id="cwpad_box">  
    2.     <ul>  
    3.         <dd  class="hove">  
    4.         <tt class="hove">網站設計及培訓</tt>  
    5.         <a ></a>  
    6.         </dd>  
    7.     </ul>  
    8. </div>  

    使用的是索凌網絡前面介紹過的"假圖"生成網站fakeimg.pl生成的"假圖"。

    這組代碼的一個顯著缺點是:不適合移動設備顯示。

    posted @ 2014-01-08 11:20 cangshi 閱讀(268) | 評論 (0)編輯 收藏

    1. if(is_admin())   

    2. {   

    3.     new Cool_Wp_List_Table();   

    4. }   

    5.   

    6. /**  

    7.  * Cool_Wp_List_Table class will create the page to load the table  

    8.  */  

    9. class Cool_Wp_List_Table   

    10. {   

    11.     /**  

    12.      * Constructor will create the menu item  

    13.      */  

    14.     public function __construct()   

    15.     {   

    16.         add_action( 'admin_menu', array($this, 'add_menu_example_list_table_page' ));   

    17.     }   

    18.   

    19.     /**  

    20.      * Menu item will allow us to load the page to display the table  

    21.      */  

    22.     public function add_menu_example_list_table_page()   

    23.     {   

    24.         add_menu_page( 'Coowp示例表格', 'Coowp示例表格', 'manage_options', 'coolwp-list-table.php', array($this, 'list_table_page') );   

    25.     }   

    26.   

    27.     /**  

    28.      * Display the list table page  

    29.      *  

    30.      * @return Void  

    31.      */  

    32.     public function list_table_page()   

    33.     {   

    34.         $exampleListTable = new Example_List_Table();   

    35.         $exampleListTable->prepare_items();   

    36.         ?>   

    37.             <div class="wrap">   

    38.                 <div id="icon-users" class="icon32"></div>   

    39.                 <h2>Coowp示例表格-頁面標題</h2>   

    40.                 <?php $exampleListTable->display(); ?>   

    41.             </div>   

    42.         <?php   

    43.     }   

    44. }   

    45.   

    46. // WP_List_Table is not loaded automatically so we need to load it in our application   

    47. if( ! class_exists( 'WP_List_Table' ) ) {   

    48.     require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );   

    49. }   

    50.   

    51. /**  

    52.  * Create a new table class that will extend the WP_List_Table  

    53.  */  

    54. class Example_List_Table extends WP_List_Table   

    55. {   

    56.     /**  

    57.      * Prepare the items for the table to process  

    58.      *  

    59.      * @return Void  

    60.      */  

    61.     public function prepare_items()   

    62.     {   

    63.         $columns = $this->get_columns();   

    64.         $hidden = $this->get_hidden_columns();   

    65.         $sortable = $this->get_sortable_columns();   

    66.   

    67.         $data = $this->table_data();   

    68.         usort( $data, array( &$this, 'sort_data' ) );   

    69.   

    70.         $perPage = 2;   

    71.         $currentPage = $this->get_pagenum();   

    72.         $totalItems = count($data);   

    73.   

    74.         $this->set_pagination_args( array(   

    75.             'total_items' => $totalItems,   

    76.             'per_page'    => $perPage  

    77.         ) );   

    78.   

    79.         $data = array_slice($data,(($currentPage-1)*$perPage),$perPage);   

    80.   

    81.         $this->_column_headers = array($columns, $hidden, $sortable);   

    82.         $this->items = $data;   

    83.     }   

    84.   

    85.     /**  

    86.      * Override the parent columns method. Defines the columns to use in your listing table  

    87.      *  

    88.      * @return Array  

    89.      */  

    90.     public function get_columns()   

    91.     {   

    92.         $columns = array(   

    93.             'id'          => __('ID'),   

    94.             'title'       => __('Title'),   

    95.             'description' => __('描述'),   

    96.             //__('Description'),怎么被Wordpress翻譯為“圖像描述”了?   

    97.             'date'        => __('Date'),   

    98.             'price'    => __('價格'),//__('Price'),   

    99.             'rating'      => __('Rating')   

    100.         );   

    101.   

    102.         return $columns;   

    103.     }   

    104.   

    105.     /**  

    106.      * Define which columns are hidden  

    107.      *  

    108.      * @return Array  

    109.      */  

    110.     public function get_hidden_columns()   

    111.     {   

    112.         return array();   

    113.     }   

    114.   

    115.     /**  

    116.      * Define the sortable columns  

    117.      *  

    118.      * @return Array  

    119.      */  

    120.     public function get_sortable_columns()   

    121.     {   

    122.         return array('title' => array('title', false));   

    123.     }   

    124.   

    125.     /**  

    126.      * Get the table data  

    127.      *  

    128.      * @return Array  

    129.      */  

    130.     private function table_data()   

    131.     {   

    132.         $data = array();   

    133.   

    134.         $data[] = array(   

    135.                     'id'          => 1,   

    136.                     'title'       => '某IT設備租賃公司:楊先生',   

    137.                     'description' => '上海,需求描述',   

    138.                     'date'        => '2013.01.01',   

    139.                     'price'       => '---',   

    140.                     'rating'      => '7.3'   

    141.                     );   

    142.   

    143.         $data[] = array(   

    144.                     'id'          => 2,   

    145.                     'title'       => '某婚攝團隊:李先生',   

    146.                     'description' => '臺灣,臺北',   

    147.                     'date'        => '2013.12.15',   

    148.                     'price'       => '---',   

    149.                     'rating'      => '7.2'   

    150.                     );   

    151.   

    152.         $data[] = array(   

    153.                     'id'          => 3,   

    154.                     'title'       => '在校研究生:梁小姐',   

    155.                     'description' => '墨爾本大學:藝術設計',   

    156.                     'date'        => '2013.12.03',   

    157.                     'price'       => '---',   

    158.                     'rating'      => '7.0'   

    159.                     );   

    160.   

    161.         $data[] = array(   

    162.                     'id'          => 4,   

    163.                     'title'       => '某私人航空公司',   

    164.                     'description' => '僅前端交互:何小姐',   

    165.                     'date'        => '2014.01.01',   

    166.                      'price'      => '---',   

    167.                     'rating'      => '7.0'   

    168.                     );   

    169.         return $data;   

    170.     }   

    171.   

    172.     /**  

    173.      * Define what data to show on each column of the table  

    174.      *  

    175.      * @param  Array $item        Data  

    176.      * @param  String $column_name - Current column name  

    177.      *  

    178.      * @return Mixed  

    179.      */  

    180.     public function column_default( $item, $column_name )   

    181.     {   

    182.         switch( $column_name ) {   

    183.             case 'id':   

    184.             case 'title':   

    185.             case 'description':   

    186.             case 'date':   

    187.             case 'price':   

    188.             case 'rating':   

    189.                 return $item[ $column_name ];   

    190.   

    191.             default:   

    192.                 return print_r( $item, true ) ;   

    193.         }   

    194.     }   

    195.   

    196.     /**  

    197.      * Allows you to sort the data by the variables set in the $_GET  

    198.      *  

    199.      * @return Mixed  

    200.      */  

    201.     private function sort_data( $a, $b )   

    202.     {   

    203.         // Set defaults   

    204.         $orderby = 'title';   

    205.         $order = 'asc';   

    206.   

    207.         // If orderby is set, use this as the sort column   

    208.         if(!emptyempty($_GET['orderby']))   

    209.         {   

    210.             $orderby = $_GET['orderby'];   

    211.         }   

    212.   

    213.         // If order is set use this as the order   

    214.         if(!emptyempty($_GET['order']))   

    215.         {   

    216.             $order = $_GET['order'];   

    217.         }   

    218.   

    219.         $result = strcmp( $a[$orderby], $b[$orderby] );   

    220.   

    221.         if($order === 'asc')   

    222.         {   

    223.             return $result;   

    224.         }   

    225.   

    226.         return -$result;   

    227.     }   

    228. }  

    ENJOY IT!
    posted @ 2014-01-06 11:03 cangshi 閱讀(274) | 評論 (0)編輯 收藏

    主站蜘蛛池模板: 久久久久亚洲精品无码蜜桃| 成人毛片手机版免费看| 国产小视频免费观看| 亚洲色精品VR一区区三区| 成年人免费的视频| 亚洲精品熟女国产| 精品女同一区二区三区免费站| 久热综合在线亚洲精品| 久久国产精品一区免费下载| 亚洲精品少妇30p| 日本免费中文字幕| 久久久亚洲欧洲日产国码二区| 一级成人a毛片免费播放| 亚洲国产天堂久久综合网站| 亚洲一区免费观看| 亚洲一区二区三区久久| 女人18毛片水真多免费播放| 亚洲无人区码一二三码区别图片 | 免费无遮挡无码永久在线观看视频| 亚洲日韩精品A∨片无码加勒比| 女人18毛片水真多免费看| 亚洲AV色欲色欲WWW| 亚洲精品国产精品国自产观看| free哆拍拍免费永久视频| 亚洲男人的天堂www| 午夜理伦剧场免费| 亚洲一区二区三区在线网站| 黑人粗长大战亚洲女2021国产精品成人免费视频 | 激情婷婷成人亚洲综合| 国产亚洲精品精品国产亚洲综合| 你懂的免费在线观看| 亚洲一区二区三区日本久久九| av无码国产在线看免费网站| 亚洲av无码片vr一区二区三区| 久久久久亚洲爆乳少妇无| 99久久国产免费中文无字幕| 亚洲精品国产精品| 情人伊人久久综合亚洲| 91在线手机精品免费观看| 亚洲最大的成人网| 6080午夜一级毛片免费看|