Report Button: simpler selector, use xpath to avoid problems next year with silly hats.

This commit is contained in:
Nicolas Stepien 2011-10-11 14:05:57 +02:00
parent 716a335488
commit e43d6d4431
2 changed files with 4 additions and 4 deletions

View File

@ -2598,7 +2598,7 @@
return g.callbacks.push(function(root) {
var a, span;
if (!(a = $('.reportbutton', root))) {
span = $('span[id^=no]', root);
span = $('span[id]', root);
a = $.el('a', {
className: 'reportbutton',
innerHTML: '[ ! ]'
@ -2611,7 +2611,7 @@
},
report: function() {
var id, set, url;
url = "http://sys.4chan.org/" + g.BOARD + "/imgboard.php?mode=report&no=" + this.previousElementSibling.childNodes[1].textContent;
url = "http://sys.4chan.org/" + g.BOARD + "/imgboard.php?mode=report&no=" + ($.x('preceding-sibling::input', this).name);
id = "" + NAMESPACE + "popup";
set = "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,resizable=1,width=685,height=200";
return window.open(url, id, set);

View File

@ -1919,7 +1919,7 @@ reportButton =
init: ->
g.callbacks.push (root) ->
if not a = $ '.reportbutton', root
span = $ 'span[id^=no]', root
span = $ 'span[id]', root
a = $.el 'a',
className: 'reportbutton'
innerHTML: '[ ! ]'
@ -1927,7 +1927,7 @@ reportButton =
$.after span, $.tn(' ')
$.bind a, 'click', reportButton.report
report: ->
url = "http://sys.4chan.org/#{g.BOARD}/imgboard.php?mode=report&no=#{@previousElementSibling.childNodes[1].textContent}"
url = "http://sys.4chan.org/#{g.BOARD}/imgboard.php?mode=report&no=#{$.x('preceding-sibling::input', @).name}"
id = "#{NAMESPACE}popup"
set = "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,resizable=1,width=685,height=200"
window.open url, id, set