DIR : /home/kozerus/public_html/ko_filespaste.html

/home/kozerus/public_html

<html>
<head>
	<title>h5filecsv.html 20211205_0245</title>

	<script id=script_checkapi>
// Check for the various File API support.
// Great success! All the File APIs are supported.
		if (window.File && window.FileReader && window.FileList && window.Blob) {
			} 
		else {
			alert('ERR_103 Unsupported browser');
			}

		</script>

		<style id=style_canvas_files> 
			#canvas_files_txt{ border:2px solid white } 
			#canvas_files_info{ border:2px solid goldenrod } 
			#canvas_files_tn{ border:3px solid black } 
			#canvas_files_paste{ border:4px solid burleywood } 
			#canvas_files_ffpaste{ border:5px solid linen } 
			</style>
	</head>
<body bgcolor=linen>

<h1>PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP</h1>


	<img src=/imgs/btn/koeye.png id=imgs_filespaste onclick="toggle('div_filespaste');return false;" height=20>
	filespaste
	<div id=div_filespaste>
		<hr color=black>
		<hr color=white>
		<h2>div_filespaste</h2>
		<div id='editableDiv' contenteditable='true'>
			<hr color=white>
			filespaste
			<canvas id=canvas_files_ffpaste height=50 width=1100></canvas>
			<hr color=white>
			<hr color=black>
			</div id=editableDiv_end>
		</div id=div_files_paste_end>

	<hr color=goldenrod>
	<hr color=goldenrod>
	<hr color=white>

	<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>

		</div id=div_files_paste_end>

	<hr color=goldenrod>
	<hr color=goldenrod>
	<hr color=goldenrod>
	<img src=/imgs/btn/koeye.png id=imgs_filespaste onclick="toggle('div_filespaste');return false;" height=20>
	<div id=div_filesffpaste>
		<hr color=black>
		<hr color=white>
		<h2>div_filesffpaste</h2>
		<hr color=white>
		<div id='div' contenteditable='true'>
			<hr color=black>
			ffpaste
			<canvas id=canvas_files_ffpaste height=100 width=1100></canvas>
			<hr color=black>
			</div id=div_end>
		<hr color=white>
		<hr color=black>
		</div id=div_files_ffpaste_end>

	</body>
	</html>
//


koh5_pano



Your browser does not support the HTML5 canvas element.


Drag mouse to navigate.

Navigation





17.Aug.2010, Martin Wengenmayer