<commit_before>// ==UserScript==
// @name           Manga Reader Offline
// @namespace      zackad's script
// @author         zackad
// @version        0.2.3
// @description    read manga offline from your folder collection
// @include        file:///*/*
// @copyright      2015 zackad
// @require        http://code.jquery.com/jquery-1.10.1.min.js
// ==/UserScript==
$(document).ready(function(){
    var gvar = function(){};
    gvar.__DEBUG__ = 0;     //DEBUG MODE
    
	gvar.style = ''
		+'<style type="text/css">'
		+'.location-container a {color:blue; font-weight:bold; text-decoration:none}'
		+'.location-container a.current {color:red;}'
        +'img {max-width:90%!important; max-height:1000px!important;}'
        +'body {max-width:100%!important;}'
		+'</style>'
		;
	var container = ''
		+'<div id="container" style="background-color:black; float:center; padding:0px; margin:0px;">'
		+'<center></center>'
		+'</div>'
		;
	var loc_wrp = ''
		+'<div class="location-container" style="background-color:#999; padding:5px 10px; font-size:24px;">'
		+'</div>'
		;
	var imgSelector = ''
		+'a[href$=".jpg"],'
		+'a[href$=".jpeg"],'
		+'a[href$=".png"],'
		+'a[href$=".PNG"],'
		+'a[href$=".JPG"],'
		+'a[href$=".JPEG"],'
		+'a[href$=".gif"]';
	var img = $(imgSelector);
    //var controler = '<a href="javascript:void(0);" id="disable">disable</a>';
    var controler = ''
        //+'<button id="disable" value="Disable">'
        +'<img src="http://puu.sh/hPVpp/7e21ef7286.png"'
        +'id="enable" alt="Read This Folder!">'
        //+'<button id="enable">Read this folder</button>'
        ;
    
	function enable(){		
		if (img.length != 0){
			$('body').children().remove();
			$('head').children().remove();
			$('head').append(gvar.style);
			$('body').append(container)
				.append(loc_wrp)
				.prepend(loc_wrp)
				.css('background-color','black');
			//$('.location-container').append('controler');
		}
		img.each(function(){
			var temp = $(this).attr('href');
			var image = '<img src="' + temp + '"><br>';
			$('#container center').append(image);
		});
		
    }
    //find current location
    function getLoc(){
        var loc = function(){};
        loc.current = window.location.href;
        loc.current = decodeURI(loc.current);
        loc.current = loc.current.split('/');
        loc.i = loc.current.length;
        loc.temp = '';
        for (var i=3; i < loc.current.length-1; i++){
            loc.temp += loc.current[i]+ '/';
            if (i == loc.i-2){
                loc.a = '<a href="file:///' + loc.temp + '" class="current">' + loc.current[i] +' / </a>';
                //title
                $('head').append('<title>'+loc.current[i]+'</title>');
            } else {
                loc.a = '<a href="file:///' + loc.temp + '">' + loc.current[i] +' / </a>';
            }
            clog(loc.a);
            $('.location-container').append(loc.a);
            clog(loc.temp);
        }
        //$('.location-container').append(controler);
    }
    function clog(x){
        if(!gvar.__DEBUG__) return;
        console && console.log && console.log(x);
    }
    function here(){
        return window.location.href;
    }
    function disable(){
        //$('body').load((here());
        clog(here());
    }
	function init(){
		var temp = $('body').children();
		//$('body').children().remove();
		$('head').append(gvar.style);
        $('body').prepend(container);
		$('body').prepend(loc_wrp);
        $('.container-container').append(controler);
		/* var fLink = $('table a');
		fLink.href.sort(naturalSort);
		clog(fLink.href); */
	}
    function lets_roll(){
		if (img.length == 0) return;
        init();
		enable();
        getLoc();
        $('#enable').hide();
	}
/*
 * Natural Sort algorithm for Javascript - Version 0.8 - Released under MIT license
 * Author: <NAME> (based on chunking idea from <NAME>)
 */
function naturalSort (a, b) {
    var re = /(^([+\-]?(?:\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[\da-fA-F]+$|\d+)/g,
        sre = /^\s+|\s+$/g,   // trim pre-post whitespace
        snre = /\s+/g,        // normalize all whitespace to single ' ' character
        dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,
        hre = /^0x[0-9a-f]+$/i,
        ore = /^0/,
        i = function(s) {
            return (naturalSort.insensitive && ('' + s).toLowerCase() || '' + s).replace(sre, '');<commit_msg>css; file-listing;<commit_after>// ==UserScript==
// @name           Manga Reader Offline
// @namespace      zackad's script
// @author         zackad
// @version        0.2.4
// @description    read manga offline from your folder collection
// @include        file:///*/*
// @copyright      2015 zackad
// @require        http://code.jquery.com/jquery-1.10.1.min.js
// ==/UserScript==
$(document).ready(function(){
    var gvar = function(){};
    gvar.__DEBUG__ = 0;     //DEBUG MODE
    
	gvar.style = ''
		+'<style type="text/css">'
        +'.location-container {background-color:#ddd; padding:5px 10px; font-size:20px; border-radius:10px;}'
		+'.location-container a {color:blue; font-weight:bold; text-decoration:none;}'
		+'.location-container a.current {color:red;}'
        +'img {max-width:95%!important; max-height:1000px!important;}'
        +'body {max-width:100%!important;}'
        +'#container {padding:0px; margin:0px; background-color:black;}'
		+'</style>'
		;
	var container = ''
		+'<div id="container">'
		+'<center></center>'
		+'</div>'
		;
	var loc_wrp = ''
		+'<div class="location-container">'
		+'</div>'
		;
	var imgSelector = ''
		+'a[href$=".jpg"],'
		+'a[href$=".jpeg"],'
		+'a[href$=".png"],'
		+'a[href$=".PNG"],'
		+'a[href$=".JPG"],'
		+'a[href$=".JPEG"],'
		+'a[href$=".gif"]';
	var img = $(imgSelector);
    //var controler = '<a href="javascript:void(0);" id="disable">disable</a>';
    var controler = ''
        //+'<button id="disable" value="Disable">'
        +'<img src="http://puu.sh/hPVpp/7e21ef7286.png"'
        +'id="enable" alt="Read This Folder!">'
        //+'<button id="enable">Read this folder</button>'
        ;
    
	function enable(){		
		if (img.length != 0){
			$('body').children().remove();
			$('head').children().remove();
			$('head').append(gvar.style);
			$('body').append(container)
				.append(loc_wrp)
				.prepend(loc_wrp)
				.css('background-color','black');
			//$('.location-container').append('controler');
		}
		img.each(function(){
			var temp = $(this).attr('href');
			var image = '<img src="' + temp + '"><br>';
			$('#container center').append(image);
		});
		
    }
    //find current location
    function getLoc(){
        var loc = function(){};
        loc.current = window.location.href;
        loc.current = decodeURI(loc.current);
        loc.current = loc.current.split('/');
        loc.i = loc.current.length;
        loc.temp = '';
        for (var i=3; i < loc.current.length-1; i++){
            loc.temp += loc.current[i]+ '/';
            if (i == loc.i-2){
                loc.a = '<a href="file:///' + loc.temp + '" class="current">' + loc.current[i] +' / </a>';
                //title
                $('head').append('<title>'+loc.current[i]+'</title>');
            } else {
                loc.a = '<a href="file:///' + loc.temp + '">' + loc.current[i] +' / </a>';
            }
            clog(loc.a);
            $('.location-container').append(loc.a);
            clog(loc.temp);
        }
        //$('.location-container').append(controler);
    }
    function clog(x){
        if(!gvar.__DEBUG__) return;
        console && console.log && console.log(x);
    }
    function here(){
        return window.location.href;
    }
    function disable(){
        //$('body').load((here());
        clog(here());
    }
	function init(){
		var temp = $('body').children();
		//$('body').children().remove();
		$('head').append(gvar.style);
        $('body').prepend(container);
		$('body').prepend(loc_wrp);
		$('h1, .up').remove();
//      $('.container-container').append(controler);
//		var fLink = $('table a').attr('href');
//		fLink.sort(naturalSort);
//		clog(fLink);
	}
    function lets_roll(){
		if (img.length == 0) return;
        init();
		enable();
        getLoc();
        $('#enable').hide();
	}
/*
 * Natural Sort algorithm for Javascript - Version 0.8 - Released under MIT license
 * Author: <NAME> (based on chunking idea from <NAME>)
 */
function naturalSort (a, b) {
    var re = /(^([+\-]?(?:\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[\da-fA-F]+$|\d+)/g,
        sre = /^\s+|\s+$/g,   // trim pre-post whitespace
        snre = /\s+/g,        // normalize all whitespace to single ' ' character
        dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,
        hre = /^0x[0-9a-f]+$/i,
        ore = /^0/,
        i = function(s) {
            return (naturalSort.insensitive && ('' + s).toLowerCase() || '' + s).replace(sre, '');
{'fraction_non_alphanumeric': 0.2482451253481894, 'fraction_numerical': 0.012924791086350975, 'mean_word_length': 2.4064516129032256, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 51, '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': '1819542', 'n_tokens_mistral': 3375, 'n_tokens_neox': 3175, 'n_words': 561}