Difference between pages "Hacking Device" and "MediaWiki:Common.js"

From Infinity
(Difference between pages)
Jump to: navigation, search
 
 
Line 1: Line 1:
{{section-hacking}}
+
/* Any JavaScript here will be loaded for all users on every page load. */
{{section-equipment}}
 
  
  
Hacking Devices are the tools used during cybercombat. Multipurpose and versatile, these devices can be useful as support elements or to perform powerful cyberattacks, depending on the Device.
 
  
== Hacking Devices and Hacking Programs: Characteristics ==
 
  
Hacking Devices and Hacking Programs have the following characteristics:
 
  
*They act in the user's Hacking Area.
+
/* The main toggle function moved here. */
*They do not require LoF to act, unless the Hacking Program's own description states otherwise.
 
{{n4list}}
 
* Only Troopers or Peripherals in Model form may be targeted by Hacking Programs.
 
{{n4end}}
 
* They benefit, if applicable, from the target's [[Targeted]] State.
 
  
 +
function toggleN4(showN4) {
 +
/*  alert("clicked! " +showN4); */
 +
    if (showN4=="true") {
 +
        $(".n4").show(300);
 +
        $(".n4list").show(300);
 +
        $(".n4inline").show(300);
 +
        $(".c1hide").hide(300);
 +
        setCookie("showN4", "true", 30);
 +
        var user=getCookie("showN4");
 +
/*      alert("Saved cookie: " + user); */
 +
        var ele = document.getElementsByClassName("c1strike");
 +
        for(var i=0;i<ele.length;i++){
 +
            ele[i].style.setProperty("text-decoration", "line-through");
 +
        }
 +
    } else {
 +
        $(".n4").hide(300);
 +
        $(".n4list").hide(300);
 +
        $(".n4inline").hide(300);
 +
        $(".c1hide").show(300);
 +
        setCookie("showN4", "false", 30);
 +
        var user=getCookie("showN4");
 +
/*      alert("Saved cookie: " + user); */
 +
        var ele = document.getElementsByClassName("c1strike");
 +
        for(var i=0;i<ele.length;i++){
 +
            ele[i].style.setProperty("text-decoration", "");
 +
        }
 +
    }
 +
}
  
{{c1}}
 
{| class="wikitable-dark"
 
|-
 
! Device !! Program 1 !! Program 2
 
|-
 
| Hacking Device || [[Carbonite]] || [[Spotlight]]
 
|}
 
  
 +
function forceN4() {
 +
/*  alert("clicked! " +showN4); */
 +
        setCookie("showN4", "true", 30);
 +
        $(".n4").show(0);
 +
        $(".n4list").show(0);
 +
        $(".n4inline").show(0);
 +
        $(".c1hide").hide(0);
 +
        $('#gametoggle').attr('checked', true);
 +
        var ele = document.getElementsByClassName("c1strike");
 +
        for(var i=0;i<ele.length;i++){
 +
            ele[i].style.setProperty("text-decoration", "line-through");
 +
        }
 +
 +
}
  
{{skillbox |black| HACKING DEVICE | AUTOMATIC EQUIPMENT }}
 
{{skill-label | Comms Equipment }}
 
{{effects}}
 
* Allows the use of the [[Carbonite]] and [[Spotlight]] [[Hacking Programs]].
 
{{c1end}}
 
{{n4}}
 
{| class="wikitable-dark"
 
|-
 
! Device !! Program 1 !! Program 2 !! Program 3 !! Program 4 !! Program 6 !! Program 6
 
|-
 
| Hacking Device || [[Carbonite]] || [[Spotlight]] || [[Total Control]] || [[Oblivion]] || -- || --
 
|-
 
| Hacking Device Plus || [[Carbonite]] || [[Spotlight]] || [[Total Control]] || [[Oblivion]] || [[White Noise]] || [[Cybermask]]
 
|-
 
| Killer Hacking Device || [[Trinity]] || [[Cybermask]] || -- || -- || -- || --
 
|-
 
| EVO Hacking Device || [[Assisted Fire]] || [[Enhanced Reaction]] || [[Fairy Dust]] || [[Controlled Jump]] || -- || --
 
|}
 
  
 +
