Skip to content
Snippets Groups Projects
Select Git revision
  • ac3be88103ffdd37324bd5d4e66560128df1d205
  • master default protected
  • durt-stuff
  • polkadart-stuff
  • dev
  • provider-to-riverpod
  • implementLightnode
  • subscribesSplit
  • hugo_RML16
  • refactorOnboardingSlideshow
  • duniterV1Latest
  • scanNetwork
  • dubp_rs
  • v0.1.29+111
  • v0.1.28+109
  • v0.1.27+108
  • v0.1.26+107
  • v0.1.25+106
  • v0.1.25+105
  • v0.1.24+102
  • v0.1.23+101
  • v0.1.22+100
  • v0.1.22+99
  • v0.1.21+98
  • v0.1.21+97
  • v0.1.21+96
  • v0.1.21+95
  • v0.1.21+94
  • v0.1.21+93
  • v0.1.20+92
  • v0.1.19+91
  • v0.1.18+90
  • v0.1.17+89
33 results

transaction_status.dart

Blame
  • dico.mjs 1.85 KiB
    import {subscribe} from "./workerManager.mjs";
    import getCombiPerSec from "./speedBench.mjs";
    import {Dictionary} from "g1lib/browser/dictionary.mjs";
    import staticPreview from "./staticPreview.mjs";
    
    let currentDico;
    let lastData;
    let staticDico;
    subscribe('smartPreview', setDico);
    subscribe('fastPreview', setStaticDico);
    
    export function genDico(){
      const data = getActualData();
      const dico = new Dictionary(data.secrets, data.options);
      data.dico = dico;
      staticPreview(data);
      data.dico = JSON.stringify(dico);
      setDico(data);
      currentDico = dico;
      return dico;
    }
    export function setDico(data){
      lastData = data;
      currentDico = undefined;
      staticDico = JSON.parse(data.dico);
    }
    function setStaticDico(data){
      staticDico = JSON.parse(data.dico);
    }
    export default function getDico(){
      if(!currentDico) {
        if(!lastData) throw new Error("Smart Dictionary not yet generated.");
        const dicoStruct = JSON.parse(lastData.dico);
        currentDico = new Dictionary(lastData.secrets, dicoStruct.config);
      }
      return currentDico;
    }
    export function getStaticDico(){
      if(staticDico) return staticDico;
      genDico();
      return getStaticDico();
    }
    window.getDico = getDico;
    window.getStaticDico = getStaticDico;
    export function getActualData(withSpeed = true) {
      const so = window.searchOptions;
      const result = {
        secrets: document.getElementById('secrets').value,
        options: {
          escapeAll:so.regex.value<0?undefined:so.regex.value===0?1:so.regex.value===1?0:so.regex.value,
          idSecPwd:so.mirror.value===0?0:1,
          accent:so.accent.value<0?undefined:so.accent.value,
          lowerCase:so.caps.value<0?undefined:so.caps.value,
          leetSpeak:0,
        },
        previewIndex: (window.browseIndex || 0),
      };
      if (withSpeed) try {
        result.options.speed = getCombiPerSec();
      } catch (e) {
        if (e.message !== 'Speed not yet estimated.') throw e;
      }
      return result;
    }