##// END OF EJS Templates
Added ability to add links to specific domains and show the domain logo as an image substitute
neko259 -
r1695:6ee0d7fe default
parent child Browse files
Show More
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -40,6 +40,10 b' URL_PROTOCOLS = {'
40 'magnet': 'magnet',
40 'magnet': 'magnet',
41 }
41 }
42
42
43 URL_DOMAINS = {
44 'meduza.io': 'meduza',
45 }
46
43 CSS_CLASS_IMAGE = 'image'
47 CSS_CLASS_IMAGE = 'image'
44 CSS_CLASS_THUMB = 'thumb'
48 CSS_CLASS_THUMB = 'thumb'
45
49
@@ -160,7 +164,15 b' class UrlViewer(AbstractViewer):'
160
164
161 def get_format_view(self):
165 def get_format_view(self):
162 protocol = self.url.split('://')[0]
166 protocol = self.url.split('://')[0]
163 url_image_name = URL_PROTOCOLS.get(protocol, FILE_STUB_URL)
167 domain = self.url.split('/')[2]
168
169 if protocol in URL_PROTOCOLS:
170 url_image_name = URL_PROTOCOLS.get(protocol)
171 elif domain in URL_DOMAINS:
172 url_image_name = URL_DOMAINS.get(domain)
173 else:
174 url_image_name = FILE_STUB_URL
175
164 image = static('images/' + url_image_name + '.png')
176 image = static('images/' + url_image_name + '.png')
165
177
166 w, h = get_static_dimensions('images/' + url_image_name + '.png')
178 w, h = get_static_dimensions('images/' + url_image_name + '.png')
General Comments 0
You need to be logged in to leave comments. Login now