"id" -> "ID" in dataset suffixes.

This commit is contained in:
Mayhem 2013-07-14 19:01:14 +02:00
parent ddbec61e1b
commit 33d3518e76
5 changed files with 11 additions and 19 deletions

View File

@ -96,7 +96,7 @@ ThreadHiding =
className: "#{type}-thread-button" className: "#{type}-thread-button"
innerHTML: "<span>[&nbsp;#{if type is 'hide' then '-' else '+'}&nbsp;]</span>" innerHTML: "<span>[&nbsp;#{if type is 'hide' then '-' else '+'}&nbsp;]</span>"
href: 'javascript:;' href: 'javascript:;'
a.dataset.fullid = thread.fullID a.dataset.fullID = thread.fullID
$.on a, 'click', ThreadHiding.toggle $.on a, 'click', ThreadHiding.toggle
a a
@ -117,7 +117,7 @@ ThreadHiding =
toggle: (thread) -> toggle: (thread) ->
unless thread instanceof Thread unless thread instanceof Thread
thread = g.threads[@dataset.fullid] thread = g.threads[@dataset.fullID]
if thread.isHidden if thread.isHidden
ThreadHiding.show thread ThreadHiding.show thread
else else

View File

@ -28,9 +28,8 @@ Get =
threadID = path[3] threadID = path[3]
postID = link.hash[2..] postID = link.hash[2..]
else # resurrected quote else # resurrected quote
boardID = link.dataset.boardid {boardID, threadID, postID} = link.dataset
threadID = link.dataset.threadid or 0 threadID or= 0
postID = link.dataset.postid
return { return {
boardID: boardID boardID: boardID
threadID: +threadID threadID: +threadID

View File

@ -443,7 +443,7 @@ Settings =
$.get 'selectedArchives', Conf['selectedArchives'], ({selectedArchives}) -> $.get 'selectedArchives', Conf['selectedArchives'], ({selectedArchives}) ->
for boardID, data of selectedArchives for boardID, data of selectedArchives
for type, uid of data for type, uid of data
if option = $ "select[data-boardid='#{boardID}'][data-type='#{type}'] > option[value='#{uid}']", section if option = $ "select[data-board-i-d='#{boardID}'][data-type='#{type}'] > option[value='#{uid}']", section
option.selected = true option.selected = true
return return
addArchiveCell: (row, boardID, data, type) -> addArchiveCell: (row, boardID, data, type) ->
@ -458,9 +458,7 @@ Settings =
td.innerHTML = '<select></select>' td.innerHTML = '<select></select>'
select = td.firstElementChild select = td.firstElementChild
unless select.disabled = length is 1 unless select.disabled = length is 1
$.extend select.dataset, $.extend select.dataset, {boardID, type}
boardid: boardID
type: type
$.on select, 'change', Settings.saveSelectedArchive $.on select, 'change', Settings.saveSelectedArchive
$.add select, options $.add select, options
else else
@ -468,7 +466,7 @@ Settings =
$.add row, td $.add row, td
saveSelectedArchive: -> saveSelectedArchive: ->
$.get 'selectedArchives', Conf['selectedArchives'], ({selectedArchives}) => $.get 'selectedArchives', Conf['selectedArchives'], ({selectedArchives}) =>
(selectedArchives[@dataset.boardid] or= {})[@dataset.type] = +@value (selectedArchives[@dataset.boardID] or= {})[@dataset.type] = +@value
$.set 'selectedArchives', selectedArchives $.set 'selectedArchives', selectedArchives
keybinds: (section) -> keybinds: (section) ->

View File

@ -13,7 +13,7 @@ ImageHover =
el = $.el 'img', el = $.el 'img',
id: 'ihover' id: 'ihover'
src: post.file.URL src: post.file.URL
el.dataset.fullid = post.fullID el.dataset.fullID = post.fullID
$.add d.body, el $.add d.body, el
UI.hover UI.hover
root: @ root: @
@ -24,7 +24,7 @@ ImageHover =
$.on el, 'error', ImageHover.error $.on el, 'error', ImageHover.error
error: -> error: ->
return unless doc.contains @ return unless doc.contains @
post = g.posts[@dataset.fullid] post = g.posts[@dataset.fullID]
src = @src.split '/' src = @src.split '/'
if src[2] is 'images.4chan.org' if src[2] is 'images.4chan.org'

View File

@ -44,10 +44,7 @@ Quotify =
className: 'quotelink deadlink' className: 'quotelink deadlink'
target: '_blank' target: '_blank'
textContent: "#{quote}\u00A0(Dead)" textContent: "#{quote}\u00A0(Dead)"
$.extend a.dataset, $.extend a.dataset, {boardID, threadID: post.thread.ID, postID}
boardid: boardID
threadid: post.thread.ID
postid: postID
else if redirect = Redirect.to 'thread', {boardID, threadID: 0, postID} else if redirect = Redirect.to 'thread', {boardID, threadID: 0, postID}
# Replace the .deadlink span if we can redirect. # Replace the .deadlink span if we can redirect.
a = $.el 'a', a = $.el 'a',
@ -58,9 +55,7 @@ Quotify =
if Redirect.to 'post', {boardID, postID} if Redirect.to 'post', {boardID, postID}
# Make it function as a normal quote if we can fetch the post. # Make it function as a normal quote if we can fetch the post.
$.addClass a, 'quotelink' $.addClass a, 'quotelink'
$.extend a.dataset, $.extend a.dataset, {boardID, postID}
boardid: boardID
postid: postID
unless quoteID in @quotes unless quoteID in @quotes
@quotes.push quoteID @quotes.push quoteID