<commit_before><!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="awesome/css/font-awesome.css">
<link rel="stylesheet" href="style/main.css">
<script src="jq/$.js"></script>
<script src="jq/jquery.color.min.js"></script>
<script src="jq/jquery.hotkeys.js"></script>
<script src="jq/scrollspy.js"></script>
<script src="jq/jquery.scrollTo.min.js"></script>
<script src="bootstrap/js/bootstrap.js"></script>
<script src="node_modules/underscore/underscore.js"></script>
<script src="node_modules/underscore.string/dist/underscore.string.min.js"></script>
<script src="node_modules/array.prototype.find/index.js"></script>
<script>
_.mixin(_.str.exports());
</script>
<script src="script/title.js"></script>
<script src="script/setup.js"></script>
<script src="script/queue.js"></script>
<script src="script/arealist.js"></script>
<script src="script/msglist.js"></script>
<script src="script/1message.js"></script>
<script src="script/areafile.js"></script>
<script src="script/url-area.js"></script>
<script src="script/urlbar.js"></script>
<script>
phiQ = queue();
JAM = require('fidonet-jam');
FidoHTML = require('fidohtml')({
   dataMode: true
});
phiURL = require('fghi-url');
phiBar = urlbar();
MIME = require('mime');
UUE = require('uue');
GUI = require('nw.gui');
nwClipboard = GUI.Clipboard.get();

