Echo Snippet

Kick 'n'Dirty



CSS 8 DNS 1 SQL 1 ajax 1 apache 3 bash 11 convert 3 crontab 2 css 1 error 1 fail2ban 2 gogs 1 grav 1 htaccess 3 html 13 ip 8 iptables 2 js 6 mail 2 nano 2 netatmo 1 php 42 php4 1 php5 2 php7 1 plex 1 powershell 1 regex 1 rss 3 secu 1 shell 25 ssl 2 stylus 3 tls 1 windows 1 youtube 2

.

js

[HTML/JS] Copy boutton

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 140px;
  background-color: #555;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  bottom: 150%;
  left: 50%;
  margin-left: -75px;
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #555 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}
</style>
</head>
<body>

<p>  Copy text</p>
<input type="text" value="Hello World" id="myInput">

<div class="tooltip">
<button onclick="myFunction()" onmouseout="outFunc()">
  <span class="tooltiptext" id="myTooltip">Copy to clipboard</span>
  Copy text
  </button>
</div>

 

<script>
function myFunction() {
  var copyText = document.getElementById("myInput");
  copyText.select();
  copyText.setSelectionRange(0, 99999);
  document.execCommand("copy");
  
  var tooltip = document.getElementById("myTooltip");
  tooltip.innerHTML = "Copied: " + copyText.value;
}

function outFunc() {
  var tooltip = document.getElementById("myTooltip");
  tooltip.innerHTML = "Copy to clipboard";
}
</script>

</body>
</html>

html js

https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_copy_clipboard2

<iframe width="100%" height="1568" src="https://snippet.echosystem.fr?embed=5efb6768b98c5" type="text/html"></iframe>

Texte seul - Permalink - Snippet public posté le 02/11/2021

[js] Date update with JS only

# Use this to update Year ( footer) with javascript , no php ;)


<script>document.write(new Date().getFullYear())</script>



# That will work in all browsers I've run across.
#    You can just call getFullYear directly on the newly-created Date, no need for a variable. new Date().getFullYear() may look a bit odd, but it's reliable: the new Date() part is done first, then the .getFullYear().
#    You can drop the type, because JavaScript is the default; this is even documented as part of the HTML5 specification, which is likely in this case to be writing up what browsers already do.
#    You can drop the semicolon at the end for one extra saved character, because JavaScript has "automatic semicolon insertion," a feature I normally despise and rail against, but in this specific use case it should be safe enough.

#It's important to note that this only works on browsers where JavaScript is enabled. Ideally, this would be better handled as an offline batch job (sed script on *nix, etc.) once a year, but if you want the JavaScript solution, I think that's as short as it gets. (Now I've gone and tempted fate.)


source : https://stackoverflow.com/posts/4562604/revisions

js

<iframe width="100%" height="470" src="https://snippet.echosystem.fr?embed=5db70f0c699a2" type="text/html"></iframe>

Texte seul - Permalink - Snippet public posté le 02/11/2021

[JS] Rafraichir la page lorsque la souris est en dehors de la fenêtre, stopper à son retour.

in_ms=3000 // 3 secondes
in_px=800 // 800 pixels depuis le haut.

body onload="pwnOUT()" onmouseenter="pwnIN()" onmouseleave="pwnOUT()"


<script>
let pwnREFRESH,in_ms=3000,in_px=800
function pwnIN(){window.clearTimeout(pwnREFRESH)}
function pwnOUT(){window.scrollTo(0,in_px);pwnREFRESH=window.setTimeout(reload,in_ms)}
function reload(){window.location.reload(true)}
</script>

html js

https://ponyhacks.com/?gHhofw

<iframe width="100%" height="416" src="https://snippet.echosystem.fr?embed=581351dc8a013" type="text/html"></iframe>

Texte seul - Permalink - Snippet public posté le 09/11/2021

[JS] IP Address

<SCRIPT LANGUAGE="JavaScript">
var ip = '<!--#echo var="REMOTE_ADDR"-->';
document.write("Your IP address is" + ip);
</script>

ip js

<iframe width="100%" height="254" src="https://snippet.echosystem.fr?embed=52ef6df7c4623" type="text/html"></iframe>

Texte seul - Permalink - Snippet public posté le 09/11/2021

[JS] Calendar

Calendar
This is a plain and simple monthly calendar. It's formatted with styles sheets so the appearance can easily be changed. In the head of your document, add the following style sheet and JavaScript code:

<style type="text/css">
span.label {color:black;width:30;height:16;text-align:center;margin-top:0;background:#ffF;font:bold 13px Arial}
span.c1 {cursor:hand;color:black;width:30;height:16;text-align:center;margin-top:0;background:#ffF;font:bold 13px Arial}
span.c2 {cursor:hand;color:red;width:30;height:16;text-align:center;margin-top:0;background:#ffF;font:bold 13px Arial}
span.c3 {cursor:hand;color:#b0b0b0;width:30;height:16;text-align:center;margin-top:0;background:#ffF;font:bold 12px Arial}
</style>
<script type="text/javascript">
function maxDays(mm, yyyy){
var mDay;
    if((mm == 3) || (mm == 5) || (mm == 8) || (mm == 10)){
        mDay = 30;
      }
      else{
          mDay = 31
          if(mm == 1){
               if (yyyy/4 - parseInt(yyyy/4) != 0){
                   mDay = 28
               }
               else{
                   mDay = 29
              }
        }
  }
return mDay;
}
function changeBg(id){
    if (eval(id).style.backgroundColor != "yellow"){
        eval(id).style.backgroundColor = "yellow"
    }
    else{
        eval(id).style.backgroundColor = "#ffffff"
    }
}
function writeCalendar(){
var now = new Date
var dd = now.getDate()
var mm = now.getMonth()
var dow = now.getDay()
var yyyy = now.getFullYear()
var arrM = new Array("January","February","March","April","May","June","July","August","September","October","November","December")
var arrY = new Array()
    for (ii=0;ii<=4;ii++){
        arrY[ii] = yyyy - 2 + ii
    }
var arrD = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")

var text = ""
text = "<form name=calForm>"
text += "<table border=1>"
text += "<tr><td>"
text += "<table width=100%><tr>"
text += "<td align=left>"
text += "<select name=selMonth onChange='changeCal()'>"
    for (ii=0;ii<=11;ii++){
        if (ii==mm){
            text += "<option value= " + ii + " Selected>" + arrM[ii] + "</option>"
        }
        else{
            text += "<option value= " + ii + ">" + arrM[ii] + "</option>"
        }
    }
text += "</select>"
text += "</td>"
text += "<td align=right>"
text += "<select name=selYear onChange='changeCal()'>"
    for (ii=0;ii<=4;ii++){
        if (ii==2){
            text += "<option value= " + arrY[ii] + " Selected>" + arrY[ii] + "</option>"
        }
        else{
            text += "<option value= " + arrY[ii] + ">" + arrY[ii] + "</option>"
        }
    }
text += "</select>"
text += "</td>"
text += "</tr></table>"
text += "</td></tr>"
text += "<tr><td>"
text += "<table border=1>"
text += "<tr>"
    for (ii=0;ii<=6;ii++){
        text += "<td align=center><span class=label>" + arrD[ii] + "</span></td>"
    }
text += "</tr>"
aa = 0
    for (kk=0;kk<=5;kk++){
        text += "<tr>"
        for (ii=0;ii<=6;ii++){
            text += "<td align=center><span id=sp" + aa + " onClick='changeBg(this.id)'>1</span></td>"
            aa += 1
        }
        text += "</tr>"
    }
text += "</table>"
text += "</td></tr>"
text += "</table>"
text += "</form>"
document.write(text)
changeCal()
}
function changeCal(){
var now = new Date
var dd = now.getDate()
var mm = now.getMonth()
var dow = now.getDay()
var yyyy = now.getFullYear()
var currM = parseInt(document.calForm.selMonth.value)
var prevM
    if (currM!=0){
        prevM = currM - 1
    }
    else{
        prevM = 11
    }
var currY = parseInt(document.calForm.selYear.value)
var mmyyyy = new Date()
mmyyyy.setFullYear(currY)
mmyyyy.setMonth(currM)
mmyyyy.setDate(1)
var day1 = mmyyyy.getDay()
    if (day1 == 0){
        day1 = 7
    }
var arrN = new Array(41)
var aa
    for (ii=0;ii<day1;ii++){
        arrN[ii] = maxDays((prevM),currY) - day1 + ii + 1
    }
    aa = 1
    for (ii=day1;ii<=day1+maxDays(currM,currY)-1;ii++){
        arrN[ii] = aa
        aa += 1
    }
    aa = 1
    for (ii=day1+maxDays(currM,currY);ii<=41;ii++){
        arrN[ii] = aa
        aa += 1
    }
    for (ii=0;ii<=41;ii++){
        eval("sp"+ii).style.backgroundColor = "#FFFFFF"
    }
var dCount = 0
    for (ii=0;ii<=41;ii++){
        if (((ii<7)&&(arrN[ii]>20))||((ii>27)&&(arrN[ii]<20))){
            eval("sp"+ii).innerHTML = arrN[ii]
            eval("sp"+ii).className = "c3"
        }
        else{
            eval("sp"+ii).innerHTML = arrN[ii]
            if ((dCount==0)||(dCount==6)){
                eval("sp"+ii).className = "c2"
            }
            else{
                eval("sp"+ii).className = "c1"
            }
            if ((arrN[ii]==dd)&&(mm==currM)&&(yyyy==currY)){
                eval("sp"+ii).style.backgroundColor="#90EE90"
            }
        }
    dCount += 1
        if (dCount>6){
            dCount=0
        }
    }
}
</script>

Then, in the body of your document, add the following where you want the calendar to show up:

<script type="text/javascript">writeCalendar()</script>

html ip js

<iframe width="100%" height="3314" src="https://snippet.echosystem.fr?embed=52ef6d41f205f" type="text/html"></iframe>

Texte seul - Permalink - Snippet public posté le 02/11/2021

Hide Email link on HTML page

<script language="javascript"> function guard() {
var p1, p2, p3, p4, p5, p6;
p1 = '<a href="mai'
p2 = 'MaVraie'
p3 = '">'
p1 += 'lto:'
p2 += '@'
p5 = '</a>'
p6 = 'MaFake@adresse.pro'
p2 += 'adresse.fr'
p4 = p6
document.write(p1+p2+p3+p4+p5)
}
guard();
</script> 

js mail

<iframe width="100%" height="452" src="https://snippet.echosystem.fr?embed=52e02ea72fadc" type="text/html"></iframe>

Texte seul - Permalink - Snippet public posté le 02/11/2021

Flux RSS de cette page


Echo Snippet 1.84 par Bronco - Page générée en 0.008 s