Use dataset setters instead of setAttribute.
This commit is contained in:
parent
d252aacf4f
commit
ddbec61e1b
@ -206,7 +206,7 @@ Filter =
|
||||
el = $.el 'a',
|
||||
href: 'javascript:;'
|
||||
textContent: text
|
||||
el.setAttribute 'data-type', type
|
||||
el.dataset.type = type
|
||||
$.on el, 'click', Filter.menu.makeFilter
|
||||
|
||||
return {
|
||||
|
||||
@ -96,7 +96,7 @@ ThreadHiding =
|
||||
className: "#{type}-thread-button"
|
||||
innerHTML: "<span>[ #{if type is 'hide' then '-' else '+'} ]</span>"
|
||||
href: 'javascript:;'
|
||||
a.setAttribute 'data-fullid', thread.fullID
|
||||
a.dataset.fullid = thread.fullID
|
||||
$.on a, 'click', ThreadHiding.toggle
|
||||
a
|
||||
|
||||
|
||||
@ -60,4 +60,4 @@ class Clone extends Post
|
||||
@isDead = true if origin.isDead
|
||||
@isClone = true
|
||||
index = origin.clones.push(@) - 1
|
||||
root.setAttribute 'data-clone', index
|
||||
root.dataset.clone = index
|
||||
|
||||
@ -140,7 +140,7 @@ Header =
|
||||
a.textContent
|
||||
|
||||
if m = t.match /-(index|catalog)/
|
||||
a.setAttribute 'data-only', m[1]
|
||||
a.dataset.only = m[1]
|
||||
a.href = "//boards.4chan.org/#{board}/"
|
||||
a.href += 'catalog' if m[1] is 'catalog'
|
||||
|
||||
|
||||
@ -194,5 +194,5 @@ class Post
|
||||
rmClone: (index) ->
|
||||
@clones.splice index, 1
|
||||
for clone in @clones[index..]
|
||||
clone.nodes.root.setAttribute 'data-clone', index++
|
||||
clone.nodes.root.dataset.clone = index++
|
||||
return
|
||||
|
||||
@ -458,9 +458,9 @@ Settings =
|
||||
td.innerHTML = '<select></select>'
|
||||
select = td.firstElementChild
|
||||
unless select.disabled = length is 1
|
||||
# XXX GM can't into datasets
|
||||
select.setAttribute 'data-boardid', boardID
|
||||
select.setAttribute 'data-type', type
|
||||
$.extend select.dataset,
|
||||
boardid: boardID
|
||||
type: type
|
||||
$.on select, 'change', Settings.saveSelectedArchive
|
||||
$.add select, options
|
||||
else
|
||||
|
||||
@ -13,7 +13,7 @@ ImageHover =
|
||||
el = $.el 'img',
|
||||
id: 'ihover'
|
||||
src: post.file.URL
|
||||
el.setAttribute 'data-fullid', post.fullID
|
||||
el.dataset.fullid = post.fullID
|
||||
$.add d.body, el
|
||||
UI.hover
|
||||
root: @
|
||||
|
||||
@ -44,9 +44,10 @@ Quotify =
|
||||
className: 'quotelink deadlink'
|
||||
target: '_blank'
|
||||
textContent: "#{quote}\u00A0(Dead)"
|
||||
a.setAttribute 'data-boardid', boardID
|
||||
a.setAttribute 'data-threadid', post.thread.ID
|
||||
a.setAttribute 'data-postid', postID
|
||||
$.extend a.dataset,
|
||||
boardid: boardID
|
||||
threadid: post.thread.ID
|
||||
postid: postID
|
||||
else if redirect = Redirect.to 'thread', {boardID, threadID: 0, postID}
|
||||
# Replace the .deadlink span if we can redirect.
|
||||
a = $.el 'a',
|
||||
@ -56,9 +57,10 @@ Quotify =
|
||||
textContent: "#{quote}\u00A0(Dead)"
|
||||
if Redirect.to 'post', {boardID, postID}
|
||||
# Make it function as a normal quote if we can fetch the post.
|
||||
$.addClass a, 'quotelink'
|
||||
a.setAttribute 'data-boardid', boardID
|
||||
a.setAttribute 'data-postid', postID
|
||||
$.addClass a, 'quotelink'
|
||||
$.extend a.dataset,
|
||||
boardid: boardID
|
||||
postid: postID
|
||||
|
||||
unless quoteID in @quotes
|
||||
@quotes.push quoteID
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user