beforeSpace = function(inString){
   if( inString.indexOf(' ') === -1 ){
      return inString;
   }
   return _(inString).strLeft(' ');
};
</script>
<title>PhiDo</title>
<script>
$(function(){
initSetup();
if( setup.maximizeWindow ) GUI.Window.get().maximize();

$('#content').css('text-align', 'left').on('click', 'a[data-href]', function(){
   var supportedSchemes = ['area'];
   var safeSchemes = [
      'http',
      'https',
      'ftp',
      'mailto',
      'ed2k',
      'facetime',
      'feed',
      'geo',
      'irc',
      'ircs',
      'magnet',
      'news',
      'nntp',
      'sip',
      'sips',
      'skype',
      'sms',
      'ssh',
      'tel',
      'telnet',
      'tftp',
      'xmpp'
   ];

   var $this = $(this);
   var URL = $this.data('href');

   var separatorPosition = URL.indexOf(':');
   if( separatorPosition < 0 ) return false;

   var schemeLC = URL.slice(0, separatorPosition).toLowerCase();
   if( supportedSchemes.indexOf(schemeLC) >= 0 ){
      phiBar.open(URL);
   } else if( safeSchemes.indexOf(schemeLC) >= 0 ){
      GUI.Shell.openExternal(URL);
   }

   return false;
}).on('click', '.hasURL', function(){
   phiBar.open( $(this).data('URL') );
}).on('contextmenu', '.hasURL', function(e){
   var $this = $(this);
   var URL = $this.data('URL');

   var contextMenu = new GUI.Menu();
   contextMenu.append(new GUI.MenuItem({
      'label': 'Copy FGHI URL',
      'click': function(){
         nwClipboard.set( URL );
      }
   }));
   $this.data('contextMenu', contextMenu);
   $this.data('contextMenu').popup(
      e.originalEvent.x,
      e.originalEvent.y
   );
   return false;
}).on('click', '.messageNavigation button', function(){
   var $this = $(this);
   if(!( $this.data('location') )){
      $this.html('<i class="fa fa-spinner fa-spin"></i>');
      return false;
   }
}).on('scrollSpy:exit', '.catchScrollEvents', function(){
   $(this).data('inscroll', false);
}).on('scrollSpy:enter', '.catchScrollEvents', function(){
   $(this).data('inscroll', true).find('.msgRow').each(
      msghdrDelayedActionMsgRowProcessor
   );
   phiQ.start();
});

// this block must be the last because it mixes sync default execution path
// with async optional GoldED integration:
var openStartingURL = function(){
   var defaultStartingURL = 'area://';
   var paramsCLI = GUI.App.argv;
   phiBar.attach( $('#urlbar') );

   var msgFileName = paramsCLI.find(function(param){
      return param.indexOf('--file=') === 0; // starts with
   });
   if( typeof msgFileName === 'undefined'){
      return phiBar.open(defaultStartingURL);
   } else msgFileName = msgFileName.slice( '--file='.length );

   var msgArea = paramsCLI.find(function(param){
      return param.indexOf('--area=') === 0; // starts with
   });
   if( typeof msgArea === 'undefined'){
      return phiBar.open(defaultStartingURL);
   } else msgArea = msgArea.slice( '--area='.length );
   if( /^\s*$/.test(msgArea) ) return phiBar.open(defaultStartingURL);

   require('fs').readFile(
      msgFileName,
      { encoding: 'binary' },
      function(err, message){
         if( err ) return phiBar.open(defaultStartingURL);

         var lineMSGID = message.split( /(?:\r|\n)/ ).find(function(msgLine){
            return msgLine.indexOf('\x01MSGID:') === 0; // starts with
         });
         if( typeof lineMSGID === 'undefined'){
            return phiBar.open(defaultStartingURL);
         } else lineMSGID = lineMSGID.slice( '\x01MSGID:'.length ).replace(
            /^\s*/g, ''
         );
         if( lineMSGID.length < 1 ) return phiBar.open(defaultStartingURL);

         phiBar.open([
            'area://',
            encodeURIComponent(msgArea),
            '/?msgid=',
            encodeURIComponent(lineMSGID)
         ].join('').replace('%20', '+'));
      }
   );
};
openStartingURL();

// no more blocks here, see openStartingURL's description above
});
</script>
</head>
<body>
<div class="container">
<div class="row"><div class="col-xs-12">
<div id="urlbar" style="display: flex; flex-direction: row; margin-bottom: 1em;">
<button type="button" class="form-control btn btn-default" style="width: 50px; flex-grow: 0;"
id="back" disabled><i class="fa fa-arrow-left"></i></button>
<button type="button" class="form-control btn btn-default" style="width: 50px; flex-grow: 0;"
id="forward" disabled><i class="fa fa-arrow-right"></i></button>
<input type="text" class="form-control" style="flex-grow: 1;"
id="URL" placeholder="Enter FGHI URL here" value="area://">
<button type="submit" class="form-control btn btn-default" style="width: 50px; flex-grow: 0;"
id="goToURL"><i class="fa fa-play"></i></button>
<button type="button" class="form-control btn btn-default" style="width: 50px; flex-grow: 0;"><img
src="icon/PhiDo-16x16.png"
></button>
</div>
</div></div>
<div id="content" style="text-align: center;"><img src="img/loading.gif"><br>
loading configuration…</div>
</div></body>
</html><commit_msg>fix #6: JavaScript in `underscore.string` v2.4.0 has been relocated<commit_after><!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="awesome/css/font-awesome.css">
<link rel="stylesheet" href="style/main.css">
<script src="jq/$.js"></script>
<script src="jq/jquery.color.min.js"></script>
<script src="jq/jquery.hotkeys.js"></script>
<script src="jq/scrollspy.js"></script>
<script src="jq/jquery.scrollTo.min.js"></script>
<script src="bootstrap/js/bootstrap.js"></script>
<script src="node_modules/underscore/underscore.js"></script>
<script src="node_modules/underscore.string/lib/underscore.string.js"></script>
<script src="node_modules/array.prototype.find/index.js"></script>
<script>
_.mixin(_.str.exports());
</script>
<script src="script/title.js"></script>
<script src="script/setup.js"></script>
<script src="script/queue.js"></script>
<script src="script/arealist.js"></script>
<script src="script/msglist.js"></script>
<script src="script/1message.js"></script>
<script src="script/areafile.js"></script>
<script src="script/url-area.js"></script>
<script src="script/urlbar.js"></script>
<script>
phiQ = queue();
JAM = require('fidonet-jam');
FidoHTML = require('fidohtml')({
   dataMode: true
});
phiURL = require('fghi-url');
phiBar = urlbar();
MIME = require('mime');
UUE = require('uue');
GUI = require('nw.gui');
nwClipboard = GUI.Clipboard.get();

