Chinaunix首页 | 论坛 | 博客
  • 博客访问: 583061
  • 博文数量: 95
  • 博客积分: 1573
  • 博客等级: 上尉
  • 技术积分: 1030
  • 用 户 组: 普通用户
  • 注册时间: 2011-12-23 10:46
个人简介

hello world!

文章分类

全部博文(95)

文章存档

2014年(1)

2013年(44)

2012年(50)

分类: LINUX

2012-07-20 09:14:55

原文路径:http://blog.csdn.net/c_spark/article/details/2918270

    1.Metacity主题:
    Metacity 主题是基于XML格式的,还有依赖于具体主题的一定数量的图片【通常是便携网络图形格式,PNG】。

    2.如何创建主题:
    要做的第一步是在下面的位置创建一个目录 -
        $PREFIX/share/themes/[theme_name]/metacity-1/
        $HOME/.themes/[theme_name]/metacity-1/
    按照您的主题名字起名。尽管 Metacity 会检测在上面的任一个位置的主题。但是,当您编写和调试之时,置主题于您的家目录下不失为明智之举。

    紧跟着的一步是编辑选定目录中的“metacity-theme-1.xml”文件。此文件包含主题的 XML 描述,该描述依循 DTD描述。当创建新 Metacity 主题时,不要完全从零开始,而是利用已有的主题,这非常有用的。

    格式最开始的几行是这样的
    
    
    
       Atlanta
       Havoc Pennington
       Havoc Pennington, 2002
       September 2, 2002
       Atlanta- a simple theme using Gtk+ default theme
    
      
    

    3.了解主题基础:
    1)窗口
    有六个 Metacity 认可的不同窗框风格
    normal                 普通的上层窗口
    dialog                 对话窗口
    modal_dialog          模态(modal state)对话框窗口,比如,要干预之后用户方可与其父window互的窗口
    menu                 可钉住的菜单窗口,如剥离菜单
    utility             小的不变的(persistant)实用工具窗口,如 paletde 或工具箱
    border                 不显示任何装饰的窗口,如全屏化的窗口

    2)风格
    对于每一个窗口风格,都需要映射一个“框架风格集合”。每一个“风格设置”就是几个不同“框架状态”的合成物。您需要指定您的风格中每一个框架状态的外观。
    框架状态是由下面这些要素决定:
            窗口是否已获得焦点或者仍未获得
            窗口是否已最大化或者隐藏【或两者】
            窗口是否能够垂直地,水平地,垂直水平地调整大小

    每一个“框架状态”被映射为一个“框架风格”。框架风格被分成两个不同的部分 ——框架“块” 和窗口“按钮”。 
    这个分类使构建 Metacity 主题更为容易。

    3)框架块

    如果您忽略任一个块,那么该块就是空的。Metacity 能够识别下面的挂框架块
    entire_background             最先被描画的窗口的整个框架
    titlebar                     应用程序窗口之上的区域
    titlebar_middle             不包括“边缘”块的标题条区域
    left_titlebar_edge            标题条左侧区域
    right_titlebar_edge         标题条右侧区域
    top_titlebar_edge            标题条顶部区域
    bottom_titlebar_edge         标题条底部区域
    title                         标题区域
    left_edge                     框架左方的边
    right_edge                     框架右方的边
    bottom_edge                 框架底部的边
    overlay                     同entire_background, 但它在最后才被描画


    4)窗口按钮

    Metacity 认可如下窗口按钮
    close         关闭窗口按钮
    maximize       最大化窗口按钮
    minimize      最小化窗口按钮
    menu          菜单按钮

    以及下面的按钮位置    

    left_left_background         指定左边第一个按钮的背景
    left_middle_background       指定左边第二个按钮的背景
    left_right_background          指定左边第三按钮的背景
    right_left_background         指定右边第一个按钮的背景
    right_middle_background        指定右边第二个按钮的背景
    right_right_background      指定右边第三个按钮的背景

    5)Metacity 窗口按钮

    对于每一个窗口按钮,都必需指定在给定的按钮状态号码下是如何显现的。
    Metacity 认可下面的这些按钮状态 
    normal        对于给定的框架状态,正常的按钮如何出现
    pressed        当点击时【使用鼠标】,按钮应该如何出现
    prelight      当获得焦点时,按钮应该如何出现

    6)窗口菜单

    创建主题的最后一步是指定菜单图标。 他们显示下面这些窗口菜单中的项目 -
    close             光标窗口图标
    maximize           最大化窗口图标
    minimize          最小化窗口图标
    unmaximize         取消最大化窗口图标

    以及下面这些与 GtkStateType 相对应的状态
    normal          菜单中通常的菜单图标如何显示
    prelight        菜单项目获得焦点时菜单图标如何显示
    active            菜单项目激活时【如,选中】时菜单图标如何显示
    selected        菜单项目被选时菜单图标如何显示
    insensitive        菜单项目无效时【如,变灰】菜单图标如何显示
           
    4.检测主题

    创建Metacity主题时,使用特别为测试主题而设计的应用程序是可取的, Metacity 主题查看器。要使用这一程序, 只需简单的使您的主题作为参数(argument)来加载 。加载的主题将会得到分析,如果有错,它将通过命令行输出错误信息。修复错误直到主题被成功加载。

    这个应用程序仅在设计窗口装饰风格时有用,因为它显示出来的窗口上的按钮和窗口菜单无法响应你的操作(鼠标点击或键盘事件)。

    切换新主题,需要使用 gconftool-2 或用桌面菜单中的"桌面首选项" > "主题",然后选择“窗口边框主题”标签。如果使用 gconftool2-,则要采用如下的命令 -
    gconftool-2 --type=string --set /apps/metacity/general/theme [theme_name]

    5.Metacity 框架定义

    1)框架的几何图

    第一件事是需要创建“框架的几何图”,框架几何图的 name 属性,会在后面给定的“框架风格”中涉及到。
    
      
    
    给定几何图中几个可修改的宽度和高度
    Frame geometry specifications
    框架几何图规格说明,框架几何图拥有的一些可选属性
    has_title                     决定在高度计算中是否包含标题文本的高度。缺省值为真。
    title_scale                 使用 Pangomarkup - xx-small, x-small, small, medium, large, x-large and xx-large。缺省使用桌面字体。
    rounded_top_left             定义是否窗口的左上角被圆角化(rounded)。缺省不使用。
    rounded_top_right            定义是否窗口的右上角被圆角化(rounded)。缺省不使用。
    rounded_bottom_left         定义是否窗口的左下角被圆角化(rounded)。缺省不使用。
    rounded_bottom_right        定义是否窗口的右下角被圆角化(rounded)。缺省不使用。

    
      
      
      
      
      
      
      
      
      
      
    

    指定框架几何图时,可以使用继承。然后提供新的属性值来替代继承过来的任意值。
    
      
      
      
      
      
    

    按钮的宽度和高度,可以通过指定某一个比例来替代。
    


    2)描绘运算

    “描绘运算”是设计 Metacity 主题的核心部分。为了能够成功描绘框架各部分,需要为“框架块”指定描绘运算。
    
      
    

    3)运算符

    描绘运算通常是forward declared, 但也可放到一行中【参见后面的例子】。下面是在描绘运算中被允许的运算符列表 -

    运算符        意  义            示 例
    +            加                2 + 3
    -            减                5 - 4
    *            乘                3 * 2
    /            除                10 / 2
    %            模                34 % 3
    `max`       最大值            4 `max` 5       
    `min`       最小值            7 `min` 3
    ()            括号            (5 * 3) + 5

    应该注意的是常规的 precidence 规则对所有的运算符都有效。

    4)常量

    在描绘运算中,可以使用预定义变量或常量。常量需要声明且必须以一个大写字母开头。
    

    下面列表是可以使用的预定义变量
    width                目标区域的宽度
    height                目标区域的高度
    object_width        被描绘物的自然宽度
    object_height       被描绘物的自然高度
    left_width          从左边框架到客户窗口的距离
    right_width         从右边框架到客户窗口的距离
    top_height          从顶部框架到客户窗口的距离
    bottom_height       从底部框架到客户窗口的距离
    mini_icon_width     窗口最小图标的宽度
    mini_icon_height    窗口最小图标的高度
    icon_width          大图标的宽度
    icon_height         大图标的高度
    title_width         标题文本的宽度
    title_height        标题文本的高度

    5)运算
    Metacity 支持下面的描绘“运算”
    line
    从起点 (x1, y1) 到终点(x2, y2)用颜色 color 描绘一线段。颜色可以是颜色名如“blue”,十六进制号码如“#FF0099”或者是来自GTK主题的“gtk:base[NORMAL]”形式的【参见后面的更多例子】。它获得附加的属性 width, dash_on_length 和dash_off_length, 它们缺省值都为“0”。
    

    rectangle
    从起点 (x,y) 和给定的 width 和 height 描绘一个方形。其有一个可选属性 filled, 缺省值是“false”。
    

    arc
    从起点(x,y)和给定的 width, height, start_angle 以及 extent_angle 描绘一段弧线。其有一个可选属性filled,缺省值是“false”。
    

    tint         
    从起点(x,y)和给定的 width, height,着色,color和alpha.
    

    gradient         
    描绘一个渐变从起点(x,y)和给定的width, height, type 【垂直、水平、对角】和一些 color 元素。
    
      
             
    

    image         
    映射一幅图像到元素从起点(x,y)和给定的 width, height and filename。它有可选自变量参数alpha 和 colorize, 缺省值是“0” 和无色彩。
    

    gtk_arrow         
    描绘一个箭头,从起点(x,y)和给定的width, height, GTK state, shadow [无, 内, 外, etched_in 和 etched_out] 和 direction [上, 下, 左或右]。其有可选自变量 filled,缺省值是“false”。
    

    gtk_box         
    描绘一个盒子,从起点(x,y)和给定的width, height, GTK state 和 shadow.
    

    gtk_vline         
    描绘一段垂直线段,从起点(x,y1) 到终点 (x,y2) 和 GTK state.
    

    icon         
    描绘窗口图标,从起点(x,y)和给定的width 和 height。其拥有可选自变量 alpha, 缺省值是“0”。
    

    title         
    描绘窗口标题文本,从起点(x,y)和给定的color.
    </span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    clip         </span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    裁剪给定的区域,从起点(x,y) 和给定的 width 和 height.</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <clip x="5" y="2" width="width - 10" height="height - SpacerHeight"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    include         </span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    包含其他描绘运算,使用给定的name。 其拥有可选的自变量(x,y), width 和 height, with defaults FIXME.</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <include name="other_drawing_operations"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    tile         </span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    覆盖(Tile)其他描绘运算表,使用给定的name, tile_width 和 tile_height。其拥有可选的自变量(x,y), width, height, tile_xoffset 和 tile_yoffset with defaults FIXME.</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <tile name="other_drawing_operations" tile_width="10" tile_height="10"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    6.创建框架风格:</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    创建“框架风格”时,要扎住(tie)各种不同的“框架块”和“窗口按钮”,形成一个特殊的“框架几何图”。我们通常需要为窗口状态normal, maximized, shaded, maximized_and_shaded 和依赖窗口捕获焦点与否来创建一个风格。</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    我们首先创建一个模板,他将包括描绘一个给定框架风格所必需的全部信息。</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <frame_style name="my_frame_style" geometry="my_frame_geometry"></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <!-- 这里就是您要开始定义框架风格的地方 --></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    </frame_style></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    在给定的框架风格中允许继承。所有的东西都可以重新指定以覆盖(override)父辈风格。</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <frame_style name="my_child_frame_style" parent="my_frame_style" geometry="my_frame_geometry"></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    </frame_style></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    1)框架块</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    为描绘框架的各组成部分,需要为每一个框架块提供描绘运算。如果忽略其中一个块,那么该框架部分将什么也不描绘。</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <piece position="entire_background" draw_ops="my_drawing_operation"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    如早先提到的,作为选择,您可以在一行中提供一个描绘运算</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <piece position="left_edge"></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <draw_ops></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">          <rectangle color="#FF0000" x0="0" y0="0" x1="width" y1="height" filled="true"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       </draw_ops></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    </piece></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    下面的图例显示可以在一个给定的框架中定义风格的各种块</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    Non-title frame pieces</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    非标题框架块</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    Titlebar frame pieces</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    标题栏框架块</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    Title frame piece</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    标题框架块</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    2)窗口按钮</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    如前所述,您需要为给定的一个主题的窗口按钮指定最小化设置。 必须 为close, maximize, minimize 和 menu buttons提供描绘方法 ,该方法为他们定义了两种状态 - normal 和 pressed。 如果 prelight没有被定义,那么该状态将会使用normal。</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <button function="close" state="normal" draw_ops="my_drawing_operation"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    连同指定窗口按钮一起,您可以指定如何描绘窗口的各个组成部分,依赖于其在窗口框架中的不同位置。如果所有按钮拥有相同的背景,您就只需为left_middle_background 和 right_middle_background指定描绘运算。</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <button function="left_middle_background" state="pressed" draw_ops="my_background_drawing_operation"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    把所有这些信息在一起放置入单一的“框架风格”中,就如下面一样 -</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <frame_style name="my_frame_style" geometry="my_frame_geometry"></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <!-- We first display the title --></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <piece position="title" draw_ops="title_normal"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <!-- Let's give the edges some prettiness --></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <piece position="left_edge" draw_ops="draw_left_edge"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <piece position="right_edge" draw_ops="draw_right_edge"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <piece position="bottom_edge" draw_ops="draw_bottom_edge"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <!-- We need to specify the button positions now --></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <button function="left_middle_background" state="pressed" draw_ops="background_button"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <button function="right_middle_background" state="pressed" draw_ops="background_button"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <!-- We need to specify the buttons now --></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <button function="close" state="normal" draw_ops="close_button"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <button function="close" state="pressed" draw_ops="minimize_button"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <button function="minimize" state="normal" draw_ops="minimize_button"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <button function="minimize" state="pressed" draw_ops="minimize_button_pressed"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <button function="maximize" state="normal" draw_ops="maximize_button"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <button function="maximize" state="pressed" draw_ops="maximize_button_pressed"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <button function="menu" state="normal" draw_ops="menu_button"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <button function="menu" state="pressed" draw_ops="menu_button_pressed"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    </frame_style></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    3)菜单图标</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    在窗口菜单中要为Close, Maximize, UnMaximize 和 Minimize这些菜单项目指定图标。只为normal状态指定描绘运算就够了。您也可为其他状态随意指定它们的描绘运算,就如上面提及的一样。</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <window_icon function="close" state="normal" draw_ops="menu_close_icon"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <window_icon function="maximize" state="normal" draw_ops="menu_maximize_icon"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <window_icon function="minimize" state="normal" draw_ops="menu_minimize_icon"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <window_icon function="unmaximize" state="normal" draw_ops="menu_unmaximize_icon"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    4)框架风格集合</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    一旦我们有了自己的各式各样的框架风格,我们就要把他们映射到各式各样的窗口状态上去。我们通过创建“框架风格集合” 来实施的这一步骤。这里的 name 属性将在后面通过一个给定的“窗框风格”来引用。</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <frame_style_set name="my_style_set"></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <frame focus="yes" state="normal" resize="both" style="my_normal_focused_style"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <frame focus="no" state="normal" resize="both" style="my_normal_unfocused_style"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <frame focus="yes" state="maximized" style="my_maximized_focused_style"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <frame focus="no" state="maximized" style="my_maximized_unfocused_style"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <frame focus="yes" state="shaded" style="my_shaded_focused_style"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <frame focus="no" state="shaded" style="my_shaded_unfocused_style"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <frame focus="yes" state="maximized_and_shaded" style="my_maximized_shaded_focused_style"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">       <frame focus="no" state="maximized_and_shaded" style="my_maximized_shaded_unfocused_style"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    </frame_style_set></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">        正如您以上所见,您必需为窗口的每种状态提供一个框架,通过窗口焦点yes和 no. 这个 style属性 references 'frame style'。 对任意一个框架您还必需提供一个resize 属性,通过一个normal 状态 'both'. 您可以为其他调整大小的属性none, horizontal and vertical随意指定框架。</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    5)窗口</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    最后必需提供的是映射“窗口风格”到给定的“框架风格集合”上。每一个窗口风格需要一个风格集合 normal, dialog, modal_dialog, menu, utility 和 border</span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <window type="normal" style_set="my_normal_style_set"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <window type="dialog" style_set="my_dialog_style_set"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <window type="modal_dialog" style_set="my_modal_dialog_style_set"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <window type="menu" style_set="my_menu_style_set"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <window type="utility" style_set="my_utility_style_set"/></span><br style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 26px; text-align: left; background-color: rgb(255, 255, 255); ">    <window type="border" style_set="my_border_style_set"/></span> </div> <!-- <div class="Blog_con3_1">管理员在2009年8月13日编辑了该文章文章。</div> --> <div class="Blog_con2_1 Blog_con3_2"> <div> <!--<img src="/image/default/tu_8.png">--> <!-- JiaThis Button BEGIN --> <div class="bdsharebuttonbox"><A class=bds_more href="#" data-cmd="more"></A><A class=bds_qzone title=分享到QQ空间 href="#" data-cmd="qzone"></A><A class=bds_tsina title=分享到新浪微博 href="#" data-cmd="tsina"></A><A class=bds_tqq title=分享到腾讯微博 href="#" data-cmd="tqq"></A><A class=bds_renren title=分享到人人网 href="#" data-cmd="renren"></A><A class=bds_weixin title=分享到微信 href="#" data-cmd="weixin"></A></div> <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script> <!-- JiaThis Button END --> </div> 阅读(1345) | 评论(0) | 转发(0) | <div class="HT_line3"></div> </div> <div class="Blog_con3_3"> <div><span id='digg_num'>0</span><a href="javascript:void(0)" id='digg' bid='3280988' url='/blog/digg.html' ></a></div> <p>上一篇:<a href="/uid-26569496-id-3277344.html">linux远程开机(wake on lan)</a></p> <p>下一篇:<a href="/uid-26569496-id-3317659.html">Linux版本重构</a></p> </div> </div> <!-- <div class="Blog_con3_4 Blog_con3_5"> <div class="Blog_tit2 Blog_tit7">热门推荐</div> <ul> <li><a href="" title="" target='blank' ></a></li> </ul> </div> --> </div> </div> <div class="Blog_right1_7" id='replyList'> <div class="Blog_tit3">给主人留下些什么吧!~~</div> <!--暂无内容--> <!-- 评论分页--> <div class="Blog_right1_6 Blog_right1_12"> </div> <!-- 评论分页--> <div class="Blog_right1_10" style="display:none"> <div class="Blog_tit3">评论热议</div> <!--未登录 --> <div class="Blog_right1_8"> <div class="nologin_con1"> 请登录后评论。 <p><a href="http://account.chinaunix.net/login" onclick="link(this)">登录</a> <a href="http://account.chinaunix.net/register?url=http%3a%2f%2fblog.chinaunix.net">注册</a></p> </div> </div> </div> <div style="text-align:center;margin-top:10px;"> <script type="text/javascript" smua="d=p&s=b&u=u3118759&w=960&h=90" src="//www.nkscdn.com/smu0/o.js"></script> </div> </div> </div> </div> <input type='hidden' id='report_url' value='/blog/ViewReport.html' /> <script type="text/javascript"> //测试字符串的长度 一个汉字算2个字节 function mb_strlen(str) { var len=str.length; var totalCount=0; for(var i=0;i<len;i++) { var c = str.charCodeAt(i); if ((c >= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)) { totalCount++; }else{ totalCount+=2; } } return totalCount; } /* var Util = {}; Util.calWbText = function (text, max){ if(max === undefined) max = 500; var cLen=0; var matcher = text.match(/[^\x00-\xff]/g), wlen = (matcher && matcher.length) || 0; //匹配url链接正则 http://*** var pattern = /http:\/\/([\w-]+\.)+[\w-]+(\/*[\w-\.\/\?%&=][^\s^\u4e00-\u9fa5]*)?/gi; //匹配的数据存入数组 var arrPt = new Array(); var i = 0; while((result = pattern.exec(text)) != null){ arrPt[i] = result[0]; i++; } //替换掉原文本中的链接 for(var j = 0;j<arrPt.length;j++){ text = text.replace(arrPt[j],""); } //减掉链接所占的长度 return Math.floor((max*2 - text.length - wlen)/2 - 12*i); }; */ var allowComment = '0'; //举报弹出层 function showJuBao(url, cid){ $.cover(false); asyncbox.open({ id : 'report_thickbox', url : url, title : '举报违规', width : 378, height : 240, scroll : 'no', data : { 'cid' : cid, 'idtype' : 2 , 'blogurl' : window.location.href }, callback : function(action){ if(action == 'close'){ $.cover(false); } } }); } $(function(){ //创建管理员删除的弹出层 $('#admin_article_del').click(function(){ $.cover(false); asyncbox.open({ id : 'class_thickbox', html : '<div class="HT_layer3_1"><ul><li class="HT_li1">操作原因:<select class="HT_sel7" id="del_type" name="del_type"><option value="广告文章">广告文章</option><option value="违规内容">违规内容</option><option value="标题不明">标题不明</option><option value="文不对题">文不对题</option></select></li><li class="HT_li1" ><input class="HT_btn4" id="admin_delete" type="button" /></li></ul></div>', title : '选择类型', width : 300, height : 150, scroll : 'no', callback : function(action){ if(action == 'close'){ $.cover(false); } } }); }); $('#admin_delete').live('click' , function(){ ///blog/logicdel/id/3480184/url/%252Fblog%252Findex.html.html var type = $('#del_type').val(); var url = '/blog/logicdel/id/3280988/url/%252Fuid%252F26569496.html.html'; window.location.href= url + '?type=' + type; }); //顶 js中暂未添加&过滤 $('#digg').live('click' , function(){ if(isOnLine == '' ) { //showErrorMsg('登录之后才能进行此操作' , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); return false; } var bid = $('#digg').attr('bid'); var url = $('#digg').attr('url'); var digg_str = $.cookie('digg_id'); if(digg_str != null) { var arr= new Array(); //定义一数组 arr = digg_str.split(","); //字符分割 for( i=0 ; i < arr.length ; i++ ) { if(bid == arr[i]) { showErrorMsg('已经赞过该文章', '消息提示'); return false; } } } $.ajax({ type:"POST", url:url, data: { 'bid' : bid }, dataType: 'json', success:function(msg){ if(msg.error == 0) { var num = parseInt($('#digg_num').html(),10); num += 1; $('#digg_num').html(num); $('#digg').die(); if(digg_str == null) { $.cookie('digg_id', bid, {expires: 30 , path: '/'}); } else { $.cookie('digg_id', digg_str + ',' + bid, {expires: 30 , path: '/'}); } showSucceedMsg('谢谢' , '消息提示'); } else if(msg.error == 1) { //showErrorMsg(msg.error_content , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); } else if(msg.error == 2) { showErrorMsg(msg.error_content , '消息提示'); } } }); }); //举报弹出层 /*$('.box_report').live('click' , function(){ if(isOnLine == '' ) { //showErrorMsg('登录之后才能进行此操作' , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); return false; } var url = $('#report_url').val(); var cid = $(this).attr('cid'); $.cover(false); asyncbox.open({ id : 'report_thickbox', url : url, title : '举报违规', width : 378, height : 240, scroll : 'no', data : { 'cid' : cid, 'idtype' : 2 }, callback : function(action){ if(action == 'close'){ $.cover(false); } } }); });*/ //评论相关代码 //点击回复显示评论框 $('.Blog_a10').live('click' , function(){ if(isOnLine == '' ) { //showErrorMsg('登录之后才能进行此操作' , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); return false; } if(allowComment == 1) { showErrorMsg('该博文不允许评论' , '消息提示'); return false; } var tid = $(this).attr('toid');//留言作者id var bid = $(this).attr('bid');//blogid var cid = $(this).attr('cid');//留言id var tname = $(this).attr('tname'); var tpl = '<div class="Blog_right1_9">'; tpl += '<div class="div2">'; tpl += '<textarea name="" cols="" rows="" class="Blog_ar1_1" id="rmsg">文明上网,理性发言...</textarea>'; tpl += '</div>'; tpl += '<div class="div3">'; tpl += '<div class="div3_2"><a href="javascript:void(0);" class="Blog_a11" id="quota_sbumit" url="/Comment/PostComment.html" tid="'+tid+'" bid="'+bid+'" cid="'+cid+'" tname="'+tname+'" ></a><a href="javascript:void(0)" id="qx_comment" class="Blog_a12"></a></div>'; tpl += '<div class="div3_1"><a href="javascript:void(0);" id="mface"><span></span>表情</a></div>'; tpl += '<div class="clear"></div>'; tpl += '</div>'; tpl += '</div>'; $('.z_move_comment').html(''); $(this).parents('.Blog_right1_8').find('.z_move_comment').html(tpl).show(); }); //引用的评论提交 $('#quota_sbumit').live('click' , function(){ if(isOnLine == '' ) { //showErrorMsg('登录之后才能进行此操作' , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); return false; } var bid = $(this).attr('bid'); var tid = $(this).attr('tid');//被引用人的id var qid = $(this).attr('cid');//引用的id var url = $(this).attr('url'); var text = $('#rmsg').val(); var tname = $(this).attr('tname'); if(text == '' || text=='文明上网,理性发言...') { showErrorMsg('评论内容不能为空!' , '消息提示'); return false; } else { if(mb_strlen(text) > 1000){ showErrorMsg('评论内容不能超过500个汉字' , '消息提示'); return false; } } $.ajax({ type: "post", url: url , data: {'bid': bid , 'to' : tid , 'qid' : qid , 'text': text , 'tname' : tname }, dataType: 'json', success: function(data){ if(data.code == 1){ var tpl = '<div class="Blog_right1_8">'; tpl+= '<div class="Blog_right_img1"><a href="' +data.info.url+ '" >' + data.info.header + '</a></div>'; tpl+= '<div class="Blog_right_font1">'; tpl+= '<p class="Blog_p5"><span><a href="' +data.info.url+ '" >' + data.info.username + '</a></span>' + data.info.dateline + '</p>'; tpl+= '<p class="Blog_p7"><a href="' + data.info.quota.url + '">' + data.info.quota.username + '</a>:'+ data.info.quota.content + '</p>'; tpl+= '<p class="Blog_p8">' + data.info.content + '</p><span class="span_text1"><a href="javascript:void(0);" class="Blog_a10" toid=' + data.info.fuid + ' bid=' + data.info.bid + ' cid=' + data.info.cid + ' tname = ' + data.info.username + ' >回复</a> |  <a class="comment_del_mark" style="cursor:pointer" url="' + data.info.delurl + '" >删除</a> |  <a href="javascript:showJuBao(\'/blog/ViewReport.html\','+data.info.cid+')" class="box_report" cid="' + data.info.cid + '" >举报</a></span></div>'; tpl+= '<div class="z_move_comment" style="display:none"></div>'; tpl+= '<div class="Blog_line1"></div></div>'; $('#replyList .Blog_right1_8:first').before(tpl); $('.z_move_comment').html('').hide(); } else if(data.code == -1){ //showErrorMsg(data.info , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); } }, error: function(){//请求出错处理 } }); }); //底部发表评论 $('#submitmsg').click(function(){ if(allowComment == 1) { showErrorMsg('该博文不允许评论' , '消息提示'); return false; } var bid = $(this).attr('bid'); var toid = $(this).attr('toid'); var text = $('#reply').val(); var url = $(this).attr('url'); if(text == '' || text=='文明上网,理性发言...') { showErrorMsg('评论内容不能为空!' , '消息提示'); return false; } else { if(mb_strlen(text) > 1000){ showErrorMsg('评论内容不能超过500个汉字' , '消息提示'); return false; } } $.ajax({ type: "post", url: url , data: {'bid': bid , 'to' : toid ,'text': text}, dataType: 'json', success: function(data){ if(data.code == 1) { var tpl = '<div class="Blog_right1_8">'; tpl += '<div class="Blog_right_img1"><a href="' +data.info.url+ '" >' + data.info.header + '</a></div>'; tpl += '<div class="Blog_right_font1">'; tpl += '<p class="Blog_p5"><span><a href="' +data.info.url+ '" >' + data.info.username + '</a></span>' + data.info.dateline + '</p>'; tpl += '<p class="Blog_p6">' + data.info.content + '</p>'; tpl += '<div class="div1"><a href="javascript:void(0);" class="Blog_a10" toid=' + data.info.fuid + ' bid=' + data.info.bid + ' cid=' + data.info.cid + '>回复</a> |  <a class="comment_del_mark" style="cursor:pointer" url="' + data.info.delurl + '">删除</a> |  <a href="javascript:showJuBao(\'/blog/ViewReport.html\','+data.info.cid+')" class="box_report" cid="' + data.info.cid + '">举报</a></div>'; tpl += '<div class="z_move_comment" style="display:none"></div>'; tpl += '</div><div class="Blog_line1"></div></div>'; $('.Blog_tit3:first').after(tpl); $('#reply').val('文明上网,理性发言...'); } else if(data.code == -1) { showErrorMsg(data.info , '消息提示'); } }, error: function(){//请求出错处理 } }); }); //底部评论重置 $('#reset_comment').click(function(){ $('#reply').val('文明上网,理性发言...'); }); //取消回复 $('#qx_comment').live('click' , function(){ $('.z_move_comment').html('').hide(); }); $('#rmsg, #reply').live({ focus:function(){ if($(this).val() == '文明上网,理性发言...'){ $(this).val(''); } }, blur:function(){ if($(this).val() == ''){ $(this).val('文明上网,理性发言...'); } } }); //删除留言确认 $('.comment_del_mark').live('click' , function(){ var url = $(this).attr('url'); asyncbox.confirm('删除留言','确认', function(action){ if(action == 'ok') { location.href = url; } }); }); //删除时间确认 $('.del_article_id').click(function(){ var delurl = $(this).attr('delurl'); asyncbox.confirm('删除文章','确认', function(action){ if(action == 'ok') { location.href = delurl; } }); }); /* //字数限制 $('#rmsg, #reply').live('keyup', function(){ var id = $(this).attr('id'); var left = Util.calWbText($(this).val(), 500); var eid = '#errmsg'; if(id == 'reply') eid = '#rerrmsg'; if (left >= 0) $(eid).html('您还可以输入<span>' + left + '</span>字'); else $(eid).html('<font color="red">您已超出<span>' + Math.abs(left) + '</span>字 </font>'); }); */ //加载表情 $('#face').qqFace({id : 'facebox1', assign : 'reply', path : '/image/qqface/'}); $('#mface').qqFace({id : 'facebox', assign : 'rmsg', path:'/image/qqface/'}); /* $('#class_one_id').change(function(){ alert(123213); var id = parseInt($(this).val() , 10); if(id == 0) return false; $('.hidden_son_class span').each(function( index , dom ){ if( dom.attr('cid') == id ) { } }); }); */ //转载文章 var turn_url = "/blog/viewClassPart.html"; $('#repost_bar').click(function(){ if(isOnLine == '' ) { //showErrorMsg('登录之后才能进行此操作' , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); return false; } var id = $(this).attr('bid'); asyncbox.open({ id : 'turn_class_thickbox', url : turn_url, title : '转载文章', width : 330, height : 131, scroll : 'no', data : { 'id' : id }, callback : function(action){ if(action == 'close'){ $.cover(false); } } }); }); /* //转发文章 $('#repost_bar').live('click' , function(){ if(isOnLine == '' ) { //showErrorMsg('登录之后才能进行此操作' , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); return false; } var bid = $(this).attr('bid'); var url = $(this).attr('url'); asyncbox.confirm('转载文章','确认', function(action){ if(action == 'ok'){ $.ajax({ type:"POST", url:url, data: { 'bid' : bid }, dataType: 'json', success:function(msg){ if(msg.error == 0){ showSucceedMsg('转发成功!', '消息提示'); }else if(msg.error == 1){ //location.href = '/index.php?r=site/login'; showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); }else{ showErrorMsg(msg.error_content, '消息提示'); } } }); } }); }); */ }); </script> <!--该部分应该放在输出代码块的后面才起作用 --> <script type="text/javascript"> SyntaxHighlighter.autoloader( 'applescript /highlight/scripts/shBrushAppleScript.js', 'actionscript3 as3 /highlight/scripts/shBrushAS3.js', 'bash shell /highlight/scripts/shBrushBash.js', 'coldfusion cf /highlight/scripts/shBrushColdFusion.js', 'cpp c /highlight/scripts/shBrushCpp.js', 'c# c-sharp csharp /highlight/scripts/shBrushCSharp.js', 'css /highlight/scripts/shBrushCss.js', 'delphi pascal /highlight/scripts/shBrushDelphi.js', 'diff patch pas /highlight/scripts/shBrushDiff.js', 'erl erlang /highlight/scripts/shBrushErlang.js', 'groovy /highlight/scripts/shBrushGroovy.js', 'java /highlight/scripts/shBrushJava.js', 'jfx javafx /highlight/scripts/shBrushJavaFX.js', 'js jscript javascript /highlight/scripts/shBrushJScript.js', 'perl pl /highlight/scripts/shBrushPerl.js', 'php /highlight/scripts/shBrushPhp.js', 'text plain /highlight/scripts/shBrushPlain.js', 'py python /highlight/scripts/shBrushPython.js', 'ruby rails ror rb /highlight/scripts/shBrushRuby.js', 'scala /highlight/scripts/shBrushScala.js', 'sql /highlight/scripts/shBrushSql.js', 'vb vbnet /highlight/scripts/shBrushVb.js', 'xml xhtml xslt html /highlight/scripts/shBrushXml.js' ); SyntaxHighlighter.all(); function code_hide(id){ var code = document.getElementById(id).style.display; if(code == 'none'){ document.getElementById(id).style.display = 'block'; }else{ document.getElementById(id).style.display = 'none'; } } </script> <!--回顶部js2011.12.30--> <script language="javascript"> lastScrollY=0; function heartBeat(){ var diffY; if (document.documentElement && document.documentElement.scrollTop) diffY = document.documentElement.scrollTop; else if (document.body) diffY = document.body.scrollTop else {/*Netscape stuff*/} percent=.1*(diffY-lastScrollY); if(percent>0)percent=Math.ceil(percent); else percent=Math.floor(percent); document.getElementById("full").style.top=parseInt(document.getElementById("full").style.top)+percent+"px"; lastScrollY=lastScrollY+percent; if(lastScrollY<200) { document.getElementById("full").style.display="none"; } else { document.getElementById("full").style.display="block"; } } var gkuan=document.body.clientWidth; var ks=(gkuan-960)/2-30; suspendcode="<div id=\"full\" style='right:-30px;POSITION:absolute;TOP:500px;z-index:100;width:26px; height:86px;cursor:pointer;'><a href=\"javascript:void(0)\" onclick=\"window.scrollTo(0,0);\"><img src=\"\/image\/top.png\" /></a></div>" document.write(suspendcode); window.setInterval("heartBeat()",1); </script> <!-- footer --> <div class="Blog_footer" style='clear:both'> <div><a href="http://www.chinaunix.net/about/index.shtml" target="_blank" rel="nofollow">关于我们</a> | <a href="http://www.it168.com/bottomfile/it168.shtml" target="_blank" rel="nofollow">关于IT168</a> | <a href="http://www.chinaunix.net/about/connect.html" target="_blank" rel="nofollow">联系方式</a> | <a href="http://www.chinaunix.net/about/service.html" target="_blank" rel="nofollow">广告合作</a> | <a href="http://www.it168.com//bottomfile/flgw/fl.htm" target="_blank" rel="nofollow">法律声明</a> | <a href="http://account.chinaunix.net/register?url=http%3a%2f%2fblog.chinaunix.net" target="_blank" rel="nofollow">免费注册</a> <p>Copyright 2001-2010 ChinaUnix.net All Rights Reserved 北京皓辰网域网络信息技术有限公司. 版权所有 </p> <div>感谢所有关心和支持过ChinaUnix的朋友们 <p><a href="http://beian.miit.gov.cn/">16024965号-6 </a></p> </div> </div> </div> </div> <script language="javascript"> //全局错误提示弹出框 function showErrorMsg(content, title, url){ var url = url || ''; var title = title || '消息提示'; var html = ''; html += '<div class="HT_layer3_1 HT_layer3_2"><ul><li><p><span class="login_span1"></span>' + content + '</p></li>'; if(url == '' || url.length == 0){ html += '<li class="HT_li1"><input type="button" class="HT_btn2" onclick=\'close_windows("error_msg")\'></li>'; } else { html += '<li class="HT_li1"><input type="button" class="login_btn1" onclick="location.href=\'' + url + '\'"></li>'; } html += '</ul></div>'; $.cover(true); asyncbox.open({ id: 'error_msg', title : title, html : html, 'callback' : function(action){ if(action == 'close'){ $.cover(false); } } }); } //全局正确提示 function showSucceedMsg(content, title , url ){ var url = url || ''; var title = title || '消息提示'; var html = ''; html += '<div class="HT_layer3_1 HT_layer3_2"><ul><li><p><span class="login_span2"></span>' + content + '</p></li>'; if(url == '' || url.length == 0){ html += '<li class="HT_li1"><input type="button" class="HT_btn2" onclick=\'close_windows("error_msg")\'></li>'; } else { html += '<li class="HT_li1"><input type="button" class="HT_btn2" onclick="location.href=\'' + url + '\'"></li>'; } html += '</ul></div>'; $.cover(true); asyncbox.open({ id: 'error_msg', title : title, html : html, 'callback' : function(action){ if(action == 'close'){ $.cover(false); } } }); } //关闭指定id的窗口 function close_windows(id){ $.cover(false); $.close(id); } //公告 var tID; var tn; // 高度 var nStopTime = 5000; // 不同行间滚动时间隔的时间,值越小,移动越快 var nSpeed = 50; // 滚动时,向上移动一像素间隔的时间,值越小,移动越快 var isMove = true; var nHeight = 25; var nS = 0; var nNewsCount = 3; /** * n 用于表示是否为第一次运行 **/ function moveT(n) { clearTimeout(tID) var noticev2 = document.getElementById("noticev2") nS = nSpeed; // 只在第一次调用时运行,初始化环境(有没有参数) if (n) { // 设置行高 noticev2.style.lineHeight = nHeight + "px"; // 初始化显示位置 tn = 0; // 刚进入时在第一行停止时间 nS = nStopTime; } // 判断鼠标是否指向层 if (isMove) { // 向上移动一像素 tn--; // 如果移动到最下面一行了,则移到顶行 if (Math.abs(tn) == nNewsCount * nHeight) { tn = 0; } // 设置位置 noticev2.style.marginTop = tn + "px"; // 完整显示一行时,停止一段时间 if (tn % nHeight == 0) { nS = nStopTime; } } tID = setTimeout("moveT()", nS); } moveT(1); // 此处可以传入任何参数 </script> <script type="text/javascript"> // var _gaq = _gaq || []; // _gaq.push(['_setAccount', 'UA-20237423-2']); // _gaq.push(['_setDomainName', '.chinaunix.net']); // _gaq.push(['_trackPageview']); // // (function() { // var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; // ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; // var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); // })(); </script> <script type="text/javascript"> var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://"); document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F0ee5e8cdc4d43389b3d1bfd76e83216b' type='text/javascript'%3E%3C/script%3E")); function link(t){ var href= $(t).attr('href'); href+="?url="+encodeURIComponent(location.href); $(t).attr('href',href); //setCookie("returnOutUrl", location.href, 60, "/"); } </script> <script type="text/javascript" src="/js/jquery.qqFace.js"></script> </body> </html>