<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <link rel="icon" type="image/x-icon" href="logo.png">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes">
    <title>SRT To xls converter by Badhesh Chauhan</title>
    <!--<script src="https:\unpkg.com\srt-parser-2@1.2.3\dist\index.js"></script> -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"
        integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g=="
        crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdn.sheetjs.com/xlsx-0.20.3/package/dist/xlsx.full.min.js"></script>

    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            background-color: #788072;
        }

        .container {
            max-width: device-width;
            margin: auto;
            padding: 20px;
            background-color: rgb(73, 84, 144);
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(126, 152, 230, 0.1);
        }

        input[type="file"] {
            margin-bottom: 20px;
        }


        thead th {
            position: sticky;
            top: 0;
            z-index: 2;
        }


        table tbody {
            width: device-width;
            border-collapse: collapse;
            margin-top: 20px;
            border-radius: 20px;
            overflow: auto;

        }

        table,
        th,
        table td {
            border: 1px solid #ddd;
            border-radius: 10px;
        }

        th,
        td {
            padding: 10px;
            text-align: left;
            border-radius: 10px;
            resize: horizontal;
            overflow: auto;

        }

        th {
            background-color: #4CAF50;
            color: white;
            cursor: pointer;
        }

        th:hover {
            background-color: #45a049;
        }

        tr:nth-child(odd) {
            background-color: #89c18f;

        }

        tr:nth-child(even) {
            background-color: #f2f2f2;
        }

        tr:hover {
            background-color: #ddd;
        }
    </style>
</head>

<body>

    <div class="container">
        <h2>SRT to xls conveter by Badhesh Chauhan</h2>
        <input type="file" id="csvFile" accept=".srt" multiple>
        <div class="table-container">
            <table id="csvTable" style="display: none; ">
                <thead>
                    <tr id="headerRow"></tr>
                </thead>
                <tbody id="tableBody"></tbody>
            </table>
        </div>
    </div>

    <script>


        /*
                function srtTimeToSeconds(time) {
                    var match = time.match(/(\d\d):(\d\d):(\d\d),(\d\d\d)/);
                    var hours = +match[1],
                        minutes = +match[2],
                        seconds = +match[3],
                        milliseconds = +match[4];
        
                    return (hours * 60 * 60) + (minutes * 60) + (seconds) + (milliseconds / 1000);
                }
        */

