弹出日历选择日期插件

弹出日历选择日期

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://greasyfork.org/scripts/411259-%E5%BC%B9%E5%87%BA%E6%97%A5%E5%8E%86%E9%80%89%E6%8B%A9%E6%97%A5%E6%9C%9F%E6%8F%92%E4%BB%B6/code/%E5%BC%B9%E5%87%BA%E6%97%A5%E5%8E%86%E9%80%89%E6%8B%A9%E6%97%A5%E6%9C%9F%E6%8F%92%E4%BB%B6.js?version=847243

Author
ikaros f
Ratings
0 0 0
Version
0.02
Created
Updated
License
N/A
Applies to
All sites
jq实现的弹出日历选择日期插件
魔改为能够指定有限个可选择日期,适用于只希望用户选择某几个日期的情况
须搭配css使用:https://greasyfork.org/zh-CN/scripts/411258-%E5%BC%B9%E5%87%BA%E6%97%A5%E5%8E%86%E9%80%89%E6%8B%A9%E6%97%A5%E6%9C%9F%E6%8F%92%E4%BB%B6%E7%9A%84css/code

// @resource dateTimecss https://greasyfork.org/zh-CN/scripts/411258-%E5%BC%B9%E5%87%BA%E6%97%A5%E5%8E%86%E9%80%89%E6%8B%A9%E6%97%A5%E6%9C%9F%E6%8F%92%E4%BB%B6%E7%9A%84css/code
function html_decode(str)
{
var s = "";
if (str.length == 0) return "";
s = str.replace(/&/g, "&");
s = s.replace(/</g, "<");
s = s.replace(/>/g, ">");
s = s.replace(/ /g, " ");
s = s.replace(/'/g, "\'");
s = s.replace(/"/g, "\"");
s = s.replace(//g, "\n");
return s;
}
let dateTimecss = GM_getResourceText('dateTimecss')
console.log(dateTimecss)
var startindex = dateTimecss.indexOf("@charset")
var endindex = dateTimecss.indexOf("endmycss")-1
GM_addStyle(html_decode(dateTimecss.slice(startindex,endindex)))



js:
var now = new Date()
$("#date").datetime({
type: "date",
value: [now.getFullYear(), now.getMonth()+1, now.getDate()],
//active:Object.keys(days),
active:["2020/9/9","2020/10/9"],
success: function (res) {
//res:2020/9/9 or else ,then do you want
$(".tc_xs").fadeIn();
mask.style.display = "block";
}
})