Merge branch 'v3' of git://github.com/MayhemYDG/4chan-x into v3
Conflicts: Gruntfile.js src/features.coffee
This commit is contained in:
commit
6eaeb0ee2c
@ -1,8 +1,8 @@
|
||||
// ==UserScript==
|
||||
// @name 4chan X
|
||||
// @version 3.0.1
|
||||
// @version 3.0.4
|
||||
// @namespace 4chan-X
|
||||
// @description Cross-browser userscript for maximum lurking on 4chan.
|
||||
// @description Cross-browser extension for productive lurking on 4chan.
|
||||
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||
// @copyright 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com>
|
||||
// @license MIT; http://en.wikipedia.org/wiki/Mit_license
|
||||
|
||||
143
4chan-X.user.js
143
4chan-X.user.js
File diff suppressed because one or more lines are too long
@ -1,3 +1,11 @@
|
||||
### 3.0.4 - *2013-04-11*
|
||||
|
||||
- More minor fixes.
|
||||
|
||||
### 3.0.3 - *2013-04-10*
|
||||
|
||||
- Minor fixes.
|
||||
|
||||
### 3.0.2 - *2013-04-09*
|
||||
|
||||
- Added a setting in the Header's menu to move it at the bottom of the screen.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "4chan-X",
|
||||
"version": "3.0.2",
|
||||
"version": "3.0.4",
|
||||
"description": "Cross-browser extension for productive lurking on 4chan.",
|
||||
"meta": {
|
||||
"name": "4chan X",
|
||||
@ -19,9 +19,9 @@
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-bump": "~0.0.0",
|
||||
"grunt-contrib-clean": "~0.4.0",
|
||||
"grunt-contrib-coffee": "~0.6.5",
|
||||
"grunt-contrib-compress": "~0.4.7",
|
||||
"grunt-contrib-concat": "~0.1.3",
|
||||
"grunt-contrib-coffee": "~0.6.6",
|
||||
"grunt-contrib-compress": "~0.4.9",
|
||||
"grunt-contrib-concat": "~0.2.0",
|
||||
"grunt-contrib-copy": "~0.4.1",
|
||||
"grunt-contrib-watch": "~0.3.1",
|
||||
"grunt-exec": "~0.4.0"
|
||||
|
||||
@ -9,6 +9,8 @@ Header =
|
||||
|
||||
$.on window, 'load hashchange', Header.hashScroll
|
||||
|
||||
$.on d, 'CreateNotification', @createNotification
|
||||
|
||||
$.asap (-> d.body), ->
|
||||
return unless Main.isThisPageLegit()
|
||||
# Wait for #boardNavMobile instead of #boardNavDesktop,
|
||||
@ -108,6 +110,11 @@ Header =
|
||||
$.add shortcut, [$.tn(' ['), el, $.tn(']')]
|
||||
$.add Header.shortcuts, shortcut
|
||||
|
||||
createNotification: (e) ->
|
||||
{type, content, lifetime, cb} = e.detail
|
||||
notif = new Notification type, content, lifetime
|
||||
cb notif if cb
|
||||
|
||||
class Notification
|
||||
constructor: (type, content, @timeout) ->
|
||||
@add = add.bind @
|
||||
@ -631,7 +638,9 @@ Settings =
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend><input type=checkbox name='Custom CSS' #{if Conf['Custom CSS'] then 'checked' else ''}> Custom CSS</legend>
|
||||
<legend>
|
||||
<label><input type=checkbox name='Custom CSS' #{if Conf['Custom CSS'] then 'checked' else ''}> Custom CSS</label>
|
||||
</legend>
|
||||
<button id=apply-css>Apply CSS</button>
|
||||
<textarea name=usercss class=field spellcheck=false #{if Conf['Custom CSS'] then '' else 'disabled'}></textarea>
|
||||
</fieldset>
|
||||
@ -687,7 +696,7 @@ Settings =
|
||||
<img src=#{Favicon.unreadDead}>
|
||||
"""
|
||||
togglecss: ->
|
||||
if $('textarea', @parentNode.parentNode).disabled = !@checked
|
||||
if $('textarea[name=usercss]', $.x 'ancestor::fieldset[1]', @).disabled = !@checked
|
||||
CustomCSS.rmStyle()
|
||||
else
|
||||
CustomCSS.addStyle()
|
||||
@ -1039,16 +1048,13 @@ Filter =
|
||||
else
|
||||
"\\#{c}"
|
||||
|
||||
re =
|
||||
if ['uniqueID', 'MD5'].contains type
|
||||
"/#{re}/"
|
||||
else
|
||||
"/^#{re}$/"
|
||||
unless Filter.menu.post.isReply
|
||||
re += ';op:yes'
|
||||
re = if ['uniqueID', 'MD5'].contains type
|
||||
"/#{re}/"
|
||||
else
|
||||
"/^#{re}$/"
|
||||
|
||||
# Add a new line before the regexp unless the text is empty.
|
||||
$.get type, '', (item) ->
|
||||
$.get type, Conf[type], (item) ->
|
||||
save = item[type]
|
||||
save =
|
||||
if save
|
||||
@ -1057,16 +1063,16 @@ Filter =
|
||||
re
|
||||
$.set type, save
|
||||
|
||||
# Open the settings and display & focus the relevant filter textarea.
|
||||
Settings.open 'Filter'
|
||||
section = $ '.section-container'
|
||||
select = $ 'select[name=filter]', section
|
||||
select.value = type
|
||||
Settings.selectFilter.call select
|
||||
ta = $ 'textarea', section
|
||||
tl = ta.textLength
|
||||
ta.setSelectionRange tl, tl
|
||||
ta.focus()
|
||||
# Open the settings and display & focus the relevant filter textarea.
|
||||
Settings.open 'Filter'
|
||||
section = $ '.section-container'
|
||||
select = $ 'select[name=filter]', section
|
||||
select.value = type
|
||||
Settings.selectFilter.call select
|
||||
ta = $ 'textarea', section
|
||||
tl = ta.textLength
|
||||
ta.setSelectionRange tl, tl
|
||||
ta.focus()
|
||||
|
||||
ThreadHiding =
|
||||
init: ->
|
||||
@ -1737,7 +1743,8 @@ Keybinds =
|
||||
return unless /(Esc|Alt|Ctrl|Meta)/.test key
|
||||
|
||||
threadRoot = Nav.getThread()
|
||||
thread = Get.postFromNode($('.op', threadRoot)).thread
|
||||
if op = $ '.op', threadRoot
|
||||
thread = Get.postFromNode(op).thread
|
||||
switch key
|
||||
# QR & Options
|
||||
when Conf['Toggle board list']
|
||||
@ -3082,7 +3089,7 @@ RelativeDates =
|
||||
diff = now - date
|
||||
relative = RelativeDates.relative diff, now, date
|
||||
for singlePost in [post].concat post.clones
|
||||
singlePost.nodes.date.textContent = relative
|
||||
singlePost.nodes.date.firstChild.textContent = relative
|
||||
setOwnTimeout diff
|
||||
|
||||
markStale = -> RelativeDates.stale.push update
|
||||
@ -3283,15 +3290,8 @@ ImageExpand =
|
||||
return unless rect.top <= 0 or rect.left <= 0
|
||||
# Scroll back to the thumbnail when contracting the image
|
||||
# to avoid being left miles away from the relevant post.
|
||||
<<<<<<< HEAD
|
||||
headRect = Header.bar.getBoundingClientRect()
|
||||
top = rect.top - headRect.top - headRect.height
|
||||
=======
|
||||
{top} = rect
|
||||
unless Conf['Bottom header']
|
||||
headRect = Header.toggle.getBoundingClientRect()
|
||||
top += - headRect.top - headRect.height
|
||||
>>>>>>> 354f566672b2dc8a556c33d6a24c0ec33ee995c8
|
||||
root = if $.engine is 'webkit' then d.body else doc
|
||||
root.scrollTop += top if rect.top < 0
|
||||
root.scrollLeft = 0 if rect.left < 0
|
||||
|
||||
@ -477,6 +477,11 @@ Main =
|
||||
Main.callbackNodes Thread, threads
|
||||
Main.callbackNodes Post, posts
|
||||
|
||||
if $.hasClass d.body, 'fourchan_x'
|
||||
alert '4chan X v2 detected: Disable it or v3 will break.'
|
||||
if /Firefox\/1/.test navigator.userAgent
|
||||
alert 'Your version of Firefox is incompatible with 4chan X v3. Firefox 20+ is required.'
|
||||
|
||||
$.event '4chanXInitFinished'
|
||||
Main.checkUpdate()
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// @name <%= meta.name %>
|
||||
// @version <%= version %>
|
||||
// @namespace <%= name %>
|
||||
// @description Cross-browser userscript for maximum lurking on 4chan.
|
||||
// @description <%= description %>
|
||||
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||
// @copyright 2012-<%= grunt.template.today('yyyy') %> Nicolas Stepien <stepien.nicolas@gmail.com>
|
||||
// @license MIT; http://en.wikipedia.org/wiki/Mit_license
|
||||
|
||||
@ -839,6 +839,7 @@ QR =
|
||||
if g.BOARD.ID is 'f'
|
||||
filetag = QR.nodes.flashTag.value
|
||||
threadID = QR.nodes.thread.value
|
||||
thread = g.BOARD.threads[threadID]
|
||||
|
||||
# prevent errors
|
||||
if threadID is 'new'
|
||||
@ -851,7 +852,7 @@ QR =
|
||||
err = 'You can\'t reply to this thread anymore.'
|
||||
else unless post.com or post.file
|
||||
err = 'No file selected.'
|
||||
else if post.file and g.BOARD.threads[threadID].fileLimit
|
||||
else if post.file and thread.fileLimit and !thread.isSticky
|
||||
err = 'Max limit of image replies has been reached.'
|
||||
|
||||
if QR.captcha.isEnabled and !err
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user