소스 검색

Setup

master
Heuzef 8 년 전
부모
커밋
cb4ff69110
3개의 변경된 파일7333개의 추가작업 그리고 0개의 파일을 삭제
  1. +63
    -0
      index.html
  2. +7070
    -0
      style.css
  3. +200
    -0
      textformatting.js

+ 63
- 0
index.html 파일 보기

@@ -0,0 +1,63 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>TXT</title>
<meta name="description" content="Text formatting online at TXTformat.com">
<meta name="keywords" content="text formatting, online text formatter">
<script async="" type="text/javascript" src="textformatting.js"></script>
<meta http-equiv="Content-Language" content="FR">
<link href="https://cdn.materialdesignicons.com/1.7.22/css/materialdesignicons.min.css" rel="stylesheet" type="text/css">
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>
<div id="row">
<div class="col-lg-12">
<h1><i class="mdi mdi-format-clear"></i> TXT Unformat</h1>
<p class="text-muted">
Outil simple de suppression de mise en forme de texte pour accelerer certaines taches qui pourraient etres longues et repetitives.<br>
Indique egalement rapidement combien de mots et de lettres sont dans votre texte.
</p>
<hr>
</div>
<div class="col-lg-7">
<div class="col-lg-8">
<button class="btn btn-success" onclick="selectall();"><i class="mdi mdi-cursor-default"></i></button>
&nbsp;
<button class="btn btn-danger" onclick="cleartext();"><i class="mdi mdi-eraser"></i></button>
&nbsp;&nbsp;&nbsp;
<button class="btn btn-default" onclick="capitalizesentences();"><i class="mdi mdi-wrench"></i> <strong>L</strong>ettrine</button>
&nbsp;
<button class="btn btn-default" onclick="uppercase();"><i class="mdi mdi-wrench"></i> MAJUSCULE</button>
&nbsp;
<button class="btn btn-default" onclick="lowercase();"><i class="mdi mdi-wrench"></i> minuscule</button>
&nbsp;
<button class="btn btn-default hidden" onclick="capitalizewords();">Capitalize Words</button>
</div>
<div class="col-lg-2"><input class="form-control" type="text" readonly="readonly" id="words" value="" disabled=""></div>
<div class="col-lg-2"><input class="form-control" type="text" readonly="readonly" id="characters" value="" disabled=""></div>
<br>
<br>
<textarea class="form-control" rows="16" id="thetext" onkeyup="updatecounts();" onchange="updatecounts();" onfocus="updatecounts();" placeholder="Votre texte ici :)"></textarea>
</div>
<hr>
<div class="col-lg-5">
<p><br><br><br></p>
<div class="col-lg-12"><button class="btn btn-info" onclick="replacetext();">Remplacer</button></div>
<div class="col-lg-5"><input class="form-control" type="text" id="from" value=""></div>
<div class="col-lg-1">par</div>
<div class="col-lg-6"><input class="form-control" type="text" id="to" value=""></div>
<div class="col-lg-12 hidden"><input type="checkbox" id="cs">Case</div>
<p><br><br><br><br><br></p>
<div class="col-lg-12"><button class="btn btn-success" onclick="addtext();">Ajouter</button></div>
<div class="col-lg-5"><input class="form-control" type="text" id="add" value=""></div>
<div class="col-lg-7"><select class="form-control" id="addpos"><option value="start">au debut de chaque ligne.</option><option value="end">a la fin de chaque ligne.</option></select></div>
<p><br><br><br><br><br></p>
<div class="col-lg-12"><button class="btn btn-warning" onclick="trimtext();">Supprimer les</button></div>
<div class="col-lg-3"><select class="form-control" id="trimnumber"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option></select></div>
<div class="col-lg-9"><select class="form-control" id="trimpos"><option value="first">premieres lettres de chaque ligne.</option><option value="last">dernieres lettres de chaque ligne.</option></select></div>
</div>
</div>
</body>
</html>

+ 7070
- 0
style.css
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 200
- 0
textformatting.js 파일 보기

@@ -0,0 +1,200 @@
function cleartext()
{
var t = document.getElementById("thetext");
t.value = '';
updatetextlength();
updatewords();
}

function selectall() {
var t = document.getElementById("thetext");
t.focus();
t.select();
}

