// ==UserScript==
// @name 孤独狂饮Test_VUE
// @namespace [url=mailto:741227905@qq.com]741227905@qq.com[/url]
// @version 0.6
// @description 本脚本自带 VUE 和 element-ui 属性,可以更方便的添加各种功能, 增加了避免弹窗。
// @author gdky005
// @match *://www.80s.tw/*
// @require https://unpkg.com/vue/dist/vue.js
// @require https://unpkg.com/element-ui/lib/index.js
// @grant GM_addStyle
// @grant GM_getValue
// @grant GM_xmlhttpRequest
// @connect zkteam.cc
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
var header_link = '';
//将以上拼接的html代码插入到网页里的ul标签中
var header_link_tag = $("head");
if (header_link_tag) {
header_link_tag.append(header_link);
}
var vue_code = '
'
vue_code+='{{ message }}'
vue_code+=''
vue_code+='订阅按钮'
vue_code+=''
vue_code+=''
vue_code+='{{ dialogText }}'
vue_code+=''
vue_code+=''
vue_code+='
'
var ul_tag = $("div.img");
if (ul_tag) {
ul_tag.append(vue_code);
};
new Vue({
el: '#app',
data: function () {
return {
message: "",
dialogText: "是否真的要订阅?",
dialogVisible: false,
centerDialogVisible: false,
name: '',
pid: '',
url: '',
}
},
methods: {
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done();
}).catch(_ => {});
},
cancelSub() {
this.centerDialogVisible = false
this.$message({
message: '取消订阅',
type: 'warning'
});
},
btnOnClick() {
this.centerDialogVisible = true;
var url = document.URL;
var name = $("h1.font14w")[0].innerText;
var pid = url.substring(url.lastIndexOf("/") + 1, url.length);
var msg = "url 是:" + url + ",\n名字:" + name + ",\nid:" + pid;
console.log(msg);
this.dialogText = msg;
this.pid = pid;
this.name = name;
this.url = url;
},
requestData() {
this.centerDialogVisible = false;
var params = 'pid=' + this.pid;
params+= '&name=' + this.name;
params+= '&url=' + this.url;
var that = this;
GM_xmlhttpRequest({
method: 'GET',
url: "http://zkteam.cc/Subscribe/add?" + params,
onload: function(result) {
//eval(result.responseText);
console.log(result.responseText);
that.$message({
message: '订阅成功!',
type: 'success'
});
}
});
}
}
})
//var down_btn_html = '';
//将以上拼接的html代码插入到网页里的ul标签中
//var ul_tag = $("div.info>h1");
//if (ul_tag) {
// ul_tag.append(down_btn_html);
//};
})();