]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Starting to investigate on javascript
authorJean-Marc Pigeon <jmp@safe.c>
Tue, 2 Sep 2025 10:00:23 +0000 (06:00 -0400)
committerJean-Marc Pigeon <jmp@safe.c>
Tue, 2 Sep 2025 10:00:23 +0000 (06:00 -0400)
www/complex.java [new file with mode: 0644]
www/testing.html [new file with mode: 0644]

diff --git a/www/complex.java b/www/complex.java
new file mode 100644 (file)
index 0000000..65fcb2f
--- /dev/null
@@ -0,0 +1,41 @@
+add_filter( 'the_password_form', 'wpse_12172023_custom_post_password_wrong_msg' );
+
+/**
+ * Add a message to the password form.
+ *
+ * @wp-hook the_password_form
+ * @param   string $form
+ * @return  string
+ */
+function wpse_12172023_custom_post_password_wrong_msg( $form )
+{
+    // No cookie, the user has not sent anything until now.
+    if ( ! isset( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] ) ) {
+        return $form;
+    }
+
+    // The refresh came from a different page, the user has not sent anything until now.
+    if ( wp_get_raw_referer() != get_permalink() ) {
+        return $form;
+    }
+
+    // Translate and escape.
+    $msg = esc_html__( 'Oops! Looks like your password is incorrect. Just ask your proctor for the right one.', 'your_text_domain' );
+
+    // We have a cookie, but it doesn’t match the password.
+    $msg = "<p class='custom-password-message'>$msg</p>";
+       ?>
+<style>
+    .custom-password-message {
+        background-color: #ff9999; /* Custom background color */
+        color: #990000; /* Custom text color */
+        padding: 10px; /* Custom padding */
+        border: 1px solid #cc0000; /* Custom border */
+        margin-bottom: 20px; /* Custom margin */
+    }
+</style>
+<?php
+
+    return $msg . $form;
+}
+
diff --git a/www/testing.html b/www/testing.html
new file mode 100644 (file)
index 0000000..388796b
--- /dev/null
@@ -0,0 +1,64 @@
+<HTML>
+<HEAD>
+<TITLE>Using DHTML to Create Sliding Menus (From JavaScript For Dummies, 4th Edition)</TITLE>
+<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
+<!-- Hide from older browsers
+
+function displayMenu(currentPosition,nextPosition) {
+
+    // Get the menu object located at the currentPosition on the screen
+    var whichMenu = document.getElementById(currentPosition).style;
+
+    if (displayMenu.arguments.length == 1) {
+        // Only one argument was sent in, so we need to
+        // figure out the value for "nextPosition"
+
+        if (parseInt(whichMenu.top) == -5) {
+            // Only two values are possible: one for mouseover
+            // (-5) and one for mouseout (-90). So we want
+            // to toggle from the existing position to the
+            // other position: i.e., if the position is -5,
+            // set nextPosition to -90...
+            nextPosition = -90;
+        }
+        else {
+            // Otherwise, set nextPosition to -5
+            nextPosition = -5;
+        }
+    }
+
+    // Redisplay the menu using the value of "nextPosition"
+    whichMenu.top = nextPosition + "px";
+}
+
+// End hiding-->
+</SCRIPT>
+
+<STYLE TYPE="text/css">
+<!--
+
+.menu {position:absolute; font:10px arial, helvetica, sans-serif; background-color:#ffffcc; layer-background-color:#ffffcc; top:-90px}
+#resMenu {right:10px; width:-130px}
+A {text-decoration:none; color:#000000}
+A:hover {background-color:pink; color:blue}
+
+ -->
+
+</STYLE>
+
+</HEAD>
+
+<BODY BGCOLOR="white">
+
+<div id="resMenu" class="menu" onmouseover="displayMenu('resMenu',-5)" onmouseout="displayMenu('resMenu',-90)"><br />
+<a href="#"> Alert:</a><br>
+<a href="#"> </a><br>
+<a href="#"> You pushed that button again... Didn't yeah? </a><br>
+<a href="#"> </a><br>
+<a href="#"> </a><br>
+<a href="#"> </a><br>
+</div>
+ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
+<input type="button" value="Wake that alert up" onclick="displayMenu('resMenu',-5)">
+</BODY>
+</HTML>