<commit_before>import {getOauthUrl, getTokens, getApi} from '../common/oauth';

window.addEventListener('load', main);

function main(){
  getOauthUrl().then((url)=>{

      const oauthWin = document.getElementById('oauthWin');
            oauthNotify = document.getElementById('oauthNotify');
      oauthWin.src = url;
      oauthWin.addEventListener('did-finish-load', ()=>{
        console.log(oauthWin.getURL());
        var matchData;
        if(matchData = oauthWin.getURL().match(/oauth_verifier=(.+)/)){

          getTokens(matchData[1]).then((tokens)=>{
            var setting = {
              tokens
            };
            localStorage["ulttwiclient"] = JSON.stringify(setting);
            console.log(getApi(tokens));
            oauthNotify.textContent = "successed verify"
          }, (reason)=>{ console.error(reason); });

        }
      });

    }, (reason)=>{ console.error(reason); }
  );
}
<commit_msg>beautify app/preference.js<commit_after>import {getOauthUrl, getTokens, getApi} from '../common/oauth';

window.addEventListener('load', main);
const localStorageName = "ulttwiclient";

function main(){
  getOauthUrl().then((url)=>{

    const oauthWin = document.getElementById('oauthWin');
    const oauthNotify = document.getElementById('oauthNotify');
    oauthWin.src = url;
    oauthWin.addEventListener('did-finish-load', ()=>{
      console.log(oauthWin.getURL());
      const matchData = oauthWin.getURL().match(/oauth_verifier=(.+)/);

      if(matchData){
        getTokens(matchData[1]).then((tokens)=>{
          const setting = {
            tokens
          };
          localStorage[localStorageName] = JSON.stringify(setting);
          console.log(getApi(tokens));
          oauthNotify.textContent = "successed verify";
        }, (reason)=>{ console.error(reason); });
      }

    });
  },
    (reason)=>{ console.error(reason); }
  );
}

{'fraction_non_alphanumeric': 0.16560846560846562, 'fraction_numerical': 0.0010582010582010583, 'mean_word_length': 2.90702479338843, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7083620', 'n_tokens_mistral': 568, 'n_tokens_neox': 556, 'n_words': 81}