function updatetextlength()
{
var t = document.getElementById("thetext");
var c = document.getElementById("characters");
c.value = t.value.length+' lettres';
}

function updatewords()
{
var t = document.getElementById("thetext");
var char_count = t.value.length;
var fullStr = t.value + " ";
var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
var splitString = cleanedStr.split(" ");
var word_count = splitString.length -1;

var w = document.getElementById("words");
w.value = word_count+' mots';
}

function updatecounts()
{
updatetextlength();
updatewords();
}

function uppercase()
{
var t = document.getElementById("thetext");
t.value = t.value.toUpperCase();
}

function lowercase()
{
var t = document.getElementById("thetext");
t.value = t.value.toLowerCase();
}

function capitalizewords()
{
var t = document.getElementById("thetext");

t.value = (t.value + '').replace(/^(.)|\s(.)/g, function ($1) {
return $1.toUpperCase(); });

}

function capitalizesentences()
{
var t = document.getElementById("thetext");
var tarray = t.value.split(".");
var tstr = '';

for(i=0; i<tarray.length; i++)
{
tarray[i] = ltrim(tarray[i], ' ');
tstr = tstr + tarray[i].substring(0,1).toUpperCase() + tarray[i].slice(1).toLowerCase();
if(i < (tarray.length - 1))tstr = tstr + '. ';
}
t.value = tstr;


tarray = t.value.split("?");
tstr = '';
for(i=0; i<tarray.length; i++)
{
tarray[i] = ltrim(tarray[i], ' ');
tstr = tstr + tarray[i].substring(0,1).toUpperCase() + tarray[i].slice(1);
if(i < (tarray.length - 1))tstr = tstr + '? ';
}
t.value = tstr;

tarray = t.value.split("!");
tstr = '';
for(i=0; i<tarray.length; i++)
{
tarray[i] = ltrim(tarray[i], ' ');
tstr = tstr + tarray[i].substring(0,1).toUpperCase() + tarray[i].slice(1);
if(i < (tarray.length - 1))tstr = tstr + '! ';
}
t.value = tstr;
}

function replacetext()
{
var t = document.getElementById("thetext");
var from = document.getElementById("from");
var to = document.getElementById("to");

var cs = document.getElementById("cs");
var scope;

var ff = from.value.replace("%N", "\n");
var tt = to.value.replace("%N", "\n");

if(cs.checked)scope = 'g';
else scope = 'gi';

var temp = t.value;
temp = temp.replace(new RegExp(ff, scope), tt);
t.value = temp;

from.value = '';
to.value = '';
updatecounts();
}

function addtext()
{
var t = document.getElementById("thetext");
var a = document.getElementById("add");
var p = document.getElementById("addpos");
var temp = t.value;
var tstr = '';
var tarray = t.value.split("\n");

if(p.value == 'start')
{
for(i=0; i<tarray.length; i++)
{
insert = a.value.replace("%L", i+1);
insert = insert.replace("%N", "\n");
tstr = tstr+insert+tarray[i];
if(i < (tarray.length - 1))tstr = tstr+"\n";
}
t.value = tstr;
}
else
{
for(i=0; i<tarray.length; i++)
{
insert = a.value.replace("%L", i+1);
insert = insert.replace("%N", "\n");
tstr = tstr+tarray[i]+insert;
if(i < (tarray.length - 1))tstr = tstr+"\n";
}
t.value = tstr;
}

a.value = '';
updatecounts();
}

function ltrim(str, chars)
{
chars = chars || "\\s";
return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars)
{
chars = chars || "\\s";
return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function trimtext()
{
var t = document.getElementById("thetext");
var n = document.getElementById("trimnumber");
var p = document.getElementById("trimpos");
var tarray = t.value.split("\n");
var i;
var tstr = '';

if(p.value == 'first')
{
for(i=0; i<tarray.length; i++)tstr = tstr+tarray[i].substr(n.value)+"\n";
tstr = rtrim(tstr);
}
else
{
for(i=0; i<tarray.length; i++)
{
tlen = tarray[i].length;
tpos = tlen - n.value;
tstr = tstr+tarray[i].substr(0, tpos)+"\n";
}
tstr = rtrim(tstr);
}

t.value = tstr;
updatecounts();
}

불러오는 중...
취소
저장