DIR : /home/kozerus/public_html/fs.html
/home/kozerus/public_html
<html>
<head>
<title>fs.html 20200314_2000</title>
<script id="script_list" >
function list() {
// alert( "BUGS_10 list" );
var j=0;
var htmout = "<h1>list</h1>";
var list = `
yt_20200310_amazingpolly_event_201_global_pandemic|https://www.youtube.com/watch?v=IRJpP83MqNs
polly|yt_20200310_amazingpolly_event_201_global_pandemic|https://www.youtube.com/watch?v=IRJpP83MqNs
yt_20200310_amazingPOLLY_event_201_global_pandemic|https://www.youtube.com/watch?v=IRJpP83MqNs
yt_20200310_dahboo77_newyork_national_guard_mile_containment|https://www.youtube.com/watch?v=YJAwY-uYMjk
yt_20200310_webb_trump_impeachment_two|https://www.youtube.com/watch?v=etZRdNXA924
yt_20200310_munder_alex_jones_arrested_dwi_fight_wife|https://www.youtube.com/watch?v=0u6Io4fFB-U
munder|yt_20200310_munder_GROUP_corey_feldman_charlie_sheen_livestream|https://www.youtube.com/watch?v=O2xcCeo8HVM
yt_20200310_munder_corey_feldman_charlie_sheen_livestream|https://www.youtube.com/watch?v=O2xcCeo8HVM
yt_20200310_antonpetrov_galaxy_warped_alw_wobble|https://www.youtube.com/watch?v=O6xosm4D8O4
yt_20171002_codeparade_computer_generated_human_faces|https://www.youtube.com/watch?v=4VAkrUNLKSo
yt_20160828_infinitepop_cctv4_kt|https://www.youtube.com/watch?v=HE5da1RWR3E
yt_20150930_worldaffairs_annie_jacobsen_darpa_pentagons_brain|https://www.youtube.com/watch?v=6eS17F7nuTM
yt_20181230_marble_marcher_fractal_physics_game_simulation|https://www.youtube.com/watch?v=9U0XVdvQwAI
yt_19920828_dongiler_smothersbrothers|https://www.youtube.com/watch?v=PpuDYgibL_A
yt_20200218_twominutepapers_neural_network_videos_60fps|https://www.youtube.com/watch?v=B1Dk_9k6l08
yt_20190405_comedycentral_drew_carey_bad_trip_electric_daisy_carnial|https://www.youtube.com/watch?v=5q0Y2KFw-q8
yt_20200110_stroppyme_qanon_related_news|https://www.youtube.com/watch?v=2dNsqoybMxw
yt_20190301_coedparade_chaos_equations_simple_math_art|https://www.youtube.com/watch?v=fDSIRXmnVvk
yt_20200221_infographics_mosaic_warfare_us_new_unstoppable_strategy|https://www.youtube.com/watch?v=mQ9QhyY59ro
`.split("\n");
// alert( "BUGS_30 list list="+list );
var btn_default="/yt/imgs/koeye_yt.png";
var btn = btn_default;
var tn = "";
var htmout = "";
var str = "";
var url="";
var href="";
var j = 0;
var line = "";
for( j = 0; j< list.length; j++ ) {
list_len = list[j].split("|").length;
line = list[j];
str = list[j].split("|")[0];
url = list[j].split("|")[list_len-1];
if( line == '' ) { continue; }
// alert( "BUGS_48 line="+line );
var btn = str2btn(line);
tn = '<img src="'+btn+'" height=50 border=0 alt="'+str+'" >';
// alert( "BUGS_49 tn="+tn );
htmout += "j="+j;
// htmout += " tn="+tn;
// htmout += " url="+url;
href = "";
href += '<a href="'+url+'" target=_blank>';
href += tn;
href += " </a>";
htmout += " href="+href;
htmout += " str=" + str;
htmout += "<br>";
// alert( "BUGS_60 href="+href );
continue;
htmout += href;
// alert( "BUGS_50 j="+j+" str="+str+" htmout="+htmout );
}
// alert( "BUGS_55 j="+j+" htmout="+htmout );
// document.getElementById('div_htmout_m').innerHTML = htmout;
// alert( "BUGS_56 j="+j+" htmout="+htmout );
return(htmout);
}
</script>
<script id="script_str2btn" >
function str2btn(str) {
var btn_default = "/imgs/btn/koeye_handhither.gif";
var btn = btn_default;
var re = "";
var htmout = "";
var regex_btn = "";
// # /youtube/gi|yt/imgs/koeye_yt.png
// # /youtube/gi|yt/imgs/koeye_av.png
var regex_btns = `
#
//
# /youtube/gi|yt/imgs/koeye_yt.png
// /youtube/gi|yt/imgs/koeye_av.png
polly|/yt/imgs/yt_polly.png
mcduff|/yt/imgs/yt_mcduff.png
munder|/yt/imgs/yt_munder.png
^munder|/yt/imgs/yt_munder.png
webb|/yt/imgs/yt_webb.png
vlad|/yt/imgs/yt_vlad9t.png
borealis|/yt/imgs/yt_borealis.png
med/imgs/operation.png
dah|/yt/imgs/yt_dahboo.png
fulford|/yt/imgs/yt_fulford.png
newearth|/yt/imgs/yt_newearth.png
quinn|/yt/imgs/yt_quinn.png
kt|/yt/imgs/koeye_kt.png
`.split("\n");
var line = "";
var regex = "";
var fldlen = 0;
var flds = "";
// alert( "BUGS_104 regex_btns="+regex_btns );
for( j=0; j<regex_btns.length; j++ ) {
flds = regex_btns[j];
fldlen=flds.split("|").length;
// alert( "BUGS_105 j="+j+" flds="+flds);
if( flds == "" ){ continue; }
if( /\#/.test(flds)){ continue; }
if( /\/\//.test(flds)){ continue; }
regex_btn="/imgs/btn/koeye_handhi.gif";
regex = flds.split("|")[0];
re = flds.split("|")[0];
regex_btn = flds.split("|")[fldlen-1];
if( regex == "" ) { contihue; }
// alert( "BUGS_120 str2btn j="+j+" regex="+regex+" regex_btn="+regex_btn );
// regex_btn = regex_btns[j].split("|")[1];
// if( regex.test(str)) {
// var re = new RegExp( '/^yt_2020/' );
// var re = /\w+\s/gi;
// var re = /^yt_202003/gi;
// var re = /kt/gi;
// alert( "BUGS_111 str2btn ______ j="+j+" re="+re+" str="+str );
re = new RegExp(regex,"gi");
// alert( "BUGS_110 str2btn ______ j="+j+" re="+re+" str="+str );
if( re.test(str)) {
// alert( "BUGS_112 str2btn __MATCH j="+j+" re="+re+" str="+str );
return(regex_btn);
}
else {
// alert( "BUGS_113 str2btn nomatch j="+j+" re="+re+" str="+str );
}
}
return(btn_default);
}
</script>
<style id="style_input">
.fileContainer {
overflow: hidden;
position: relative;
}
.fileContainer [type=file] {
cursor: inherit;
display: block;
font-size: 999px;
filter: alpha(opacity=0);
min-height: 100%;
min-width: 100%;
opacity: 0;
position: absolute;
right: 0;
text-align: right;`
top: 0;
}
</style>
<style id="style_popover" >
.popover {
position: relative;
float: left;
padding: 5px;
// /*z-ka1: 0;*/
// width: 200px;'
// height: 300px;
}
.popover:hover {
background-color: darkSlategrey;
// bigboxbug background-color: yellow;
// background-color: #e9e9e2;
// width: 200px;
// height: 300px;
/*z-ka1: 50;*/
// color: white;
color: ivory;
// color: #335500;
text-decoration: none;
}
/*CSS for enlarged image*/
.popover span {
position: absolute; // important
// width: 200px;
// height: 300px;
// background-color: #e5e5e5;
// left: -1000px;
// border: 1px solid #666;
// position: relative;
background-color: darkSlategrey;
padding: 5px;
border: 0px solid #666;
visibility: hidden;
color: ivory;
text-decoration: none;
}
/*CSS for enlarged image*/
.popover span img {
// border-width: 0px;
border-width: 0px;
/*padding: 2px;*/
}
/*CSS for enlarged image on hover*/
.popover:hover span {
visibility: visible;
// width: 200px;
top: 0px; /* use IF IE6 style to correct IE6 positions of larger image relative to thumb */
left: 0px;/*position where enlarged image should offset horizontally */
}
</style>
<script id="script_kludge" >
function kludge() {
return( btn );
// Method Description
// exec() Executes a search for a match in a string. It returns an array of information or null on a mismatch.
// test() Tests for a match in a string. It returns true or false.
// match() Returns an array containing all of the matches, including capturing groups, or null if no match is found.
// matchAll() Returns an iterator containing all of the matches, including capturing groups.
// search() Tests for a match in a string. It returns the index of the match, or -1 if the search fails.
// replace() Executes a search for a match in a string, and replaces the matched substring with a replacement substring.
// split() Uses a regular expression or a fixed string to break a string into an array of substrings.
var j=0;
var k=0;
var str="";
var regex_btn = "";
for( j=0; j<regex_btns.length; j++ ) {
regex = regex_btns[j].split("|")[0];
regex_btn = regex_btns[j].split("|")[1];
alert( "BUGS_90 str2btn j="+j+" regex="+regex );
if( str.test(regex)) {
alert( "BUGS_125 str2btn MATCH j="+j+" regex="+regex+" str="+str );
btn=regex_btn;
return(btn);
}
return(btn_default);
}
</script>
<script id="script_startup">
function startup() {
var htmout = "";
var htmout_w = "<hr color=white>";
var htmout_m = "";
var htmout_b = "<hr color=black>";
// alert( "BUGS_100 startup" );
// htmout_m = list('');
// document.getElementById('div_htmout_w').innerHTML = htmout_w;
// document.getElementById('div_htmout').innerHTML = htmout;
// document.getElementById('div_htmout_m').innerHTML = htmout_m;
// document.getElementById('div_htmout_b').innerHTML = htmout_b;
// alert( "BUGS_200 startup btn="+btn );
}
</script>
<style id="style_input" >
// body { text-align: center; background-color: "darkSlategrey"; color:"ivory"; }
input {
// visibility: hidden;
// background: rgba(7, 99, 53, .1);
background: transparent;
// border: 3px solid rgba(7, 99, 53, 1);
border: 3px solid darkSlategrey;
border-radius: 5px;
// color: rgba(7, 99, 53, 1);
// color: ivory;
color: darkSlategrey;
cursor: pointer;
line-height: 40px;
font-size: 10px;
outline: none;
padding: 0 20px;
transition: all .3s;
}
button:hover {
// background: rgba(7, 99, 53, 1);
background: darkgreyslate;
// background: yellow;
// background: white;
// color: rgba(255,255,255,1);
// color: white;
color: ivory;
}
p {font-size: 10px; font-weight: bold;
</style>
<style id="style_div_csv type="text/css">
body {
// font-family: Arial;
font-family: yokkmokkOT;
font-family: arial;
font-size: 8pt;
}
table {
border: 1px solid #ccc;
}
table th {
// background-color: #F7F7F7;
background-color: darkSlategrey;
// color: #333;
color: ivory;
font-weight: bold;
}
table th, table td {
padding: 5px;
border-color: #ccc;
}
</style>
</head>
<body bgcolor=lightblue onload="startup(); return false;">
<div id="div_files" >
<output id="zonelist"></output>
<div id="dropzone">
dropzone
<div id="div_canvas" style="position:relative; width:400px; height:200px background:white">
<canvas id="canvas_dropzone" style="z-index: 1;
position:absolute;
left:0px;
top:0px;
" height="100px" width="200" background-color="darkSlategrey" color="ivory">
WARN_1387 unauthorized access has been logged
</canvas>
</div>
</div>
<script name="script_fileselect">
function handleFileSelect(evt) {
evt.stopPropagation();
evt.preventDefault();
var files = evt.dataTransfer.files; // FileList object.
// files is a FileList of File objects. List some properties.
var output = [];
for (var i = 0, f; f = files[i]; i++) {
output.push('<li><strong>', escape(f.name), '</strong> (', f.type || 'n/a', ') - ',
f.size, ' bytes, last modified: ',
f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a',
'</li>');
}
document.getElementById('zonelist').innerHTML = '<ul>' + output.join('') + '</ul>';
}
function handleDragOver(evt) {
evt.stopPropagation();
evt.preventDefault();
evt.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
}
// Setup the dnd listeners.
var dropZone = document.getElementById('dropzone');
dropZone.addEventListener('dragover', handleDragOver, false);
dropZone.addEventListener('drop', handleFileSelect, false);
</script>
<hr><hr><hr>
<label class="fileContainer">
files
<input id="files" name="files[]" multiple="" type="file">
</label>
<output id="zonelist"></output>
<script id="script_file_select" >
function handleFileSelect(evt) {
var files = evt.target.files; // FileList object
// files is a FileList of File objects. List some properties.
var output = [];
var htmout = "";
for (var i = 0, f; f = files[i]; i++) {
output.push('<li><strong>', escape(f.name), '</strong> (', f.type || 'n/a', ') - ',
f.size, ' bytes, last modified: ',
f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a',
'</li>');
htmout += '<a href="'+escape(f.name)+'" target=_blank>';
htmout += ' '+i+' '+escape(f.name)+'</a>';
}
document.getElementById('zonelist').innerHTML = '<ul>' + output.join('') + '</ul>';
// alert( "BUGS_5130 FILES files="+files[0].name );
document.getElementById('zonelist').innerHTML = htmout;
}
document.getElementById('files').addEventListener('change', handleFileSelect, false);
</script>
<div id="wrapper" hidden>
<div id="upload-widget">
<h1><i class="fa fa-cloud-upload"></i>File Uploader </h1>
<form id="file-upload-form">
<div class="file-input-wrap">
fups
<input type="file" name="file" id="file" multiple>
</div><!-- .file-input-wrap -->
</form><!-- #file-upload-form -->
</div><!-- #upload-widget -->
<div id="upload-result">
</div><!-- #upload-result -->
</div><!-- #wrapper -->
<!--
<div id="div_files2" >
<label class="fileContainer">
files2
<input id="files2" name="files2[]" multiple="" type="file">
</label>
<output id="zonelist2"></output>
</div>
-->
<script id="script_files_select" >
function handleFileSelect(evt) {
var files = evt.target.files; // FileList object
// Loop through the FileList and render image files as thumbnails.
for (var i = 0, f; f = files[i]; i++) {
// Only process image files.
if (!f.type.match('image.*')) { continue; }
var reader = new FileReader();
// Closure to capture the file information.
reader.onload = (function(theFile) {
return function(e) {
// Render thumbnail.
// alert( "BUGS_5160 filereader theFile="+theFile.name );
var span = document.createElement('span');
span.innerHTML = ['<img class="thumb" src="', e.target.result,
'" title="', escape(theFile.name), '"/>'].join('');
document.getElementById('zonelist').insertBefore(span, null);
};
})(f);
// Read in the image file as a data URL.
reader.readAsDataURL(f);
}
}
document.getElementById('div_files').addEventListener('change', handleFileSelect, false);
</script>
<script id="script_previewfile">
function previewfile(file) {
if (tests.filereader === true && acceptedTypes[file.type] === true) {
var reader = new FileReader();
reader.onload = function (event) {
var image = new Image();
image.src = event.target.result;
image.width = 250; // a fake resize
holder.appendChild(image);
};
reader.readAsDataURL(file);
}
else {
holder.innerHTML +=
'<p>done: koupload'
+ file.name
+ ' '
+ (file.size ? (file.size/1024|0) + 'K' : '');
console.log(file);
}
}
function readfiles(files) {
debugger;
var formData = tests.formdata ? new FormData() : null;
for (var i = 0; i < files.length; i++) {
if (tests.formdata) formData.append('file', files[i]);
previewfile(files[i]);
}
// now post a new XHR request
if (tests.formdata) {
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://ka6/ko/bin/php/ko.php?ko=ajax,upload,filenames,phpi,ok');
// xhr.open('POST', 'ka6/ko/bin/php/index.php?q=upload,filenames');
xhr.onload = function() {
progress.value = progress.innerHTML = 100;
};
if (tests.progress) {
xhr.upload.onprogress = function (event) {
if (event.lengthComputable) {
var complete = (event.loaded / event.total * 100 | 0);
progress.value = progress.innerHTML = complete;
}
}
}
xhr.send(formData);
}
}
if (tests.dnd) {
holder.ondragover = function () { this.className = 'hover'; return false; };
holder.ondragend = function () { this.className = ''; return false; };
holder.ondrop = function (e) {
this.className = '';
e.preventDefault();
readfiles(e.dataTransfer.files);
}
}
else {
fileupload.className = 'hidden';
fileupload.querySelector('input').onchange = function () {
readfiles(this.files);
};
}
</script>
<script id="script_myfilework">
funtion myfilework( j, file ) {
// alert( j+" file="+file );
}
</script>
<script id="script_upload_input">>
var upload = document.getElementsByTagName('input')[0],
holder2 = document.getElementById('holder2'),
state = document.getElementById('status');
if (typeof window.FileReader === 'undefined') {
state.className = 'fail';
}
else {
state.className = 'success';
state.innerHTML = 'File API & FileReader available';
}
upload.onchange = function (e) {
e.preventDefault();
var file = upload.files[0],
reader = new FileReader();
reader.onload = function (event) {
var img = new Image();
img.src = event.target.result;
// note: no onload required since we've got the dataurl...I think! :)
if (img.width > 560) { // holder width
img.width = 560;
}
holder2.innerHTML = '';
holder.appendChild(img);
};
reader.readAsDataURL(file);
return false;
};
// var formData = new FormData();
// formData.append("part_num", "123ABC");
// formData.append("part_price", 7.95);
// formData.append("part_image", somefile)
//
// var xhr = new XMLHttpRequest();
// xhr.open("POST", "http://ka6/ko/bin/php/ko.php?ko=ajax,upload/");
// xhr.send(formData);
</script>
<!-- <canvas color="darkSlategrey" height="100" width="400"></canvas> -->
<canvas color="linen" height="100" width="400"></canvas>
<div id="div_csv"><h3>div_csv</h3></div>
<script id="script_upload" type="text/javascript">
// function upload_csv() {
function Upload() {
// var files = evt.dataTransfer.files; // FileList object.
// var fileUpload = document.getElementById("upload_files");
var fileUpload = document.getElementById("fileUpload");
var regex = /^([a-zA-Z0-9\s_\\.\-:])+(.csv|.txt|.psv|.py|.htm|.html|.php)$/;
// if (regex.test(fileUpload.value.toLowerCase())) {
if (regex.test(fileUpload.value.toLowerCase())) {
if (typeof (FileReader) != "undefined") {
var reader = new FileReader();
reader.onload = function (e) {
var table = document.createElement("table");
var rows = e.target.result.split("\n");
for (var i = 0; i < rows.length; i++) {
var row = table.insertRow(-1);
// var cells = rows[i].split("|");
var cells = rows[i].split(",");
for (var j = 0; j < cells.length; j++) {
var cell = row.insertCell(-1);
cell.innerHTML = cells[j];
}
}
var csv2tbl = document.getElementById("csv2tbl");
csv2tbl.innerHTML = "";
csv2tbl.appendChild(table);
}
reader.readAsText(fileUpload.files[0]);
file_csv=fileUpload.files[0];
file_csvlen = fileUpload.files.length;
// alert( "BUGS_4390 CSV file_csvlen="+file_csvlen+" file_csv="+file_csv );
load_file_csv(file_csv);
}
// else {
// alert("csv2tbl warn: unauthorized access noted");
// }
}
else {
alert("csv2tbl fail: unsuppoted format");
}
}
</script>
<script id="script_load_file_csv">
function load_file_csv(file_csv) {
alert( "BUGS_4400 load_file_csv file_csv="+file_csv" );
file_psv=file_csv;
return(file_psv);
}
</script>
<label class="fileContainer">
files.csv.psv.txt
<input id="fileUpload" type="file"></input>
</label>
     
<label class="fileContainer">
parse.csv.psv.txt
<input id="upload" value="Upload" onclick="Upload()" type="button"></input>
</label>
<div id="csv2tbl"><h3>csv2tbl</h3></div>
<div id="item" ><h3>div_item</h3></div>
<script id="script_filebind" type="text/javascript">
$(function() {
// grab the file input and bind a change event onto it
$('#file').bind("change", function() {
// new html5 formdata object.
var formData = new FormData();
// for each entry, add to formdata to later access via $_FILES["file" + i]
for (var i = 0, len = document.getElementById('file').files.length; i < len; i++) {
formData.append("file" + i, document.getElementById('file').files[i]);
}
//send formdata to server-side
$.ajax({
// url: "file-upload.php", // our php file
// url: "ka1_fileupload.php", // our php file
// nurl: "http://ka1/ka1.php?q=up", // our php file
// url: "/kup.php", // our php file
// url: "/ka1_up.php", // our php file
// url: "/ka1.php?q=kup", // our php file
// url: "/ko0.php?q=kup", // our php file
// url: "/ko1.php?q=kup", // our php file
url: "/ko2.php?q=kup", // our php file
// bugs url: "10.0.0.112:/ka1.php?q=up", // our php file
type: 'post',
data: formData,
dataType: 'html', // we return html from our php file
async: true,
processData: false, // tell jQuery not to process the data
contentType: false, // tell jQuery not to set contentType
success : function(data) {
$('#upload-result').append('<div class="alert alert-success"><p>File(s) uploaded successfully!</p><br />');
$('#upload-result .alert').append(data);
},
error : function(request) {
console.log(request.responseText);
}
});
});
});
</script>
<!--
<script id="script_canvas">
var canvas = document.getElementsByTagName('canvas')[0],
ctx = null,
grad = null,
body = document.getElementsByTagName('body')[0],
color = 255;
color = lightblue;
if (canvas.getContext('2d')) {
ctx = canvas.getContext('2d');
ctx.clearRect(0, 0, 600, 600);
ctx.save();
// Create radial gradient
// grad = ctx.createRadialGradient(0,0,0,0,0,600);
// grad.addColorStop(0, '#000');
// grad.addColorStop(1, 'rgb(' + color + ', ' + color + ', ' + color + ')');
// assign gradients to fill
// ctx.fillStyle = grad;
ctx.fillstyle = "lightblue";
// draw 600x600 fill
ctx.fillRect(0,0,600,600);
ctx.save();
body.onmousemove = function (event) {
var width = window.innerWidth,
height = window.innerHeight,
x = event.clientX,
y = event.clientY,
rx = 600 * x / width,
ry = 600 * y / height;
var xc = ~~(256 * x / width);
var yc = ~~(256 * y / height);
grad = ctx.createRadialGradient(rx, ry, 0, rx, ry, 600);
grad.addColorStop(0, '#000');
grad.addColorStop(1, ['rgb(', xc, ', ', (255 - xc), ', ', yc, ')'].join(''));
// ctx.restore();
// ctx.fillStyle = grad;
ctx.fillstyle="lightblue";
ctx.fillRect(0,0,600,600);
// ctx.save();
};
}
</script>
-->
<!--
<button type="button" id="fileUpload" type="file" >select</button>
<button type="button" id="upload" value="Upload" onclick="Upload(); return false;">upload</button>
<img src=/imgs/btn/koeye_handhither.gif onclick="Upload();return false;" >
-->
<hr color=white>
<hr color=white>
<hr color=white>
<hr color=white>
<div id="div_paste">
<hr color=white>
<hr color=black>
<div id='editableDiv' contenteditable='true'>paste</div>
<hr color=black>
<hr color=white>
<hr color=black>
<div id='div' contenteditable='true'>ffpaste</div>
<hr color=black>
<hr color=white>
</div>
<script id="script_clipboard" >
function handlePaste (e) {
var clipboardData, pastedData;
// Stop data actually being pasted into div
e.stopPropagation();
e.preventDefault();
// Get pasted data via clipboard API
clipboardData = e.clipboardData || window.clipboardData;
pastedData = clipboardData.getData('Text');
// Do whatever with pasteddata
alert(pastedData);
}
document.getElementById('editableDiv').addEventListener('paste', handlePaste);
</script>
<script id="script_clipboard_ff" >
function handlepaste_ff (e) {
var types, pastedData, savedContent;
// Browsers that support the 'text/html' type in the Clipboard API (Chrome, Firefox 22+)
if (e && e.clipboardData && e.clipboardData.types && e.clipboardData.getData) {
// Check for 'text/html' in types list. See abligh's answer below for deatils on
// why the DOMStringList bit is needed. We cannot fall back to 'text/plain' as
// Safari/Edge don't advertise HTML data even if it is available
types = e.clipboardData.types;
if (((types instanceof DOMStringList) && types.contains("text/html")) || (types.indexOf && types.indexOf('text/html') !== -1)) {
// Extract data and pass it to callback
pastedData = e.clipboardData.getData('text/html');
// processPaste(editableDiv, pastedData);
processPaste_ff(editableDiv, pastedData);
// Stop the data from actually being pasted
e.stopPropagation();
e.preventDefault();
return false;
}
}
// Everything else: Move existing element contents to a DocumentFragment for safekeeping
savedContent = document.createDocumentFragment();
while(editableDiv.childNodes.length > 0) {
savedContent.appendChild(editableDiv.childNodes[0]);
}
// Then wait for browser to paste content into it and cleanup
waitForPastedData(editableDiv, savedContent);
return true;
}
function waitForPastedData (elem, savedContent) {
// If data has been processes by browser, process it
if (elem.childNodes && elem.childNodes.length > 0) {
// Retrieve pasted content via innerHTML
// (Alternatively loop through elem.childNodes or elem.getElementsByTagName here)
var pastedData = elem.innerHTML;
// Restore saved content
elem.innerHTML = "";
elem.appendChild(savedContent);
// Call callback
processPaste_ff(elem, pastedData);
}
// Else wait 20ms and try again
else {
setTimeout(function () {
waitForPastedData(elem, savedContent)
}, 20);
}
}
function processPaste_ff (elem, pastedData) {
// Do whatever with gathered data;
alert(pastedData);
elem.focus();
}
// Modern browsers. Note: 3rd argument is required for Firefox <= 6
if (editableDiv.addEventListener) {
editableDiv.addEventListener('paste', handlepaste, false);
}
// IE <= 8
else {
editableDiv.attachEvent('onpaste', handlepaste);
}
$(document).on('paste','[contenteditable]',function(e) {
e.preventDefault();
var text = (e.originalEvent || e).clipboardData.getData('text/plain');
window.document.execCommand('insertText', false, text);
});
</script>
<script id="script_clipboard_jskit" >
function getSelectionText(){
var selectedText = ""
if (window.getSelection){ // all modern browsers and IE9+
selectedText = window.getSelection().toString()
}
return selectedText
}
document.addEventListener('mouseup', function(){
var thetext = getSelectionText()
if (thetext.length > 0){ // check there's some text selected
console.log(thetext) // logs whatever textual content the user has selected on the page
}
}, false)
function copySelectionText(){
var copysuccess // var to check whether execCommand successfully executed
try{
copysuccess = document.execCommand("copy") // run command to copy selected text to clipboard
}
catch(e){
copysuccess = false
}
return copysuccess
}
</script>
</body>
</html>
//
koh5_pano
Drag mouse to navigate.
Navigation
- Left/Right Mouse drag: Changes camera heading.
- Up/Sown Mouse drag: Changes camera pitch.
- Scroll wheel: Changes camera field of view.
- I-Key: Displays Info panel with canvas size, image size and FPS.
17.Aug.2010, Martin Wengenmayer