Skip to content
M ABD AZIZ ALFIAN edited this page Nov 18, 2019 · 9 revisions

Welcome to the safelink-jquery wiki!

Table of contents

Getting Started

Here is the full example to using Safelink jQuery Plugin.

<html>
<head></head>
<body>
<!-- Put position for first button -->
<div id="safelinker1"></div>
<p>Here is could be paragraph of your site.</p>
<!-- Put position for second button -->
<div id="safelinker2"></div>
<script src="https://cdn.jsdelivr.net/npm/safelink-jquery@1.1.0/src/safelink.min.js"></script>
<script>
  $(document).ready(function(){
    var options = {
      timer: true
    };
    $('#safelinker1').Safelink(options).build('#safelinker2');
  });
</script>
</body>
</html>

Note:

  • Your URL must be having parameter safelink to make this plugin works.
    example: https://yourdomain.com?safelink=aHR0cHM6Ly9oZXhvZGVyLmNvbS9wb3N0L2NvbnRhY3Q=
  • Using base64 cryptography standard. So it should be encoded in parameter url.

API

$().Safelink(options)

Load Safelink plugin class.

  • options - is an configuration. [optional]

Example default options:

$('#safelinker1').Safelink({
    encoded:'',
    paramName: 'safelink',
    timer: false,
    timer_first: 8,
    timer_second: 8,
    firstTimerText: 'Loading safelink:',
    secondTimerText: 'Scanning the link:',
    firstButtonText: 'Click Here !!!',
    secondButtonText: 'Get Link !!!'
}).build('#safelinker2');

options

  • encoded : is the base64 hash. If you put at here, script will not looking from parameter url.
  • paramName : is the parameter url name for base64. Default value is safelink.
  • timer : is to make button wait for a second.
  • timer_first : is to set how long to wait before first button appear.
  • timer_second : is to set how long to wait before second button appear.
  • firstTimerText : is to show the text to user while waiting the first button to appear.
  • secondTimerText : is to show the text to user while waiting the second button to appear.
  • firstButtonText : is to show the first button text.
  • secondButtonText : is to show the second button text.

Crypto

Layer to use base64 outside.

encode(value)

Encode string to base64.

decode(value)

Decode base64 to string.

build(element, btnClass)

Button builder for safelink.

  • element - is the div position for the second button.
  • btnClass - is to add class for all safelink button. [optional]

Example:

// All safelink buttons will use class from Bootstrap CSS
$('#safelinker1').Safelink().build('#safelinker2','btn btn-primary');