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