zoukankan      html  css  js  c++  java
  • javascript 定制选择器

    // custom selector `:findday` used to match on specified day in ms.
    //
    // The selector is passed a date in ms and elements are added to the
    // selection filter if the element date matches, as determined by the
    // id attribute containing a parsable date in ms.
    $.extend($.expr[":"], {
    findday: function (a, i, m) {
    var cd = new Date(parseInt(m[3], 10));
    var id = $(a).attr("id");
    id = id ? id : "";
    var si = id.indexOf("-") + 1;
    var ed = new Date(parseInt(id.substring(si, id.length), 10));
    cd = new Date(cd.getFullYear(), cd.getMonth(), cd.getDate());
    ed = new Date(ed.getFullYear(), ed.getMonth(), ed.getDate());
    return cd.getTime() === ed.getTime();
    }
    });
    // custom selector `:findweek` used to match on specified week in ms.
    $.extend($.expr[":"], {
    findweek: function (a, i, m) {
    var cd = new Date(parseInt(m[3], 10));
    var id = $(a).attr("id");
    id = id ? id : "";
    var si = id.indexOf("-") + 1;
    cd = cd.getFullYear() + "-" + cd.getDayForWeek().getWeekOfYear();
    var ed = id.substring(si, id.length);
    return cd === ed;
    }
    });
    // custom selector `:findmonth` used to match on specified month in ms.
    $.extend($.expr[":"], {
    findmonth: function (a, i, m) {
    var cd = new Date(parseInt(m[3], 10));
    cd = cd.getFullYear() + "-" + cd.getMonth();
    var id = $(a).attr("id");
    id = id ? id : "";
    var si = id.indexOf("-") + 1;
    var ed = id.substring(si, id.length);
    return cd === ed;
    }
    });

  • 相关阅读:
    C语言结构体+公用体+枚举训练
    TIFF图像文件格式详解
    Professional CUDA C Programming的代码实例1.1
    C语言数组强化训练
    C语言字符数组与字符串
    文件操作
    MATLAB 与Modelsim之间对测试系统的联合仿真
    FFT实现逆FFT
    眼图——概念与测量(摘记)
    《我的心曾悲伤七次》卡里·纪伯伦
  • 原文地址:https://www.cnblogs.com/yangbt/p/3835915.html
Copyright © 2011-2022 走看看