Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- $(document).on("ready", function(){
- /*LAYOUT CONTENT SCRIPT*/
- var body_1= $('body');
- if( body_1.hasClass("scroll_header") === true){
- $(window).on("scroll", function(){
- if ($(document).scrollTop() >= 250) {
- body_1.addClass("active_scroll");
- }else{
- body_1.removeClass("active_scroll");
- }
- });
- }
- $(window).on("load", function(){
- /* url navigation active */
- var url = window.location;
- function menuitems(){
- if(body_1.hasClass('horizontal-menu') === false){
- var element = $('.sidebar-left #side-menu li a').filter(function() {
- return this.href == url;
- }).addClass('active').parent("li").addClass('active').closest('.nav').addClass('in').slideDown().prev().addClass('show').closest('.nav').slideDown().addClass('in').prev().addClass('show');
- $('.sidebar-left .nav li a').on('click', function(){
- if( $(this).hasClass('menudropdown')=== true){
- $(this).toggleClass("show").next().slideToggle().parent().addClass("in");
- }
- });
- }else {
- if( $(window).width() >=1020){
- var element = $('.sidebar-left #side-menu li a').filter(function() {
- return this.href == url;
- }).addClass('active').parent("li").addClass('active').closest('.nav').addClass('in').prev().addClass('show').closest('.nav').slideDown().addClass('in').prev().addClass('show');
- // Horizontal menu mouse over effect with click
- $('.sidebar-left > .nav > li').on('click', function(){ // If you required on hover please checkge 'click' to 'mouseover'
- if( $(this).find('a:first-of-type').hasClass('menudropdown')==true){
- $(this).find('a:first-of-type').addClass("show").next().slideDown().parent().addClass("in");
- }
- });
- $('.sidebar-left > .nav > li ').on('mouseleave', function(){
- if( $(this).find('a:first-of-type').hasClass('menudropdown')==true){
- $(this).find('a:first-of-type').removeClass("show").next().slideUp().parent().removeClass("in");
- }
- });
- }
- else{
- var element = $('.sidebar-left #side-menu li a').filter(function() {
- return this.href == url;
- }).addClass('active').parent("li").addClass('active').closest('.nav').addClass('in').slideDown().prev().addClass('show').closest('.nav').slideDown().addClass('in').prev().addClass('show');
- $('.sidebar-left .nav li a').on('click', function(){
- if( $(this).hasClass('menudropdown')===true){
- $(this).toggleClass("show").next().slideToggle().parent().addClass("in");
- }
- });
- }
- }
- }
- menuitems();
- /*Full screen result container show*/
- $('#search_header').on('focus', function(){
- $(".search-block").show();
- body_1.addClass('searchshow');$('#search_header').focusout();
- });
- /* Search window screen fullscreen open */
- $('.search-block .close-btn').on('click', function(){
- $(".search-block").slideUp();
- body_1.removeClass('searchshow');
- });
- /* on keypress hide search block which was in fullscreen */
- $(document).keyup(function(e) {
- if (e.keyCode == 27) { // escape key maps to keycode `27`
- $(".search-block").fadeOut();
- body_1.removeClass('searchshow');
- $('#search_header').focusout();
- }
- });
- /* inbox mail page collapsible */
- $(".inboxmenu").on("click", function(){
- $(".mailboxnav ").toggleClass("mailboxnavopen");
- });
- $(".filemenu_btn").on("click", function(){
- $(".filemenu ").toggleClass("filemenuopen");
- });
- /* menu collapsible */
- $(".menu-collapse").on("click", function(){
- body_1.toggleClass("menuclose");
- });
- $(".menu-collapse-right").on("click", function(){
- body_1.toggleClass("menuclose-right");
- });
- $(".menu-small").on("click",function(){
- body_1.toggleClass("menusmall");
- });
- /* loading screen */
- $(".loader_wrapper").fadeOut("slow");
- });
- /* Custom css checkbox script */
- $('.form-check-input').on('change', function(){
- $(this).parent().toggleClass("active")
- $(this).closest(".media").toggleClass("active");
- });
- /* Card fullscreeen button script */
- $('.fullscreen-btn').on('click', function(){
- $(this).closest(".full-screen-container").toggleClass("fullscreen");
- body_1.toggleClass("fullscreen");
- });
- /* Card fullscreeen button script ends */
- /* Card fullscreeen button script */
- $('.push-cookie .alert.top .close, .push-cookie .alert.top .btn-secondary').on('click', function(){
- body_1.removeClass("push-cookie");
- });
- /* Resposnsive Utility hide menu */
- if($(window).width() >= 1440 && body_1.hasClass("no-menu-show") != true){
- if( body_1.hasClass("left-menu-only") === true ){
- body_1.removeClass('menuclose');
- }else if( body_1.hasClass("horizontal-menu") === true ){
- body_1.addClass('menuclose-right');
- }else{
- body_1.removeClass('menuclose ');
- }
- }else{
- if( body_1.hasClass("left-menu-only") === true ){
- body_1.addClass('menuclose');
- }else{
- body_1.addClass('menuclose ');
- }
- // This script is for body click hide menu //
- $(document).on('click', function(event){ if(event.target.className !== ".menu-collapse,.menu-collapse-right, .sidebar-left,.sidebar-right"){body_1.addClass('menuclose menuclose-right');}});
- $('.menu-collapse,.menu-collapse-right, .sidebar-left,.sidebar-right').on('click', function(event){event.stopPropagation();});
- $('.dropdown-toggle,[data-toggle="dropdown"],.userprofile').dropdown();
- // This script is for body click ends here //
- }
- $('.dropdown-toggle,[data-toggle="dropdown"],.userprofile').dropdown();
- $(window).on('resize', function(){
- if($(window).width() >= 1440 && body_1.hasClass("no-menu-show") != true){ body_1.removeClass('menuclose '); }else{ body_1.addClass('menuclose menuclose-right'); }
- });
- });
- function spincrementElement(htmlElement, isDecimal = false) {
- htmlElement.spincrement({
- from: 0,
- decimalPlaces: (isDecimal) ? 2 : 0,
- thousandSeparator: false,
- duration: 1500, // ms; TOTAL length animation
- leeway: 50, // percent of duraion
- easing: 'spincrementEasing',
- fade: true
- });
- }
- function sendNotify(title = "", msg = "", type = "danger")
- {
- $.notify({
- title: title,
- message: msg,
- },{
- // settings
- element: 'body',
- position: null,
- type: type,
- timer: 1000,
- placement: {
- from: "top",
- align: "right"
- }
- });
- }
- function toFixed(num, fixed) {
- var re = new RegExp('^-?\\d+(?:\.\\d{0,' + (fixed || -1) + '})?');
- return parseFloat(num.toString().match(re)[0]).toFixed(fixed);
- }
- function shorten(data, length = 26)
- {
- return data.length > length ? data.substr( 0, length ) + '…' : data;
- }
- function copyToClipboard(textToCopy)
- {
- var targetId = "_hiddenCopyText_";
- target = document.getElementById(targetId);
- if (!target) {
- var target = document.createElement("textarea");
- target.style.position = "absolute";
- target.style.left = "-9999px";
- target.style.top = "0";
- target.id = targetId;
- document.body.appendChild(target);
- }
- target.textContent = textToCopy;
- // select the content
- var currentFocus = document.activeElement;
- target.focus();
- target.setSelectionRange(0, target.value.length);
- // copy the selection
- var succeed;
- try {
- succeed = document.execCommand("copy");
- } catch(e) {
- succeed = false;
- }
- // restore original focus
- if (currentFocus && typeof currentFocus.focus === "function") {
- currentFocus.focus();
- }
- return succeed;
- }
- function formatXLQ(pXLQ, decimals = 8, wrap = false, smallDecimals = false) {
- if(wrap) {
- if(smallDecimals) {
- var x = toFixed((pXLQ/100000000), decimals).toString().split(".");
- var l = x[0];
- var d = x[1];
- return '<p style="display: inline-block;" class="' + ((pXLQ > 0) ? 'XLQGreen' : ((pXLQ < 0) ? 'XLQRed' : '' )) + '">' + l + '<small>.' + d + '</small> XLQ</p>';
- } else
- return '<p style="display: inline-block;" class="' + ((pXLQ > 0) ? 'XLQGreen' : ((pXLQ < 0) ? 'XLQRed' : '' )) + '">' + (pXLQ/100000000).toFixed(decimals) + ' XLQ</p>';
- } else
- return toFixed((pXLQ/100000000), decimals);
- }
- function getExplorerTX(tx, classes="") {
- return '<a target="_blank" href="' + explorerurl + 'tx/' + tx + '">' + shorten(tx) + '</a>';
- }
- function getExplorerWallet(wallet, copyBtn = false, shortWallet = false) {
- if(copyBtn)
- return '<a target="_blank" href="' + explorerurl + 'wallet/' + wallet + '">' + ((shortWallet) ? shorten(wallet, 22) : wallet) + '</a> <p onclick="copyToClipboard(\'' + wallet +'\')" class="fa fa-copy"></p>';
- else return '<a target="_blank" href="' + explorerurl + 'wallet/' + wallet + '">' + ((shortWallet) ? shorten(wallet, 22) : wallet) + '</a>';
- }
- function getOrdinalNum(n) {
- return n + (n > 0 ? ['th', 'st', 'nd', 'rd'][(n > 3 && n < 21) || n % 10 > 3 ? 0 : n % 10] : '');
- }
- function formatTimeToString(pTimestamp, length = 3){
- //Sun, 19 Nov 2017 08:14:55 GMT
- var days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
- var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
- var n = new Date(pTimestamp * 1000);
- n = new Date(n.getTime() - (n.getTimezoneOffset() * 60000));
- var tmpDateTime = "";
- if(length == 1)
- tmpDateTime = getOrdinalNum(n.getUTCDate()) + " " + months[n.getUTCMonth()] + " " + ('0' + n.getUTCHours()).slice(-2) + ":" + ('0' + n.getUTCMinutes()).slice(-2);
- if(length == 2)
- tmpDateTime = getOrdinalNum(n.getUTCDate()) + " " + months[n.getUTCMonth()] + " " + n.getUTCFullYear() + " " + ('0' + n.getUTCHours()).slice(-2) + ":" + ('0' + n.getUTCMinutes()).slice(-2) + ":" + ('0' + n.getUTCSeconds()).slice(-2);
- if(length == 3)
- tmpDateTime = days[n.getUTCDay()] + ", " + n.getUTCDate() + " " + months[n.getUTCMonth()] + " " + n.getUTCFullYear() + " " + ('0' + n.getUTCHours()).slice(-2) + ":" + ('0' + n.getUTCMinutes()).slice(-2) + ":" + ('0' + n.getUTCSeconds()).slice(-2);
- return tmpDateTime;
- }
- function checkTime(i) {
- if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
- return i;
- }
- const explorerurl = "https://explorer.alqo.org/";
- const apiurl = "https://liberio.app/api/";
- const summarytime = 10*1000;
- const transactiontime = 10*1000;
- const graphtime = 20*1000;
- const statstictime = 30*1000;
- function apiSummary(pFunction){
- $.get(apiurl + "summary", {} ,pFunction);
- }
- function apiSendSummary(pFunction){
- $.get(apiurl + "sendsummary", {} ,pFunction);
- }
- function apiGlacierSummary(pFunction){
- $.get(apiurl + "glaciersummary", {} ,pFunction);
- }
- function apiPrivateKeyByUWID(pUWID, pFunction){
- $.get(apiurl + "getprivatekeybyuwid/" + pUWID, {} ,pFunction);
- }
- function apiAddWallet(pFunction){
- $.get(apiurl + "addwallet", {} ,pFunction);
- }
- function apiAddPrivateKey(pPrivateKey, pFunction){
- $.get(apiurl + "addprivatekey/" + pPrivateKey, {} ,pFunction);
- }
- function apiAddWatchonlyKey(pFunction){
- $.get(apiurl + "addwatchonlykey", {} ,pFunction);
- }
- function apiGovernance(pVoteID, pVoteOption, pFunction){
- $.get(apiurl + "governance/" + pVoteID + "/" + pVoteOption, {} ,pFunction);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement