file.URL -> file.url

This commit is contained in:
ccd0 2015-04-12 22:45:36 -07:00
parent 3f22852412
commit c2080e8629
11 changed files with 26 additions and 26 deletions

View File

@ -454,7 +454,7 @@ Settings =
data = data =
isReply: true isReply: true
file: file:
URL: '//i.4cdn.org/g/1334437723720.jpg' url: '//i.4cdn.org/g/1334437723720.jpg'
name: 'd9bb2efc98dd0df141a94399ff5880b7.jpg' name: 'd9bb2efc98dd0df141a94399ff5880b7.jpg'
size: '276 KB' size: '276 KB'
sizeInBytes: 276 * 1024 sizeInBytes: 276 * 1024

View File

@ -170,7 +170,7 @@ class Post
@file = @file =
text: fileText text: fileText
link: link link: link
URL: link.href url: link.href
name: fileText.title or link.title or link.textContent name: fileText.title or link.title or link.textContent
size: info[1] size: info[1]
isImage: /(jpg|png|gif)$/i.test link.href isImage: /(jpg|png|gif)$/i.test link.href

View File

@ -112,7 +112,7 @@ Gallery =
thumb = $.el 'a', thumb = $.el 'a',
className: 'gal-thumb' className: 'gal-thumb'
href: post.file.URL href: post.file.url
target: '_blank' target: '_blank'
title: post.file.name title: post.file.name

View File

@ -34,7 +34,7 @@ ImageCommon =
return true return true
error: (file, post, delay, cb) -> error: (file, post, delay, cb) ->
src = post.file.URL.split '/' src = post.file.url.split '/'
URL = Redirect.to 'file', URL = Redirect.to 'file',
boardID: post.board.ID boardID: post.board.ID
filename: src[src.length - 1] filename: src[src.length - 1]
@ -51,10 +51,10 @@ ImageCommon =
cb URL cb URL
<% if (type === 'crx') { %> <% if (type === 'crx') { %>
$.ajax post.file.URL, $.ajax post.file.url,
onloadend: -> onloadend: ->
if @status is 200 if @status is 200
URL = post.file.URL URL = post.file.url
else else
post.kill true if @status is 404 post.kill true if @status is 404
redirect() redirect()
@ -74,7 +74,7 @@ ImageCommon =
post.kill true post.kill true
redirect() redirect()
else else
URL = post.file.URL URL = post.file.url
<% } %> <% } %>
# Add controls, but not until the mouse is moved over the video. # Add controls, but not until the mouse is moved over the video.

View File

@ -122,7 +122,7 @@ ImageExpand =
$.rmClass post.nodes.root, 'expanded-image' $.rmClass post.nodes.root, 'expanded-image'
$.rmClass file.thumb, 'expanding' $.rmClass file.thumb, 'expanding'
$.rm file.videoControls if file.videoControls $.rm file.videoControls if file.videoControls
file.thumb.parentNode.href = file.URL file.thumb.parentNode.href = file.url
file.thumb.parentNode.target = '_blank' file.thumb.parentNode.target = '_blank'
for x in ['isExpanding', 'isExpanded', 'videoControls', 'wasPlaying', 'scrollIntoView'] for x in ['isExpanding', 'isExpanded', 'videoControls', 'wasPlaying', 'scrollIntoView']
delete file[x] delete file[x]
@ -175,7 +175,7 @@ ImageExpand =
el = file.fullImage = $.el (if isVideo then 'video' else 'img') el = file.fullImage = $.el (if isVideo then 'video' else 'img')
el.dataset.fullID = post.fullID el.dataset.fullID = post.fullID
$.on el, 'error', ImageExpand.error $.on el, 'error', ImageExpand.error
el.src = src or file.URL el.src = src or file.url
el.className = 'full-image' el.className = 'full-image'
$.after thumb, el $.after thumb, el

View File

@ -32,7 +32,7 @@ ImageHover =
el = $.el (if isVideo then 'video' else 'img') el = $.el (if isVideo then 'video' else 'img')
el.dataset.fullID = post.fullID el.dataset.fullID = post.fullID
$.on el, 'error', error $.on el, 'error', error
el.src = file.URL el.src = file.url
if Conf['Restart when Opened'] if Conf['Restart when Opened']
ImageCommon.rewind el ImageCommon.rewind el

View File

@ -44,7 +44,7 @@ ImageLoader =
video.setAttribute 'muted', 'muted' video.setAttribute 'muted', 'muted'
video.dataset.md5 = thumb.dataset.md5 video.dataset.md5 = thumb.dataset.md5
video.style[attr] = thumb.style[attr] for attr in ['height', 'width', 'maxHeight', 'maxWidth'] video.style[attr] = thumb.style[attr] for attr in ['height', 'width', 'maxHeight', 'maxWidth']
video.src = file.URL video.src = file.url
$.replace thumb, video $.replace thumb, video
file.thumb = video file.thumb = video
file.videoThumb = true file.videoThumb = true
@ -52,9 +52,9 @@ ImageLoader =
prefetch: (post) -> prefetch: (post) ->
{file} = post {file} = post
return unless file return unless file
{isImage, isVideo, thumb, URL} = file {isImage, isVideo, thumb, url} = file
return if file.isPrefetched or !(isImage or isVideo) or post.isHidden or post.thread.isHidden return if file.isPrefetched or !(isImage or isVideo) or post.isHidden or post.thread.isHidden
type = if (match = URL.match(/\.([^.]+)$/)[1].toUpperCase()) is 'JPEG' then 'JPG' else match type = if (match = url.match(/\.([^.]+)$/)[1].toUpperCase()) is 'JPEG' then 'JPG' else match
replace = Conf["Replace #{type}"] and !/spoiler/.test(thumb.src or thumb.dataset.src) replace = Conf["Replace #{type}"] and !/spoiler/.test(thumb.src or thumb.dataset.src)
return unless replace or Conf['prefetch'] return unless replace or Conf['prefetch']
return unless [post, post.clones...].some (clone) -> doc.contains clone.nodes.root return unless [post, post.clones...].some (clone) -> doc.contains clone.nodes.root
@ -70,11 +70,11 @@ ImageLoader =
el = $.el if isImage then 'img' else 'video' el = $.el if isImage then 'img' else 'video'
if replace and isImage if replace and isImage
$.on el, 'load', -> $.on el, 'load', ->
clone.file.thumb.src = URL for clone in post.clones clone.file.thumb.src = url for clone in post.clones
thumb.src = URL thumb.src = url
# XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1021289 # XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1021289
thumb.removeAttribute 'data-src' thumb.removeAttribute 'data-src'
el.src = URL el.src = url
toggle: -> toggle: ->
if Conf['prefetch'] = @checked if Conf['prefetch'] = @checked

View File

@ -7,7 +7,7 @@ Metadata =
cb: @node cb: @node
node: -> node: ->
return unless @file and /webm$/i.test @file.URL return unless @file and /webm$/i.test @file.url
if @isClone if @isClone
el = $ '.webm-title', @file.text el = $ '.webm-title', @file.text
else else
@ -21,7 +21,7 @@ Metadata =
load: -> load: ->
$.rmClass @parentNode, 'error' $.rmClass @parentNode, 'error'
$.addClass @parentNode, 'loading' $.addClass @parentNode, 'loading'
CrossOrigin.binary Get.postFromNode(@).file.URL, (data) => CrossOrigin.binary Get.postFromNode(@).file.url, (data) =>
$.rmClass @parentNode, 'loading' $.rmClass @parentNode, 'loading'
if data? if data?
title = Metadata.parse data title = Metadata.parse data

View File

@ -27,15 +27,15 @@ Sauce =
m = part.match /^(\w*):(.*)$/ m = part.match /^(\w*):(.*)$/
parts[m[1]] = m[2] parts[m[1]] = m[2]
parts['text'] or= parts['url'].match(/(\w+)\.\w+\//)?[1] or '?' parts['text'] or= parts['url'].match(/(\w+)\.\w+\//)?[1] or '?'
ext = post.file.URL.match(/[^.]*$/)[0] ext = post.file.url.match(/[^.]*$/)[0]
skip = false skip = false
for key of parts for key of parts
parts[key] = parts[key].replace /%(T?URL|IMG|MD5|board|name|%|semi)/g, (parameter) -> parts[key] = parts[key].replace /%(T?URL|IMG|MD5|board|name|%|semi)/g, (parameter) ->
type = { type = {
'%TURL': post.file.thumbURL '%TURL': post.file.thumbURL
'%URL': post.file.URL '%URL': post.file.url
'%IMG': if ext in ['gif', 'jpg', 'png'] then post.file.URL else post.file.thumbURL '%IMG': if ext in ['gif', 'jpg', 'png'] then post.file.url else post.file.thumbURL
'%MD5': post.file.MD5 '%MD5': post.file.MD5
'%board': post.board.ID '%board': post.board.ID
'%name': post.file.name '%name': post.file.name

View File

@ -14,6 +14,6 @@ DownloadLink =
order: 100 order: 100
open: ({file}) -> open: ({file}) ->
return false unless file return false unless file
a.href = file.URL a.href = file.url
a.download = file.name a.download = file.name
true true

View File

@ -28,10 +28,10 @@ FileInfo =
$.extend outputNode, <%= html('@{output}') %> $.extend outputNode, <%= html('@{output}') %>
formatters: formatters:
t: -> <%= html('${this.file.URL.match(/[^\/]*$/)[0]}') %> t: -> <%= html('${this.file.url.match(/[^\/]*$/)[0]}') %>
T: -> <%= html('<a href="${this.file.URL}" target="_blank">&{FileInfo.formatters.t.call(this)}</a>') %> T: -> <%= html('<a href="${this.file.url}" target="_blank">&{FileInfo.formatters.t.call(this)}</a>') %>
l: -> <%= html('<a href="${this.file.URL}" target="_blank">&{FileInfo.formatters.n.call(this)}</a>') %> l: -> <%= html('<a href="${this.file.url}" target="_blank">&{FileInfo.formatters.n.call(this)}</a>') %>
L: -> <%= html('<a href="${this.file.URL}" target="_blank">&{FileInfo.formatters.N.call(this)}</a>') %> L: -> <%= html('<a href="${this.file.url}" target="_blank">&{FileInfo.formatters.N.call(this)}</a>') %>
n: -> n: ->
fullname = @file.name fullname = @file.name
shortname = Build.shortFilename @file.name, @isReply shortname = Build.shortFilename @file.name, @isReply