A B C D E F G H I
+--------+------+-------+------+-------+---+---------+------+--------------+
1 | Select | Name | Price | URL | Desc | - | Select | Name | Price(13.97) |
+--------+------+-------+------+-------+---+---------+------+--------------+
2 | x | n2 | 4.99 | url2 | desc2 | - | x | n2 | 4.99 |
+--------+------+-------+------+-------+---+---------+------+--------------+
3 | | n3 | 3.99 | url3 | desc3 | - | x | n6 | 3.99 |
+--------+------+-------+------+-------+---+---------+------+--------------+
4 | | n4 | 7.99 | url4 …Run Code Online (Sandbox Code Playgroud) 使用xPath,我从html字段获取数据,这些数据可以是这种格式(包括括号):
数据|||| 我用来解释我的代码的符号
(bornPlace,bornDate-DeathDate)|||| (str,AB)=注意str也可能包含' - '
(bornPlace,bornDate)|||| (str,A)
(bornPlace)|||| (STR)
(bornDate-DeathDate)|||| (AB)
(bornDate)|||| (一个)
或者完全空着
我正在尝试使用多个if-else语句将每个元素检索到单独的变量中,但似乎它不喜欢多行命令(我想是这样).
我已经制作了一个不起作用的代码: - /(它表示期待返回,如果......则发现其他情况)
let $temp1 := data(normalize-space(substring-before(substring-after(//div/div[2]/h2/text(), '('), ')')))
if (contains($temp1,',')) (: (str, A-B) or (str, A) :)
then
let $bornPlace := substring-before($temp1, ',')
let $temp2 := substring-after($temp1, ',')
if (contains($temp2,'-'))
then
let $bornDate := substring-before($temp2, '-')
let $deathDate := substring-after($temp2, '-')
else
let $bornDate := $temp2
let $deathDate := data('')
else if (contains($temp1,'-'))
then (: (s-t-r) or (A-B) :)
let $temp2 := …Run Code Online (Sandbox Code Playgroud) 我只是想添加几个按钮,单击这些按钮时会弹出引导对话框/模式。像这样的演示:http : //jsbin.com/wiruhepere/1/edit?html,css,js,output
但是,当在真实网站上使用greasemonkey/tampermonkey 应用它时,让我们说stackoverflow:它根本不起作用!!
我怀疑可能存在一些脚本/css 冲突,但我不具备追踪该冲突的知识:<
我正在寻找的是:
请记住,我是这方面的初学者,所以如果有什么不够清楚,请随时提问:-)
根据 wOxxOm 注释更新了 GM 代码:
// ==UserScript==
// @name Bootstrap Test
// @namespace http://tampermonkey.net/
// @description Why the hell the modal isnt working :<
// @author Enissay
// @include http://stackoverflow.com/*
// @include https://stackoverflow.com/*
// @resource jqueryJS https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js
// @resource bootstrapJS https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js
// @resource buttonCSS https://raw.githubusercontent.com/necolas/css3-github-buttons/master/gh-buttons.css
// @resource bootstrapCSS https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css
// @resource githubButtonIconSet https://raw.githubusercontent.com/necolas/css3-github-buttons/master/gh-icons.png
// @grant GM_addStyle
// @grant GM_getResourceText
// @grant GM_getResourceURL
// ==/UserScript==
(function() {
//--- Inject …Run Code Online (Sandbox Code Playgroud) css ×1
greasemonkey ×1
if-statement ×1
jquery ×1
sql ×1
string ×1
tampermonkey ×1
xml ×1
xquery ×1