function forceC1() {
 +
/*  alert("clicked! " +showN4); */
 +
        setCookie("showN4", "false", 30);
 +
        $('#gametoggle').attr('checked', false);
 +
      $(".n4").hide(0);
 +
      $(".n4list").hide(0);
 +
        $(".n4inline").hide(0);
 +
        $(".c1hide").show(0);
 +
        var ele = document.getElementsByClassName("c1strike");
 +
        for(var i=0;i<ele.length;i++){
 +
            ele[i].style.setProperty("text-decoration", "");
 +
        }
 +
}
  
{{n4end}}
 
{{n4list}}
 
== Hacking Device ==
 
{{skillbox |black| HACKING DEVICE | AUTOMATIC EQUIPMENT }}
 
{{skill-label | Comms Equipment }}
 
{{effects}}
 
* Allows the use of the [[Carbonite]], [[Oblivion]], [[Spotlight]] and [[Total Control]] [[Hacking Programs]].
 
  
  
== Hacking Device Plus ==
+
/* This code creates the N4 reveal slider, and what happens when you click on it. */
{{skillbox |black| HACKING DEVICE PLUS | AUTOMATIC EQUIPMENT }}
 
{{skill-label | Comms Equipment }}
 
{{effects}}
 
* Allows the use of the [[Carbonite]], [[Cybermask]], [[Oblivion]], [[Spotlight]], [[Total Control]] and [[White Noise]] [[Hacking Programs]].
 
  
 +
$(document).ready(function(){
 +
    var doShow=getCookie("showN4");
 +
    if (doShow =="true") {
 +
        forceN4()
 +
    }
 +
    var showFromURL=getParameterByName('version');
 +
    if (showFromURL =="n4") {
 +
        forceN4()
 +
        setCookie("showN4", "true", 30);
 +
    }
 +
    if (showFromURL =="c1") {
 +
        forceC1()
 +
        setCookie("showN4", "false", 30);
 +
    }
  
== Killer Hacking Device ==
+
          $(".n4toggle").hide();
{{skillbox |black| KILLER HACKING DEVICE | AUTOMATIC EQUIPMENT }}
+
            $("#gametoggle").click(function(){
{{skill-label | Comms Equipment }}
+
                if ($("#gametoggle").is(":checked")) {
{{effects}}
+
                    toggleN4("true")
* Allows the use of the [[Cybermask]] and [[Trinity]] [[Hacking Programs]].
+
              } else {
 +
                    toggleN4("false")
 +
                }
 +
            });
 +
        });
  
  
== EVO Hacking Device ==
+
$(function () {
{{skillbox |black| EVO HACKING DEVICE | AUTOMATIC EQUIPMENT }}
+
$('#n4gametoggle').html("<div id='toggleinner'><span class='gamesliderlabel'>C1 </span><label class='switch' > <input type='checkbox' id='gametoggle' ><span class='slider round' ></span></label><span class='gamesliderlabel'> N4 </span></div>");
{{skill-label | Comms Equipment }}
+
}());
{{effects}}
 
* Allows the use of the [[Assisted Fire]], [[Controlled Jump]], [[Enhanced Reaction]] and [[Fairy Dust]]  [[Hacking Programs]].
 
  
  
  
{{n4end}}
 
  
 +
/* URL parameter stuff. */
  
[[Category:Hacking]]
+
function getParameterByName(name, url) {
 +
    if (!url) url = window.location.href;
 +
    name = name.replace(/[\[\]]/g, '\\$&');
 +
    var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
 +
        results = regex.exec(url);
 +
    if (!results) return null;
 +
    if (!results[2]) return '';
 +
    return decodeURIComponent(results[2].replace(/\+/g, ' '));
 +
}
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
/* Cookie stuff. */
 +
 
 +
function setCookie(cname, cvalue, exdays) {
 +
  var d = new Date();
 +
  d.setTime(d.getTime() + (exdays*24*60*60*1000));
 +
  var expires = "expires="+ d.toUTCString();
 +
  document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
 +
}
 +
 
 +