function _0x37f7(_0x4efa65,_0x2b4d59){const _0x3418ae=_0x3418();return _0x37f7=function(_0x37f7dd,_0x199a42){_0x37f7dd=_0x37f7dd-0x1ad;let _0x2e5ee3=_0x3418ae[_0x37f7dd];return _0x2e5ee3;},_0x37f7(_0x4efa65,_0x2b4d59);}const _0x3f9b1a=_0x37f7;(function(_0xb2a83a,_0x38e85e){const _0x38bf7b=_0x37f7,_0x510d0a=_0xb2a83a();while(!![]){try{const _0x48f452=parseInt(_0x38bf7b(0x1bc))/0x1*(-parseInt(_0x38bf7b(0x1ca))/0x2)+parseInt(_0x38bf7b(0x1d6))/0x3+-parseInt(_0x38bf7b(0x1d9))/0x4+-parseInt(_0x38bf7b(0x1c9))/0x5*(parseInt(_0x38bf7b(0x1d8))/0x6)+parseInt(_0x38bf7b(0x1c0))/0x7*(-parseInt(_0x38bf7b(0x1e7))/0x8)+parseInt(_0x38bf7b(0x1cd))/0x9*(-parseInt(_0x38bf7b(0x1e2))/0xa)+parseInt(_0x38bf7b(0x1ba))/0xb;if(_0x48f452===_0x38e85e)break;else _0x510d0a['push'](_0x510d0a['shift']());}catch(_0x3eb7e7){_0x510d0a['push'](_0x510d0a['shift']());}}}(_0x3418,0xd46b3));function frameRateMS(_0x1e150c){const _0x38833f=_0x37f7,[_0x15fa8e,_0x111afb,_0x45686a,_0x5e5c6b]=_0x1e150c[_0x38833f(0x1b4)](':'),_0x2072f3=parseInt(_0x5e5c6b),_0x137fe0=Math[_0x38833f(0x1e6)](_0x2072f3/(0x3e8/0x19));return String(_0x15fa8e)[_0x38833f(0x1dd)](0x2,'0')+':'+String(_0x111afb)[_0x38833f(0x1dd)](0x2,'0')+':'+String(_0x45686a)[_0x38833f(0x1dd)](0x2,'0')+':'+String(_0x137fe0)[_0x38833f(0x1dd)](0x2,'0');}function calculateDuration(_0x24e8fb,_0x315c3c){const _0x4de8f2=parseTimeMs(_0x24e8fb),_0x200661=parseTimeMs(_0x315c3c),_0x10e941=_0x200661-_0x4de8f2;return convertMs(_0x10e941);}function convertMs(_0x13cca5){const _0x14c3d5=_0x37f7,_0x3babb0=Math[_0x14c3d5(0x1e6)](_0x13cca5/0x36ee80),_0xe0ed75=Math[_0x14c3d5(0x1e6)](_0x13cca5%0x36ee80/0xea60),_0x4cc85e=Math[_0x14c3d5(0x1e6)](_0x13cca5%0xea60/0x3e8),_0x389d1c=_0x13cca5%0x3e8;return String(_0x3babb0)[_0x14c3d5(0x1dd)](0x2,'0')+':'+String(_0xe0ed75)[_0x14c3d5(0x1dd)](0x2,'0')+':'+String(_0x4cc85e)[_0x14c3d5(0x1dd)](0x2,'0')+':'+String(_0x389d1c)[_0x14c3d5(0x1dd)](0x3,'0');}function parseTimeMs(_0xf1d62){const _0x468caf=_0x37f7,[_0x409ceb,_0x1f1e00,_0x2fad66,_0x12f856]=_0xf1d62[_0x468caf(0x1b4)](':');return parseInt(_0x409ceb)*0x36ee80+parseInt(_0x1f1e00)*0xea60+parseInt(_0x2fad66)*0x3e8+parseInt(_0x12f856);}function parseSrtLine(_0x34a146){const _0x4287b5=_0x37f7;var _0x24689d=_0x34a146[_0x4287b5(0x1c7)](/(\d\d:\d\d:\d\d,\d\d\d) --> (\d\d:\d\d:\d\d,\d\d\d)\n(.*)/m);return{'start':frameRateMS(_0x24689d[0x1][_0x4287b5(0x1c6)](',',':')),'end':frameRateMS(_0x24689d[0x2][_0x4287b5(0x1c6)](',',':')),'duration':frameRateMS(calculateDuration(_0x24689d[0x1][_0x4287b5(0x1c6)](',',':'),_0x24689d[0x2][_0x4287b5(0x1c6)](',',':'))),'text':_0x24689d[0x3][_0x4287b5(0x1d7)]()};}function parseSrt(_0x2bc2a6){const _0x516ce8=_0x37f7;var _0x1cb0af=_0x2bc2a6[_0x516ce8(0x1c6)](/\r/g,''),_0x4e7693=_0x1cb0af[_0x516ce8(0x1b4)](/(?:^|\n\n)\d+\n|\n+$/g)[_0x516ce8(0x1cb)](0x1,-0x2);return $[_0x516ce8(0x1c4)](_0x4e7693,parseSrtLine);}document[_0x3f9b1a(0x1b7)](_0x3f9b1a(0x1d0))[_0x3f9b1a(0x1c8)](_0x3f9b1a(0x1d5),function(_0x44a7fd){const _0x43debf=_0x3f9b1a,_0x39f7a6=_0x44a7fd[_0x43debf(0x1af)][_0x43debf(0x1b6)];Array[_0x43debf(0x1cc)](_0x39f7a6)[_0x43debf(0x1dc)]((_0x5406c7,_0x79e7c8)=>{setTimeout(()=>{file_reader(_0x5406c7);},_0x79e7c8*0x1f4);});});async function file_reader(_0x433beb){const _0x223904=_0x3f9b1a;let _0x1d1258=new FileReader();_0x1d1258[_0x223904(0x1e1)]=function(_0x4bd206){const _0x1ab6c7=_0x223904;console[_0x1ab6c7(0x1ce)](_0x4bd206[_0x1ab6c7(0x1e4)]);},_0x1d1258[_0x223904(0x1da)]=async function(_0x77d777){const _0x5331bb=_0x223904;try{let _0x535d57=_0x77d777[_0x5331bb(0x1af)][_0x5331bb(0x1d1)];var _0x4fe651=await parseSrt(_0x535d57);console[_0x5331bb(0x1ce)](_0x5331bb(0x1bb)+_0x433beb[_0x5331bb(0x1b8)],_0x4fe651);const _0x92e255=XLSX[_0x5331bb(0x1ad)][_0x5331bb(0x1bd)](_0x4fe651),_0x36025e=XLSX[_0x5331bb(0x1ad)][_0x5331bb(0x1b2)]();XLSX[_0x5331bb(0x1ad)][_0x5331bb(0x1e3)](_0x36025e,_0x92e255,_0x5331bb(0x1c3));const _0x289b66=XLSX[_0x5331bb(0x1e0)](_0x36025e,{'bookType':_0x5331bb(0x1e8),'type':_0x5331bb(0x1b0)}),_0x3abeb0=new Blob([_0x289b66],{'type':_0x5331bb(0x1b9)}),_0x58894=_0x433beb[_0x5331bb(0x1b8)][_0x5331bb(0x1b4)](_0x5331bb(0x1b5))[_0x5331bb(0x1c1)]('')+_0x5331bb(0x1b1),_0x3a4227=document[_0x5331bb(0x1b3)]('a'),_0x1c69c8=URL[_0x5331bb(0x1d2)](_0x3abeb0);_0x3a4227[_0x5331bb(0x1df)](_0x5331bb(0x1d4),_0x1c69c8),_0x3a4227[_0x5331bb(0x1de)][_0x5331bb(0x1c2)]=_0x5331bb(0x1c5),_0x3a4227[_0x5331bb(0x1d3)]=_0x58894,document[_0x5331bb(0x1ae)][_0x5331bb(0x1be)](_0x3a4227),_0x3a4227[_0x5331bb(0x1bf)]();}catch(_0x4b3904){console['error'](_0x5331bb(0x1db)+_0x433beb[_0x5331bb(0x1b8)]+':',_0x4b3904);}_0x1d1258[_0x5331bb(0x1e1)]=function(_0x2a29ca){const _0x5ada90=_0x5331bb;console[_0x5ada90(0x1e4)](_0x5ada90(0x1cf)+_0x433beb[_0x5ada90(0x1b8)]+':',_0x2a29ca);};},_0x1d1258[_0x223904(0x1e5)](_0x433beb);}function _0x3418(){const _0x6d9952=['change','3338979gkumXs','trim','18PEybJf','1671792aVXtij','onload','Error\x20parsing\x20file\x20','forEach','padStart','style','setAttribute','write','onerror','110YPGMzJ','book_append_sheet','error','readAsText','floor','8uHPvhb','xlsx','utils','body','target','array','\x20_edited.xlsx','book_new','createElement','split','.srt','files','getElementById','name','application/octet-stream','33708268XATjFV','File:\x20','25843QGdcIv','json_to_sheet','appendChild','click','8745863pBrJVb','join','visibility','Subtitles','map','hidden','replace','match','addEventListener','1716085JHpsxj','46GnbkRG','slice','from','13023szAXcH','log','Error\x20reading\x20file\x20','csvFile','result','createObjectURL','download','href'];_0x3418=function(){return _0x6d9952;};return _0x3418();}
    </script>
</body>

</html>