beforeSpace = function(inString){
   if( inString.indexOf(' ') === -1 ){
      return inString;
   }
   return _(inString).strLeft(' ');
};
</script>
<title>PhiDo</title>
<script>
$(function(){
initSetup();
if( setup.maximizeWindow ) GUI.Window.get().maximize();

$('#content').css('text-align', 'left').on('click', 'a[data-href]', function(){
   var supportedSchemes = ['area'];
   var safeSchemes = [
      'http',
      'https',
      'ftp',
      'mailto',
      'ed2k',
      'facetime',
      'feed',
      'geo',
      'irc',
      'ircs',
      'magnet',
      'news',
      'nntp',
      'sip',
      'sips',
      'skype',
      'sms',
      'ssh',
      'tel',
      'telnet',
      'tftp',
      'xmpp'
   ];

   var $this = $(this);
   var URL = $this.data('href');

   var separatorPosition = URL.indexOf(':');
   if( separatorPosition < 0 ) return false;

   var schemeLC = URL.slice(0, separatorPosition).toLowerCase();
   if( supportedSchemes.indexOf(schemeLC) >= 0 ){
      phiBar.open(URL);
   } else if( safeSchemes.indexOf(schemeLC) >= 0 ){
      GUI.Shell.openExternal(URL);
   }

   return false;
}).on('click', '.hasURL', function(){
   phiBar.open( $(this).data('URL') );
}).on('contextmenu', '.hasURL', function(e){
   var $this = $(this);
   var URL = $this.data('URL');

   var contextMenu = new GUI.Menu();
   contextMenu.append(new GUI.MenuItem({
      'label': 'Copy FGHI URL',
      'click': function(){
         nwClipboard.set( URL );
      }
   }));
   $this.data('contextMenu', contextMenu);
   $this.data('contextMenu').popup(
      e.originalEvent.x,
      e.originalEvent.y
   );
   return false;
}).on('click', '.messageNavigation button', function(){
   var $this = $(this);
   if(!( $this.data('location') )){
      $this.html('<i class="fa fa-spinner fa-spin"></i>');
      return false;
   }
}).on('scrollSpy:exit', '.catchScrollEvents', function(){
   $(this).data('inscroll', false);
}).on('scrollSpy:enter', '.catchScrollEvents', function(){
   $(this).data('inscroll', true).find('.msgRow').each(
      msghdrDelayedActionMsgRowProcessor
   );
   phiQ.start();
});

// this block must be the last because it mixes sync default execution path
// with async optional GoldED integration:
var openStartingURL = function(){
   var defaultStartingURL = 'area://';
   var paramsCLI = GUI.App.argv;
   phiBar.attach( $('#urlbar') );

   var msgFileName = paramsCLI.find(function(param){
      return param.indexOf('--file=') === 0; // starts with
   });
   if( typeof msgFileName === 'undefined'){
      return phiBar.open(defaultStartingURL);
   } else msgFileName = msgFileName.slice( '--file='.length );

   var msgArea = paramsCLI.find(function(param){
      return param.indexOf('--area=') === 0; // starts with
   });
   if( typeof msgArea === 'undefined'){
      return phiBar.open(defaultStartingURL);
   } else msgArea = msgArea.slice( '--area='.length );
   if( /^\s*$/.test(msgArea) ) return phiBar.open(defaultStartingURL);

   require('fs').readFile(
      msgFileName,
      { encoding: 'binary' },
      function(err, message){
         if( err ) return phiBar.open(defaultStartingURL);

         var lineMSGID = message.split( /(?:\r|\n)/ ).find(function(msgLine){
            return msgLine.indexOf('\x01MSGID:') === 0; // starts with
         });
         if( typeof lineMSGID === 'undefined'){
            return phiBar.open(defaultStartingURL);
         } else lineMSGID = lineMSGID.slice( '\x01MSGID:'.length ).replace(
            /^\s*/g, ''
         );
         if( lineMSGID.length < 1 ) return phiBar.open(defaultStartingURL);

         phiBar.open([
            'area://',
            encodeURIComponent(msgArea),
            '/?msgid=',
            encodeURIComponent(lineMSGID)
         ].join('').replace('%20', '+'));
      }
   );
};
openStartingURL();

// no more blocks here, see openStartingURL's description above
});
</script>
</head>
<body>
<div class="container">
<div class="row"><div class="col-xs-12">
<div id="urlbar" style="display: flex; flex-direction: row; margin-bottom: 1em;">
<button type="button" class="form-control btn btn-default" style="width: 50px; flex-grow: 0;"
id="back" disabled><i class="fa fa-arrow-left"></i></button>
<button type="button" class="form-control btn btn-default" style="width: 50px; flex-grow: 0;"
id="forward" disabled><i class="fa fa-arrow-right"></i></button>
<input type="text" class="form-control" style="flex-grow: 1;"
id="URL" placeholder="Enter FGHI URL here" value="area://">
<button type="submit" class="form-control btn btn-default" style="width: 50px; flex-grow: 0;"
id="goToURL"><i class="fa fa-play"></i></button>
<button type="button" class="form-control btn btn-default" style="width: 50px; flex-grow: 0;"><img
src="icon/PhiDo-16x16.png"
></button>
</div>
</div></div>
<div id="content" style="text-align: center;"><img src="img/loading.gif"><br>
loading configuration…</div>
</div></body>
</html>
{'fraction_non_alphanumeric': 0.20476153060422722, 'fraction_numerical': 0.006285848982478196, 'mean_word_length': 3.712328767123288, 'pattern_counts': {'":': 0, '<': 177, '<?xml version=': 0, '>': 177, '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': '41258', 'n_tokens_mistral': 4360, 'n_tokens_neox': 4188, 'n_words': 851}