Author |
Message |
Registered: March 13, 2007 | Posts: 646 |
| Posted: | | | | The last bit .. for now! Quote: Nothing to see here... move forward! | | | Last edited: by xyrano |
| Registered: March 13, 2007 | Posts: 646 |
| Posted: | | | | Quoting RossRoy: Quote: Quoting xyrano:
Quote:
Hi, RossRoy... where you've been?
Here the whole time, watching this great script develop. I just haven't had time to try it out myself yet Cool, I hope you find some time for this... soooon |
| Registered: March 13, 2007 | Reputation: | Posts: 17,334 |
| Posted: | | | | Excellent xyrano! I do believe it is now finished! at least in my eyes... I couldn't imagine anything else we could possibly add to it! Awesome work! | | | Pete |
| Registered: March 13, 2007 | Reputation: | Posts: 3,436 |
| Posted: | | | | Great! Now with filename support. Too bad I am busy today and can only try it tomorrow | | | Achim [諾亞信; Ya-Shin//Nuo], a German in Taiwan. Registered: May 29, 2000 (at InterVocative) |
| Registered: March 14, 2007 | Posts: 45 |
| Posted: | | | | Great work! - I've got a slight problem with the folder link though -I do not use the locality on the gallery folder names (loc=false) however the link is still looking for this on the folder name - I assume this is because DP_UPC holds this values - Is there an altewnrative variable w can use to avoid having to parse the value and strip the locality off ? |
| Registered: March 14, 2007 | Posts: 45 |
| Posted: | | | | Currently fixed it by reusing the UPC clean up code.
var upc = DP_UPC; if (loc == false && upc.indexOf(".") != -1) { upc = upc.substring(0, upc.lastIndexOf(".")); document.write('<a id="local-gallery-folder" class="title"' + ' href="file:///' + gsl + upc + '\\" target="_blank"><DP NAME="TITLE"></a>' + '<div id="thumbnails" class="images">'); } else document.write('<a id="local-gallery-folder" class="title"' + ' href="file:///' + gsl + DP_UPC + '\\" target="_blank"><DP NAME="TITLE"></a>' + '<div id="thumbnails" class="images">'); |
| Registered: March 13, 2007 | Posts: 646 |
| Posted: | | | | tmb4016: Good catch! Thanks! | | | Last edited: by xyrano |
| Registered: March 13, 2007 | Posts: 646 |
| Posted: | | | | Code update: v1.6.2 Quote: <html> <head> <style type="text/css"> <!-- * { color: white; font-family: verdana; font-size: 10pt; } html,body { margin: 0; padding: 0; background-color: rgb(0, 0, 83); } body { background-repeat: repeat-x; background-image: url($DPIMAGES.bgimage.jpg); } .title { font-size: 12pt; font-weight: bold; margin-top: 15pt; margin-bottom: 15pt; width: 100%; text-align: center; } .sub-categories { padding-left: 2pt; padding-bottom: 1pt; font-size: 11pt; font-weight: bold; margin-top: 5pt; margin-left: 4pt; clear: both; } .images { padding: 5pt; } span { margin: 5pt; background-color: black; border-width: 5px; border-style: double; } span.off { border-color: gray; } span.on { border-color: white; } img { cursor: hand; } --> </style> <script type="text/javascript"> <!-- <DP NAME="HEADER_VARS" Language="JavaScript" Comments="True" IncludeCast="False" IncludeCrew="False"> /* ######## Gallery Viewer ######## @title - Gallery Viewer @filename - GalleryViewer_1.6.2.html @version - 1.6.2 @date - 2007-09-20 @author - xyrano @dependencies - DVD Profiler v3+, IE.
@1.6.2 Update - Corrected issue with backward compatibility, gallery now shows
@1.6.1 Update - Corrected issue with loc var not being handled in title link
@1.6 Update - Added filename prefix support for Sub-categories - Added filename prefix support for Custom Sub-categories - Added link to title, to open explorer and navigate to the gallery
@1.5 Update - Added Custom Sub-category support
@1.4.1 Update - Corrected issue in Sub-category support
@1.4 Update - Added Sub-category support
@1.3 Update - Added post-positioning of the img tag functionality - Added Thumbnail borders and onMouse event listeners - Added background image support in style sheet. - Added clip options 1, 2 and 3 (min pos=true and cl1=true else nothing) - Added split options: 5, 7 and 9 of the tnv value, default is 3 - Added option for '0' on image names 0/1-9 - Updated Tag support with clip and split options - Cleaned the title
@1.2 Update - Added option to choose first gallery image name (start from number) - Added option to thumbnail width/height - Added Tag support
@1.1 Update - Configuration block added - gsl (Gallery Storage Location) changed see loc. - loc Locality option added.
@1.0 inital release */ // -------- Configuration block - Start -------- var gsl = "E:\\DVD Profiler\\Gallery\\"; var loc = true; // 5050582449433? var loc = false;. 5050582449433.4? var loc = true;. var ist = 1; // First gallery image name: 00.jpg? var ist = 0;. 01.jpg? var ist = 1; var zro = true; // 00.jpg/01.jpg? var zro = true;. 0.jpg/1.jpg? var zro = false;. var tnv = 128; // ThumbNail Value var bw = true; // tnv by width? var bw = true;. tnv by height? var bw = false;.
// Position and Clipping var pos = false; var cl1 = false; var cl2 = false; var cl3 = false; var sp5 = false; var sp7 = false; var sp9 = false;
// Visual var ipa = 5; // Padding for images var ima = 5; // Margin for thumbnails var bor = 3; // Thumbnail border thickness. No borders? var bor = 0;.
// Sub-categories // ----------------------------------------------- var sc = new Array([0, "---", "Don't thouch this line!", false], // ----------------------------------------------- // [Line number, "Sub-category name", "Filename-prefix", ...the rest is runtime stuff no thouchy mkay! ...], [ 1, "Image Gallery", "", false, false, []], [ 2, "Movie Posters", "mp-", false, false, []], [ 3, "Promotional Photos", "promo-", false, false, []], [ 4, "Production Photos", "prod-", false, false, []], [ 5, "Screen Caps", "sc-", false, false, []], [ 6, "Disc Art", "da-", false, false, []], [ 7, "Menu Shots", "ms-", false, false, []], [ 8, "Desktop Wallpapers (800x640)", "wp1-", false, false, []], [ 9, "Desktop Wallpapers (1024x768)", "wp2-", false, false, []], [10, "Desktop Wallpapers (1280x1024)", "wp3-", false, false, []], [11, "Desktop Wallpapers (1600x1200)", "wp4-", false, false, []], // ----------------------------------------------- ["@"] ); // -----------------------------------------------
// Tags var useTags = true; var tagHierarchy = "9: Preferences/Gallery Viewer/" var tagByHeight = tagHierarchy + "By height"; // Controls bw from a tag var tagPos = tagHierarchy + "Position image"; // Controls pos from a tag var tagCl1 = tagHierarchy + "Clip/1"; // Controls cl1 from a tag var tagCl2 = tagHierarchy + "Clip/2"; // Controls cl2 from a tag var tagCl3 = tagHierarchy + "Clip/3"; // Controls cl3 from a tag var tagSp5 = tagHierarchy + "Split tnv by/5"; // Controls sp5 from a tag var tagSp7 = tagHierarchy + "Split tnv by/7"; // Controls sp7 from a tag var tagSp9 = tagHierarchy + "Split tnv by/9"; // Controls sp9 from a tag // -------- Configuration block - The End -------- var int = DP_Notes.indexOf("<gallery="); // 1.6.1 new var tit = DP_Title; if (int != -1) {
// Clean Locality from UPC? // 1.6.1 moved var upc = DP_UPC; if (loc == false && upc.indexOf(".") != -1) upc = upc.substring(0, upc.lastIndexOf(".")); gsl += upc;
// 1.6 new sc.row = 0; sc.nme = 1; sc.pfx = 2; sc.has = 3; sc.did = 4; sc.img = 5;
// Tags // 1.6.1 moved if (useTags == true) for (var i = 0; i < DP_Tags.length; i++) { if (tagByHeight.length != 0 && DP_Tags[i].toLowerCase() == tagByHeight.toLowerCase()) bw = false; if (tagPos.length != 0 && DP_Tags[i].toLowerCase() == tagPos.toLowerCase()) pos = true; if (tagCl1.length != 0 && DP_Tags[i].toLowerCase() == tagCl1.toLowerCase()) cl1 = true; if (tagCl2.length != 0 && DP_Tags[i].toLowerCase() == tagCl2.toLowerCase()) cl2 = true; if (tagCl3.length != 0 && DP_Tags[i].toLowerCase() == tagCl3.toLowerCase()) cl3 = true; if (tagSp5.length != 0 && DP_Tags[i].toLowerCase() == tagSp5.toLowerCase()) sp5 = true; if (tagSp7.length != 0 && DP_Tags[i].toLowerCase() == tagSp7.toLowerCase()) sp7 = true; if (tagSp9.length != 0 && DP_Tags[i].toLowerCase() == tagSp9.toLowerCase()) sp9 = true; } } // 1.3 new function visual() {
if (int != -1) {
var ele = document.getElementById('thumbnails'); ele.style.padding = ipa + 'px'; for (var i = 0; i < document.getElementsByTagName('span').length; i++) {
var ele = document.getElementsByTagName('span')[i]; ele.style.margin = ima + 'px'; ele.style.borderWidth = bor + 'px'; } if (pos) positionImages(); } }
// 1.6 updated function updateScArray(str, k) {
// Update sc array var cav = str.split("="); var test = cav[0].match(/[a-z]/g); if (test == null) sc[parseInt(cav[0])][sc.has] = true; if (cav[1].indexOf(":") != -1) { // images in range : var tmp = cav[1].split(":"); var tmp2 = new Array(); for (var i = parseInt(tmp[0]); i <= parseInt(tmp[1]); i++) tmp2.push(i); (test == null) ? sc[parseInt(cav[0])][sc.img] = tmp2: pushCustomName(cav[0], tmp2); } else if (cav[1].indexOf(";") != -1) { // jumps ; (test == null) ? sc[parseInt(cav[0])][sc.img] = cav[1].split(";"): pushCustomName(cav[0], cav[1].split(";")); } else { (test == null) ? sc[parseInt(cav[0])][sc.img] = new Array(cav[1]): pushCustomName(cav[0], new Array(cav[1])); } cav = null; }
// 1.6 updated function pushCustomName(str, arr) {
var csc = (str.indexOf("¤") != -1) ? str.split("¤"): new Array(str, ''); sc.pop(); var newArray = new Array(sc.length, csc[0], csc[1], true, false); csc = null; newArray.push(arr); sc.push(newArray); newArray = null; sc.push("@"); }
// 1.6 updated function imageFactory(fnp, i) {
var img = (zro && i <= 9) ? '0' + i: i; if (fnp != '') img = fnp + img; var imp = gsl + "\\" + img + ".jpg"; var span = '<span style="'; span += ((bw) ? ' width': 'height') +': ' + tnv + ';'; if (pos && (cl1 || cl2 || cl3)) { span += ' ' + ((bw) ? 'height': ' width') + ': '; var i1 = parseInt((sp9) ? 9: ((sp7) ? 7: ((sp5) ? 5: 3))); var i2 = parseInt((cl3) ? i1 - 3: ((cl2) ? i1 - 2: i1 - 1)); span += parseInt((i2) ? (tnv / i1) * i2: (tnv / i1)); span += '; overflow: hidden;'; } span += '"'; span += ' onMouseOver="flashIt(this, true); return false;"'; span += ' onMouseOut="flashIt(this, false); return false;"'; span += ' class="off">'; var hit = '<img src="' + imp + '"'; hit += (bw) ? ' width': ' height'; hit += '="' + tnv + '" title="' + imp + '" onClick="newWindow(\'' + img + '\'); return false;">'; return span + hit + '</span>'; }
// 1.3 new function positionImages() {
if (cl1 || cl2 || cl3) for (var i = 0; i < document.getElementsByTagName('img').length; i++) {
var img = document.getElementsByTagName('img')[i]; var spa = document.getElementsByTagName('span')[i]; var sp = parseInt((!bw) ? spa.style.width: spa.style.height); var st = sp - ((!bw) ? img.width: img.height); img.style.position = 'absolute'; if (bw) img.style.top = (st / 2 - bor) + 'px'; if (!bw) img.style.left = (st / 2 - bor) + 'px'; } }
// 1.3 moved function newWindow(img) {
var imp = gsl + "\\" + img + ".jpg"; var doc = '<html><body style="margin:0;padding:0;background-color:black;"><img src="' + imp + '"></body></html>'; var win = window.open("", 'Gallery', 'scrollbars=no, resizable, dependent, status=no'); win.document.write(doc); win.document.close(); var imw = win.document.images[0].width; var imh = win.document.images[0].height; win.resizeTo(imw + 12, imh + 38); win.focus(); }
// 1.3 new function flashIt(obj, bool) { obj.className = (bool) ? 'on': 'off'; } //--> </script> </head> <body scroll="auto" onload="visual();"> <script type="text/javascript"> <!-- document.write('<a id="local-gallery-folder" class="title"' + ' href="file:///' + gsl + '" target="_blank">' + tit + '</a>' + '<div id="thumbnails" class="images">'); if (int != -1) {
// Get image count and sub-categories. // 1.6 updated var cat = ""; var ims = DP_Notes.substring(int, DP_Notes.indexOf(">", int)); ims = ims.replace("<gallery=",""); if (ims.indexOf("?") != -1) { sc[0][sc.has] = true; cat = ims.substring(ims.indexOf("?") + 1, ims.length); if (cat.indexOf("&") != -1) { var caa = cat.split("&"); for (var i = 0; i < caa.length; i++) updateScArray(caa[i], i); caa = null; } else updateScArray(cat, 0); cat = null; } ims = parseInt(ims);
// Insert Sub-categories // 1.6.2 updated if (sc[0][sc.has] == true) { for (var j = 1; j < sc.length; j++) if (sc[j][sc.has] == true && sc[j][sc.did] == false) { document.write('<div class="sub-categories">' + sc[j][sc.nme] + '</div>'); sc[j][sc.did] = true; for (var i = 0; i < sc[j][sc.img].length; i++) document.write(imageFactory(sc[j][sc.pfx], sc[j][sc.img][i])); } } else for (var i = ist; i < (ims + ist); i++) document.write(imageFactory('', i)); } else { document.write("No Gallery Available!"); } document.write("</div>"); //--> </script> </body> </html>
@1.6 Update - Added filename prefix support for Sub-categories (italic) - Added filename prefix support for Custom Sub-categories (bold) - Added link to title, to open explorer and navigate to the gallery [ 1, "Image Gallery", "", false, false, []], [ 2, "Movie Posters", " mp-", false, false, []], [ 3, "Promotional Photos", " promo-", false, false, []], [ 4, "Production Photos", " prod-", false, false, []], [ 5, "Screen Caps", " sc-", false, false, []], [ 6, "Disc Art", " da-", false, false, []], [ 7, "Menu Shots", " ms-", false, false, []], [ 8, "Desktop Wallpapers (800x640)", " wp1-", false, false, []], [ 9, "Desktop Wallpapers (1024x768)", " wp2-", false, false, []], [10, "Desktop Wallpapers (1280x1024)", " wp3-", false, false, []], [11, "Desktop Wallpapers (1600x1200)", " wp4-", false, false, []], Expand the array so you don't have to use the custom sub-category option: Copy the last line that starts with [number, ...], past underneath the copied line. [11, "Desktop Wallpapers (1600x1200)", " wp4-", false, false, []], [11, "Desktop Wallpapers (1600x1200)", " wp4-", false, false, []], Change; [11, "Desktop Wallpapers (1600x1200)", " wp4-", false, false, []], [ 11, " Desktop Wallpapers (1600x1200)", " wp4-", false, false, []], <gallery=3> = images 01.jpg to 03.jpg is rendered <gallery=3?1=1:3> = images 01.jpg to 03.jpg is rendered <gallery=3?2=1:3> = images mp-01.jpg to mp-03.jpg is rendered <gallery=3?A custom sub-category with 'test-' as filename prefix ¤test-=1:3> = images test-01.jpg to test-03.jpg is rendered @1.6.1 Update - Corrected issue with loc var not being handled in title link @1.6.2 Update - Corrected issue with backward compatibility, gallery now shows Enjoy! | | | Last edited: by xyrano |
| Registered: March 13, 2007 | Posts: 646 |
| Posted: | | | | Alright, this has been tons of fun to help bring to life and I feel that the Gallery Viewer is finished. I want to express my gratitude to ANYONE posting ANYTHING about this little "add-on", with a big THANK YOU! [Tutorial update placeholder ] |
| Registered: August 22, 2007 | Reputation: | Posts: 1,807 |
| Posted: | | | | Wow! It works like a charm with sub-categories too. Only a retrocompatibility issue though: now I can't get the script to show old Galleries, with just <Gallery=n> in the Notes section and files 01.jpg and so on. Or maybe I messed something up!? Not a big problem anyway, I can "fix" it just by changing <Gallery=n> to <Gallery=n?1=1:n>. Or to something on the line of <Gallery=n?1=a:b&2=c:d&...&7=m:n...> and add filename prefixes accordingly if I want sub-categories. I use localities and no tags associated with the script. | | | -- Enry |
| Registered: March 13, 2007 | Posts: 2,692 |
| Posted: | | | | Quoting EnryWiki: Quote: Wow! It works like a charm with sub-categories too. Only a retrocompatibility issue though: now I can't get the script to show old Galleries, with just <Gallery=n> in the Notes section and files 01.jpg and so on. Or maybe I messed something up!?
I was going to raise exactly the same problem.. I wasn't really wanting to change 2-300 notes just to get the default gallery showing again. | | | Paul |
| Registered: March 13, 2007 | Posts: 646 |
| Posted: | | | | Thanks guys, for finding that... it is now fixed in the above code.
I feel I chose the wrong approach in having the filename prefix string defined, in the array. As a result, a user must rename the images if ? (in <gallery=n?...) is included in the notes. To go around this, You can clean the array by removing the filename prefix's from the array all together. Change: [ 1, "Image Gallery", "", false, false, []], [ 2, "Movie Posters", "mp-", false, false, []], .. [11, "Desktop Wallpapers (1600x1200)", "wp4-", false, false, []], To [ 1, "Image Gallery", "", false, false, []], [ 2, "Movie Posters", "", false, false, []], .. [11, "Desktop Wallpapers (1600x1200)", "", false, false, []], and you are set. Once you've renamed say all Movie poster's in all galleries you could add the filename prefix in the array (...Movie Posters", "mp-", false...). |
| Registered: August 22, 2007 | Reputation: | Posts: 1,807 |
| Posted: | | | | Quoting xyrano: Quote:
@1.6.2 Update - Corrected issue with backward compatibility, gallery now shows
Confirmed. Ta! | | | -- Enry |
| Registered: March 14, 2007 | Posts: 45 |
| Posted: | | | | Using 1.6.2 now and everything is great - cannot think of anything else to add to this - Yet ! Great work and thanks for all your time and effort !!! |
| Registered: March 13, 2007 | Reputation: | Posts: 17,334 |
| Posted: | | | | for some reason I have at least one profile that does not seem to be working... It was fine the other day when I switched it to sub-galleries... but now all I get is a blank blue background with no images and no text what so ever.
I am sure the code is fine... I have it as.. <gallery=8?2=0&5=1:6&6=7>
any thoughts? | | | Pete |
| Registered: March 13, 2007 | Reputation: | Posts: 17,334 |
| Posted: | | | | I just filtered all my profiles with galleries.. and I now know that 11 out of 46 profiles have this problem... no images showing... no text showing... no nothing but the blue background. | | | Pete |
|
|