Quellcode durchsuchen

inlined js in modal templates

Juan Carlos vor 4 Jahren
Ursprung
Commit
4714ce87f5

+ 5 - 44
marktplatz/templates/marktplatz/modal-sa.html

@@ -1,46 +1,8 @@
 
 
-    <!-- <style>
-    .modal {
-      display: none;
-      position: fixed;
-      z-index: 3;
-      padding-top: 100px;
-      left: 0;
-      top: 0;
-      width: 100%;
-      height: 100%;
-      overflow: auto;
-      background-color: rgb(0,0,0);
-      background-color: rgba(0,0,0,0.4);
-    }
-
-    .modal-content {
-      background-color: #fefefe;
-      margin: auto;
-      padding: 20px;
-      border: 1px solid #888;
-      width: 80%;
-    }
-
-    .close {
-      color: #aaaaaa;
-      float: right;
-      font-size: 28px;
-      font-weight: bold;
-    }
-
-    .close:hover,
-    .close:focus {
-      color: #000;
-      text-decoration: none;
-      cursor: pointer;
-    }
-    </style> -->
-
 
     <!-- Trigger/Open The Modal -->
-    <span id="myBtn" class="cursor-pointer"><i  class="fas fa-bell"></i> Suchagent aktivieren</span>
+    <span id="myBtn" class="cursor-pointer" onclick="function openm() { document.getElementById('SearchAgentModal').style.display = 'block'; }; openm(); "><i  class="fas fa-bell"></i> Suchagent aktivieren</span>
 
     <!-- The Modal -->
     <div id="SearchAgentModal" class="modal" onclick="function hide(e){ e.style.display='None'; } hide(this);" >
@@ -48,14 +10,16 @@
       <div class="modal-content">
         <!-- {% now "YFdHi-u" %} -->
 
-        <span id="agentClose" class="close">&times;</span>
+        <span id="agentClose" onclick = "function closem() { document.getElementById('SearchAgentModal').style.display = 'none'; }; closem();" class="close">&times;</span>
         <iframe src="{% url 'search-agent-form-embed' %}?bz={{ product.ort }}" style="border:0px #ffffff none; width:100%;" name="myiFrame" height="600" allowfullscreen></iframe>
 
       </div>
     </div>
 
 
+    <!--
     <script>
+    // Script for clarity
     var modal = document.getElementById("SearchAgentModal");
     var btn = document.getElementById("myBtn");
     var agentSpan = document.getElementById("agentClose");
@@ -66,7 +30,4 @@
       modal.style.display = "none";
     }
 
-
-
-
-    </script>
+    </script> -->

+ 73 - 68
marktplatz/templates/marktplatz/modal-share.html

@@ -2,54 +2,16 @@
 {% load tags %}
 {% load static %}
 {% load email_obfuscator %}
-    <!-- <style>
-    .modal {
-      display: none;
-      position: fixed;
-      z-index: 1;
-      padding-top: 100px;
-      left: 0;
-      top: 0;
-      width: 100%;
-      height: 100%;
-      overflow: auto;
-      background-color: rgb(0,0,0);
-      background-color: rgba(0,0,0,0.4);
-    }
-
-    .modal-content {
-      background-color: #fefefe;
-      margin: auto;
-      padding: 20px;
-      border: 1px solid #888;
-      width: 80%;
-    }
-
-    .close {
-      color: #aaaaaa;
-      float: right;
-      font-size: 28px;
-      font-weight: bold;
-    }
-
-    .close:hover,
-    .close:focus {
-      color: #000;
-      text-decoration: none;
-      cursor: pointer;
-    }
-
-    </style> -->
 
 
     <!-- Trigger/Open The Modal -->
-    <span id="ShareButton" class="cursor-pointer" ><i class="fas fa-share"></i> Teilen </span>
+    <span id="ShareButton" onclick = "(function () { document.getElementById('ShareModal').style.display = 'block'; })(); return false;" class="cursor-pointer" ><i class="fas fa-share"></i> Teilen </span>
 
     <!-- The Modal -->
     <div id="ShareModal" class="modal" onclick="function hide(e){ e.style.display='None'; } hide(this);" >
       <!-- Modal content -->
       <div class="modal-content">
-        <span id="ShareClose" class="close">&times;</span>
+        <span id="ShareClose" onclick = "(function() { document.getElementById('ShareModal').style.display = 'none'; } )(); return false;" class="close">&times;</span>
 
         <div class=""> &nbsp; </div>
         <i class="fas fa-share"></i>
@@ -81,7 +43,13 @@
 
 
         <input type="text" value="&lt;iframe src=&quot;{% fullurl 'product-detail-embed' pk=product.wohnprojekt.pk %}&quot; style=&quot;border:0px #ffffff none;&quot; name=&quot;myiFrame&quot; scrolling=&quot;yes&quot; frameborder=&quot;0&quot; marginheight=&quot;0px&quot; marginwidth=&quot;0px&quot; height=&quot;400px&quot; width=&quot;600px&quot; allowfullscreen&gt;&lt;/iframe&gt;" id="iframecode">
-        <div class="cursor-pointer" onclick="copyiframecode()">
+        <div class="cursor-pointer" onclick = "function copyiframecode() {
+              var copyText = document.getElementById('iframecode');
+              copyText.select();
+              copyText.setSelectionRange(0, 99999)
+              document.execCommand('copy');
+              alert('Der Text wurde in der Zwischenablage kopiert: ' + copyText.value);
+            }; copyiframecode();" >
 
           <i class="fas fa-code"></i>
           <span>Code Kopieren</span>
@@ -90,7 +58,13 @@
         <div class=""> <span>Link</span> </div>
 
         <input type="text" value="{% fullurl 'product-detail-embed' pk=product.wohnprojekt.pk %}" id="embedlink">
-        <div class="cursor-pointer" onclick="copyembedlinkcode()">
+        <div class="cursor-pointer"  onclick = "function copyembedlinkcode() {
+              var copyText = document.getElementById('embedlink');
+              copyText.select();
+              copyText.setSelectionRange(0, 99999)
+              document.execCommand('copy');
+              alert('Der Text wurde in der Zwischenablage kopiert: ' + copyText.value);
+            }; copyembedlinkcode();" >
 
           <i class="fas fa-code"></i>
           <span>Code Kopieren</span>
@@ -101,29 +75,60 @@
     </div>
 
 
-    <script>
-    var ShareModal = document.getElementById("ShareModal");
-    var ShareBtn = document.getElementById("ShareButton");
-    var ShareSpan = document.getElementById("ShareClose");
-    ShareBtn.onclick = function() {
-      ShareModal.style.display = "block";
-    }
-    ShareSpan.onclick = function() {
-      ShareModal.style.display = "none";
-    }
-    function copyiframecode() {
-      var copyText = document.getElementById("iframecode");
-      copyText.select();
-      copyText.setSelectionRange(0, 99999)
-      document.execCommand("copy");
-      alert("Der Text wurde in der Zwischenablage kopiert: " + copyText.value);
-    }
-
-    function copyembedlinkcode() {
-      var copyText = document.getElementById("embedlink");
-      copyText.select();
-      copyText.setSelectionRange(0, 99999)
-      document.execCommand("copy");
-      alert("Der Text wurde in der Zwischenablage kopiert: " + copyText.value);
-    }
-    </script>
+    <!-- <script>
+    // var ShareModal = document.getElementById('ShareModal');
+    // var ShareBtn = document.getElementById('ShareButton');
+    // var ShareSpan = document.getElementById('ShareClose');
+    // ShareBtn.onclick = function () {
+    //   ShareModal.style.display = 'block';
+    // }
+    // ShareSpan.onclick = function() {
+    //   ShareModal.style.display = 'none';
+    // }
+    // function copyiframecode() {
+    //   var copyText = document.getElementById('iframecode');
+    //   copyText.select();
+    //   copyText.setSelectionRange(0, 99999)
+    //   document.execCommand('copy');
+    //   alert('Der Text wurde in der Zwischenablage kopiert: ' + copyText.value);
+    // }
+    //
+    // function copyembedlinkcode() {
+    //   var copyText = document.getElementById('embedlink');
+    //   copyText.select();
+    //   copyText.setSelectionRange(0, 99999)
+    //   document.execCommand('copy');
+    //   alert('Der Text wurde in der Zwischenablage kopiert: ' + copyText.value);
+    // }
+
+
+
+    // ShareBtn.onclick = "(function () { document.getElementById('ShareModal').style.display = 'block'; })(); return false;";
+    //
+    //
+    // ShareSpan.onclick = "(function() { document.getElementById('ShareModal').style.display = 'none'; } )(); return false;"
+    //
+    //
+    //
+    //
+    // onclick = "function copyiframecode() {
+    //   var copyText = document.getElementById('iframecode');
+    //   copyText.select();
+    //   copyText.setSelectionRange(0, 99999)
+    //   document.execCommand('copy');
+    //   alert('Der Text wurde in der Zwischenablage kopiert: ' + copyText.value);
+    // }; copyiframecode();"
+
+    // onclick = "function copyembedlinkcode() {
+    //   var copyText = document.getElementById('embedlink');
+    //   copyText.select();
+    //   copyText.setSelectionRange(0, 99999)
+    //   document.execCommand('copy');
+    //   alert('Der Text wurde in der Zwischenablage kopiert: ' + copyText.value);
+    // }; copyembedlinkcode();"
+
+
+
+
+
+    </script> -->