Your Name 3 anos atrás
pai
commit
21f4a11325
1 arquivos alterados com 17 adições e 6 exclusões
  1. 17 6
      designer/designer_gen.py

+ 17 - 6
designer/designer_gen.py

@@ -28,6 +28,7 @@ def proc_file(fname,fname2,compcontent):
     fr=codecs.open(fname,'r','utf-8')
     fw=codecs.open(fname2,'w','utf-8')
     lines=fr.readlines()
+    scriptflag=False
     for l in lines:
 #        <div class="row mt-5" id="row">
         if 'div' in l and 'class' in l and 'row mt-5' in l and 'id="row"' in l:
@@ -37,19 +38,29 @@ def proc_file(fname,fname2,compcontent):
             fw.write('<div class="row mt-5" id="row_company">\n')
 
         if 'nav-link' in l and '設計師專欄' in l and 'class' in l:
-            fw.write('<a class="nav-link "  onclick="forum();">設計師專欄</a>')
+            fw.write('<a class="nav-link "  onclick="c_intro();">設計師專欄</a>')
+            continue
+
+        if 'nav-link' in l and '設計師作品' in l and 'class' in l:
+            fw.write('<a class="nav-link "  onclick="c_comp();">設計師作品</a>')
             continue
 
         fw.write(l)
-        if '</script>' in l:
-            fw.write("\n")
-            fw.write("function forum(){ \n")
+        if '</script>' in l and not scriptflag:
+            scriptflag=True
+            fw.write("\n <script>")
+            fw.write("function c_intro(){ \n")
+            fw.write("var rintro= document.getElementById('row_intro'); \n")
+            fw.write("var rcomp =  document.getElementById('row_company'); \n")
+            fw.write(' rintro.style.display="block";  \n')
+            fw.write(' rcomp.style.display = "none";  \n')
+            fw.write("} \n")
+            fw.write("function c_comp(){ \n")
             fw.write("var rintro= document.getElementById('row_intro'); \n")
             fw.write("var rcomp =  document.getElementById('row_company'); \n")
             fw.write(' rintro.style.display="none";  \n')
             fw.write(' rcomp.style.display = "block";  \n')
-            fw.write('alert("jared");')
-            fw.write("} \n")
+            fw.write("} </script> \n")
 
 #            
 #    print(lines)