|
1 // Original image sources are stored in this array |
|
2 var originalImageSources = new Array(); |
|
3 |
|
4 // Number of images hidden (or replaced with our placeholder image) |
|
5 var hiddenCount = 0; |
|
6 |
|
7 // Replace image sources with our placeholder (if the autoloading is disabled) |
|
8 function hideImages(frameId) { |
|
9 if (parent.header_frame.g_autoLoadImages == 0) { |
|
10 var doc = document.getElementById(frameId).contentDocument; |
|
11 if (!doc) { |
|
12 doc = document.frames[frameId].document; |
|
13 } |
|
14 for (i = 0; i < doc.images.length; i++) { |
|
15 var image = doc.images[i]; |
|
16 originalImageSources.push(image.src); |
|
17 if (image.src.length > 0) { |
|
18 doc.images[i].src = "../hidden.png"; |
|
19 hiddenCount++; |
|
20 } |
|
21 } |
|
22 if (hiddenCount == 0) { |
|
23 parent.header_frame.hideDisplayImagesButton(); |
|
24 } else { |
|
25 parent.header_frame.showDisplayImagesButton(); |
|
26 } |
|
27 } else { |
|
28 parent.header_frame.updateHeader(); |
|
29 } |
|
30 requestLoadImages(); |
|
31 } |
|
32 |
|
33 // Restore original images sources |
|
34 function restoreImages(frameId) { |
|
35 if (parent.header_frame.g_autoLoadImages == 0) { |
|
36 var doc = document.getElementById(frameId).contentDocument; |
|
37 if (!doc) { |
|
38 doc = document.frames[frameId].document; |
|
39 } |
|
40 for (i = 0; i < originalImageSources.length; i++) { |
|
41 doc.images[i].src = originalImageSources[i]; |
|
42 } |
|
43 } |
|
44 } |
|
45 |
|
46 // Causes application to reload images |
|
47 function requestLoadImages() { |
|
48 location.href = "cmail://loadImages/"; |
|
49 } |