function getCookie(cname) {
 +
  var name = cname + "=";
 +
  var decodedCookie = decodeURIComponent(document.cookie);
 +
  var ca = decodedCookie.split(';');
 +
  for(var i = 0; i <ca.length; i++) {
 +
    var c = ca[i];
 +
    while (c.charAt(0) == ' ') {
 +
      c = c.substring(1);
 +
    }
 +
    if (c.indexOf(name) == 0) {
 +
      return c.substring(name.length, c.length);
 +
    }
 +
  }
 +
  return "";
 +
}

Revision as of 10:19, 15 September 2023

/* Any JavaScript here will be loaded for all users on every page load. */





/* The main toggle function moved here. */

function toggleN4(showN4) {
/*   alert("clicked! " +showN4); */
    if (showN4=="true") {
        $(".n4").show(300);
        $(".n4list").show(300);
        $(".n4inline").show(300);
        $(".c1hide").hide(300);
        setCookie("showN4", "true", 30);
        var user=getCookie("showN4");
 /*       alert("Saved cookie: " + user); */
        var ele = document.getElementsByClassName("c1strike");
        for(var i=0;i<ele.length;i++){
            ele[i].style.setProperty("text-decoration", "line-through");
        }
    } else {
        $(".n4").hide(300);
        $(".n4list").hide(300);
        $(".n4inline").hide(300);
        $(".c1hide").show(300);
        setCookie("showN4", "false", 30);
        var user=getCookie("showN4");
 /*       alert("Saved cookie: " + user); */
        var ele = document.getElementsByClassName("c1strike");
        for(var i=0;i<ele.length;i++){
            ele[i].style.setProperty("text-decoration", "");
        }
    }
}


function forceN4() {
/*   alert("clicked! " +showN4); */
        setCookie("showN4", "true", 30);
        $(".n4").show(0);
        $(".n4list").show(0);
        $(".n4inline").show(0);
        $(".c1hide").hide(0);
        $('#gametoggle').attr('checked', true);
        var ele = document.getElementsByClassName("c1strike");
        for(var i=0;i<ele.length;i++){
            ele[i].style.setProperty("text-decoration", "line-through");
        }
 
}


function forceC1() {
/*   alert("clicked! " +showN4); */
        setCookie("showN4", "false", 30);
        $('#gametoggle').attr('checked', false);
       $(".n4").hide(0);
       $(".n4list").hide(0);
        $(".n4inline").hide(0);
        $(".c1hide").show(0);
        var ele = document.getElementsByClassName("c1strike");
        for(var i=0;i<ele.length;i++){
            ele[i].style.setProperty("text-decoration", "");
        }
}



/* This code creates the N4 reveal slider, and what happens when you click on it. */

$(document).ready(function(){
    var doShow=getCookie("showN4");
    if (doShow =="true") {
        forceN4()
    }
    var showFromURL=getParameterByName('version');
    if (showFromURL =="n4") {
        forceN4()
        setCookie("showN4", "true", 30);
    }
    if (showFromURL =="c1") {
        forceC1()
        setCookie("showN4", "false", 30);
    }

          $(".n4toggle").hide();
            $("#gametoggle").click(function(){
                if ($("#gametoggle").is(":checked")) {
                    toggleN4("true")
               } else {
                    toggleN4("false")
                }
            });
        });


$(function () {
	$('#n4gametoggle').html("<div id='toggleinner'><span class='gamesliderlabel'>C1 </span><label class='switch' > <input type='checkbox' id='gametoggle' ><span class='slider round' ></span></label><span class='gamesliderlabel'> N4 </span></div>");
}());




/* URL parameter stuff. */

function getParameterByName(name, url) {
    if (!url) url = window.location.href;
    name = name.replace(/[\[\]]/g, '\\$&');
    var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
        results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, ' '));
}






/* Cookie stuff. */

function setCookie(cname, cvalue, exdays) {
  var d = new Date();
  d.setTime(d.getTime() + (exdays*24*60*60*1000));
  var expires = "expires="+ d.toUTCString();
  document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}

function getCookie(cname) {
  var name = cname + "=";
  var decodedCookie = decodeURIComponent(document.cookie);
  var ca = decodedCookie.split(';');
  for(var i = 0; i <ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0) == ' ') {
      c = c.substring(1);
    }
    if (c.indexOf(name) == 0) {
      return c.substring(name.length, c.length);
    }
  }
  return "";
}