Plugin Directory

Changeset 2480216


Ignore:
Timestamp:
02/23/2021 10:39:32 PM (5 years ago)
Author:
klaetke
Message:

Version 1.3

Location:
magic/trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • magic/trunk/magic.php

    r2479879 r2480216  
    33 * Plugin Name: Magic
    44 * Plugin URI: https://klaetke.com/wordpress-magic-plugin
    5  * Description: Thanks for using the Magic Plugin. With the Following Shortcode you get the Magical Star Unicode Symbol with a awesome Click Aninmation. [magical_star], become a Magical Gradient Background with Animation [magical_gradient] More magic is coming in the next versions.
    6  * Version: 1.2
     5 * Description: Thanks for using the Magic Plugin. With the Following Shortcode you get the Magical Star Unicode Symbol with a awesome Click Aninmation. [magical_star], become a Magical Gradient Background with Animation [magical_gradient] A Magical Color Switcher you get with the Shortcode [magical_color]
     6 * Version: 1.3
    77 * Text Domain: klaetke.com
    88 * Author: Toni Klätke
     
    372372
    373373add_shortcode('magical_gradient', 'magic_two');
     374
     375 function magic_randomcolor($atts) {
     376    $Content .= '<style>html {
     377  height: 100%;
     378}
     379
     380body {
     381  width: 100%;
     382  height: 100%;
     383}
     384
     385/* Animation Layer */
     386body, button#change {
     387  transition: all 0.4s ease-in-out;
     388}</style>
     389<h1 id="colour">#e63c44</h1>
     390  <button class="ct-button" id="change">New Colour</button>
     391<script>var btn = document.getElementById("change");
     392var text = document.getElementById("colour");
     393
     394var generator = function() {
     395  newColour = "#"+(Math.random()*0xFFFFFF<<0).toString(16);
     396  console.log(newColour.length);
     397  if(newColour.length < 7) {
     398    generator();
     399  }
     400}
     401
     402btn.addEventListener("click", function() {
     403    generator();
     404   
     405    document.body.style.background = newColour;
     406    btn.style.color = newColour;
     407    text.innerText = newColour;
     408});
     409
     410// dh = $(document).height();
     411
     412// $("#container").css({"padding-top":dh/3});
     413
     414// $("#change").click(function() {
     415//     newColour = "#"+(Math.random()*0xFFFFFF<<0).toString(16);
     416//     $("body").css({"background":newColour});
     417//     $("#change").css({"color":newColour});
     418//     $("#colour").text(newColour);
     419// });</script>';
     420     
     421    return $Content;
     422}
     423
     424add_shortcode('magical_color_code', 'magic_randomcolor');
     425
     426function magic_randomcolor2($atts) {
     427    $Content .= '<style>html {
     428  height: 100%;
     429}
     430
     431body {
     432  width: 100%;
     433  height: 100%;
     434}
     435
     436/* Animation Layer */
     437body, button#change {
     438  transition: all 0.4s ease-in-out;
     439}</style>
     440<b style="display:none;" id="colour">#e63c44</b>
     441  <button class="ct-button" id="change">New Colour</button>
     442<script>var btn = document.getElementById("change");
     443var text = document.getElementById("colour");
     444
     445var generator = function() {
     446  newColour = "#"+(Math.random()*0xFFFFFF<<0).toString(16);
     447  console.log(newColour.length);
     448  if(newColour.length < 7) {
     449    generator();
     450  }
     451}
     452
     453btn.addEventListener("click", function() {
     454    generator();
     455   
     456    document.body.style.background = newColour;
     457    btn.style.color = newColour;
     458    text.innerText = newColour;
     459});
     460
     461// dh = $(document).height();
     462
     463// $("#container").css({"padding-top":dh/3});
     464
     465// $("#change").click(function() {
     466//     newColour = "#"+(Math.random()*0xFFFFFF<<0).toString(16);
     467//     $("body").css({"background":newColour});
     468//     $("#change").css({"color":newColour});
     469//     $("#colour").text(newColour);
     470// });</script>';
     471     
     472    return $Content;
     473}
     474
     475add_shortcode('magical_color', 'magic_randomcolor2');
  • magic/trunk/readme.txt

    r2479879 r2480216  
    44Requires at least: 4.0 
    55Tested up to: 5.6.1
    6 Stable Tag: 1.2
     6Stable Tag: 1.3
    77License: GPLv2 or later 
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    3030* Small Bugfixes.
    3131
    32 = 1.1 =
     32= 1.2 =
    3333* Magical Star & Magical Gradient now available.
     34
     35= 1.3 =
     36* New: The Magical Color Switcher is now available. The third Function from Magic Plugin. Copy &b paste the Shortcode: [magical_color]
Note: See TracChangeset for help on using the changeset viewer.