Personal tools
You are here: Home Zope&Plone Tips ファイル置き場 atphoto.patch (SlideShow表示対応)
Document Actions

atphoto.patch (SlideShow表示対応)

by maru last modified 2007-04-17 15:16

atphoto.jsの差分patch (/portal_skins/ATPhoto/atphoto.js)

Click here to get the file

Size 1.6 kB - File type text/x-patch

File contents

--- atphoto.js	2007-04-17 14:21:41.000000000 +0900
+++ new_atphoto.js	2007-04-17 14:21:41.000000000 +0900
@@ -3,13 +3,32 @@
 var xmlDoc;
 
 function fixHTML() {
+    var nodes,i;
+    
     /* replace all url / title */
     getATPhotoInfos();
-    replaceInNodes('div.contenttype-atphoto',/(>)[\w\s\.]+(<\/a>)/,'$1'+Batch.current.Title+'$2');
-    replaceInNodes('portal-breadcrumbs',/(<span>)[\w\s\.]+(<\/span>)/,'$1'+Batch.current.Title+'$2');
 
+    /* replace url / title (Navigation) */
+    nodes = cssQuery('div.contenttype-atphoto');
+    if (nodes.length > 0)
+    {
+        for(i = 0;i < nodes.length;i++ )
+        {
+            if( nodes[i].parentNode.className.indexOf('navTreeItem',0) != -1 )
+            {
+                var node = nodes[i].getElementsByTagName('A');
+                node[0].title     = Batch.current.Description;
+                node[0].innerHTML = Batch.current.Title;
+                node[0].href      = Batch.current.getURL+'/view';
+            }
+        }
+    }
+    /* replace title breadcrumbs */
+    nodes = document.getElementById('breadcrumbs-last-item');
+    if (nodes) { nodes.innerHTML=Batch.current.Title; }
+
+    /* replace other url */
     var url_regex = /(\shref=")\S+(\/\S*"(>|\s))/g;
-    replaceInNodes('div.contenttype-atphoto',url_regex,'$1'+Batch.current.getURL+'$2');
     replaceInNodes('dd.actionMenuContent',url_regex,'$1'+Batch.current.getURL+'$2');
     replaceInNodes('ul.contentViews',url_regex,'$1'+Batch.current.getURL+'$2');
     replaceInNodes('calendar-previous',url_regex,'$1'+Batch.current.getURL+'$2');