| OLD | NEW |
| 1 | 1 |
| 2 // Helpers | 2 // Helpers |
| 3 | 3 |
| 4 function $(id) { | 4 function $(id) { |
| 5 return document.getElementById(id); | 5 return document.getElementById(id); |
| 6 } | 6 } |
| 7 | 7 |
| 8 // TODO(arv): Remove these when classList is available in HTML5. | 8 // TODO(arv): Remove these when classList is available in HTML5. |
| 9 // https://bugs.webkit.org/show_bug.cgi?id=20709 | 9 // https://bugs.webkit.org/show_bug.cgi?id=20709 |
| 10 function hasClass(el, name) { | 10 function hasClass(el, name) { |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 t.href = d.url; | 239 t.href = d.url; |
| 240 t.querySelector('.pin').title = localStrings.getString(d.pinned ? | 240 t.querySelector('.pin').title = localStrings.getString(d.pinned ? |
| 241 'unpinthumbnailtooltip' : 'pinthumbnailtooltip'); | 241 'unpinthumbnailtooltip' : 'pinthumbnailtooltip'); |
| 242 t.querySelector('.remove').title = | 242 t.querySelector('.remove').title = |
| 243 localStrings.getString('removethumbnailtooltip'); | 243 localStrings.getString('removethumbnailtooltip'); |
| 244 | 244 |
| 245 // There was some concern that a malformed malicious URL could cause an XSS | 245 // There was some concern that a malformed malicious URL could cause an XSS |
| 246 // attack but setting style.backgroundImage = 'url(javascript:...)' does | 246 // attack but setting style.backgroundImage = 'url(javascript:...)' does |
| 247 // not execute the JavaScript in WebKit. | 247 // not execute the JavaScript in WebKit. |
| 248 t.querySelector('.thumbnail-wrapper').style.backgroundImage = | 248 t.querySelector('.thumbnail-wrapper').style.backgroundImage = |
| 249 'url("chrome://thumb/' + d.url + '")'; | 249 'url("' + (d.thumbnailUrl || 'chrome://thumb/' + d.url) + '")'; |
| 250 var titleDiv = t.querySelector('.title > div'); | 250 var titleDiv = t.querySelector('.title > div'); |
| 251 titleDiv.xtitle = titleDiv.textContent = d.title; | 251 titleDiv.xtitle = titleDiv.textContent = d.title; |
| 252 titleDiv.style.backgroundImage = 'url("chrome://favicon/' + d.url + '")'; | 252 titleDiv.style.backgroundImage = 'url("' + |
| 253 (d.faviconUrl || 'chrome://favicon/' + d.url) + '")'; |
| 253 titleDiv.dir = d.direction; | 254 titleDiv.dir = d.direction; |
| 254 } | 255 } |
| 255 } | 256 } |
| 256 | 257 |
| 257 /** | 258 /** |
| 258 * Calls chrome.send with a callback and restores the original afterwards. | 259 * Calls chrome.send with a callback and restores the original afterwards. |
| 259 */ | 260 */ |
| 260 function chromeSend(name, params, callbackName, callback) { | 261 function chromeSend(name, params, callbackName, callback) { |
| 261 var old = global[callbackName]; | 262 var old = global[callbackName]; |
| 262 global[callbackName] = function() { | 263 global[callbackName] = function() { |
| (...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1393 el.addEventListener('dragover', bind(this.handleDragOver, this)); | 1394 el.addEventListener('dragover', bind(this.handleDragOver, this)); |
| 1394 el.addEventListener('dragleave', bind(this.handleDragLeave, this)); | 1395 el.addEventListener('dragleave', bind(this.handleDragLeave, this)); |
| 1395 el.addEventListener('drop', bind(this.handleDrop, this)); | 1396 el.addEventListener('drop', bind(this.handleDrop, this)); |
| 1396 el.addEventListener('dragend', bind(this.handleDragEnd, this)); | 1397 el.addEventListener('dragend', bind(this.handleDragEnd, this)); |
| 1397 el.addEventListener('drag', bind(this.handleDrag, this)); | 1398 el.addEventListener('drag', bind(this.handleDrag, this)); |
| 1398 el.addEventListener('mousedown', bind(this.handleMouseDown, this)); | 1399 el.addEventListener('mousedown', bind(this.handleMouseDown, this)); |
| 1399 } | 1400 } |
| 1400 }; | 1401 }; |
| 1401 | 1402 |
| 1402 dnd.init(); | 1403 dnd.init(); |
| OLD | NEW |