From 7aeb46abb91689e26a18d82c2103ae2592657d66 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 19 Apr 2014 00:28:19 -0700 Subject: [PATCH] transition to new HTML --- CHANGELOG.md | 3 +++ src/General/Index.coffee | 1 + src/General/Navigate.coffee | 4 ++-- src/General/css/style.css | 10 ++++++++-- src/General/lib/post.class | 5 +---- src/Miscellaneous/Banner.coffee | 5 ++--- src/Miscellaneous/Keybinds.coffee | 7 +++---- 7 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93b9559f5..d0cc044d2 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +**ccd0** +- Start transition to new HTML. + ### v1.7.10 *2014-04-17* diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 042a52306..496c5f770 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -103,6 +103,7 @@ Index = d.implementation.createDocument(null, null, null).appendChild board $.rm navLink for navLink in $$ '.navLinks' + $.id('search-box')?.parentNode.remove() $.after $.x('child::form/preceding-sibling::hr[1]'), Index.navLinks $.rmClass doc, 'index-loading' diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index 32a5f9c0e..3140782c4 100644 --- a/src/General/Navigate.coffee +++ b/src/General/Navigate.coffee @@ -112,8 +112,8 @@ Navigate = updateBoard: (boardID) -> fullBoardList = $ '#full-board-list', Header.boardList - $.rmClass $('.current', fullBoardList), 'current' - $.addClass $("a[href*='/#{boardID}/']", fullBoardList), 'current' + $('.current', fullBoardList)?.classList.remove 'current' + $("a[href*='/#{boardID}/']", fullBoardList)?.classList.add 'current' Header.generateBoardList Conf['boardnav'].replace /(\r\n|\n|\r)/g, ' ' QR.flagsInput() diff --git a/src/General/css/style.css b/src/General/css/style.css index 6e246182e..dcc1ad6b2 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -56,9 +56,12 @@ a[href="javascript:;"] { .warning { color: red; } -#boardNavDesktop { +#boardNavDesktop, #boardNavMobile { display: none !important; } +body.hasDropDownNav{ + margin-top: 5px; +} a { outline: none !important; } @@ -66,9 +69,12 @@ a { border-radius: 3px; padding: 0px 2px; } -body>hr, .ad-plea-bottom + hr { +hr { display: none; } +.board hr { + display: block; +} .board > hr:last-of-type { border-top-color: transparent !important; } diff --git a/src/General/lib/post.class b/src/General/lib/post.class index 3bda48402..81b0797bb 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -130,10 +130,7 @@ class Post thumb.src else "#{location.protocol}//t.4cdn.org/#{@board}/thumb/#{@file.URL.match(/(\d+)\./)[1]}s.jpg" - @file.name = if nameNode = $ 'span', fileText - nameNode.title or nameNode.textContent - else - fileText.title + @file.name = fileText.title or fileText.lastElementChild.title or fileText.lastElementChild.textContent <% if (type === 'crx') { %> # replace %22 with quotes, see: # crbug.com/81193 diff --git a/src/Miscellaneous/Banner.coffee b/src/Miscellaneous/Banner.coffee index f1c05d0dd..fe210f018 100644 --- a/src/Miscellaneous/Banner.coffee +++ b/src/Miscellaneous/Banner.coffee @@ -1,7 +1,7 @@ Banner = init: -> $.asap (-> d.body), -> - $.asap (-> $ '.abovePostForm'), Banner.ready + $.asap (-> $ 'hr'), Banner.ready ready: -> banner = $ ".boardBanner" @@ -10,7 +10,6 @@ Banner = i = 0 while child = children[i++] if i is 1 - child.id = "Banner" child.title = "Click to change" $.on child, 'click', Banner.cb.toggle @@ -35,7 +34,7 @@ Banner = -> type = Object.keys(types)[Math.floor 3 * Math.random()] num = Math.floor types[type] * Math.random() - @src = "//s.4cdn.org/image/title/#{num}.#{type}" + $('img', @parentNode).src = "//s.4cdn.org/image/title/#{num}.#{type}" click: (e) -> if e.ctrlKey diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index b58de0e55..b9f73dc21 100755 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -109,10 +109,9 @@ Keybinds = if form = $ '.prev form' window.location = form.action when Conf['Search form'] - if Conf['JSON Navigation'] - Index.searchInput.focus() - else - $.id('search-btn').click() + searchInput = if Conf['JSON Navigation'] then Index.searchInput else $.id('search-box') + Header.scrollToIfNeeded searchInput + searchInput.focus() when Conf['Open catalog'] if Conf['External Catalog'] window.location = CatalogLinks.external(g.BOARD.ID)