Software development, photography, jokes, ....

Sites by me

 
tas-logoTransportation Administration System
snoezelkussen-logo-kleinstSnoezelkussens voor verstandelijk gehandicapten
ikzoekeenbegeleider-logoBegeleiders voor gehandicapten
Laat uw hond het jaarlijkse vuurwerk overwinnen
Betuweroute en Kunst
logo 50x50Hey Vos! Je eigen naam@vos.net emailadres?
Kunst in huis? Nicole Karrèr maakt echt bijzonder mooie dingen
nettylogo2Kunst in huis? Netty Franssen maakt ook bijzonder mooie dingen
Professionele opvang bij Gastouderbureau
Kind-Zijn
Salarisadministratie en belastingadvies bij
De Zaak Loont
Zutphense Bomenstichting

Hosting Favorites

 
ANU Internet Services
XelMedia .internet Services
register.com

Blogroll

 
Bomenstichting
MacFreak
Google Translate
PHP
MySQL
jQuery
jQuery UI
codecademy
YourHead Stacks API



Website Hosting bij Xel Media

Categories

Archives

Marc's Place


 

Copy DOM content to the clipboard with pure Javascript #copy #clipboard #javascript #domelement #webdevelopment #coding

 Permalink
Of all the tips on the internet on how to copy data from a DOM element to the clipboard, I compiled my own function(s).

The examples below are to copy the 'href'-part of  a link to an RSS feed to the clipboard.

1. By class name, use the first found element
function copyToClipboardCN(element, attr) {
x = document.getElementsByClassName(element);
if(x !== undefined && x !== null && x[0] !== undefined) {
var textarea = document.createElement("textarea");
document.body.appendChild(textarea);
textarea.value = x[0][attr];
textarea.select();
var status = document.execCommand('copy');
textarea.remove();
}
}

2. By id
function copyToClipboardID(element, attr) {
x = document.getElementById(element);
if(x !== undefined && x !== null) {
var textarea = document.createElement("textarea");
document.body.appendChild(textarea);
textarea.value = x[attr];
textarea.select();
var status = document.execCommand('copy');
textarea.remove();
}
}

RSS feed link example with a class and an ID, using FontAwesome icons:

<a class="blog-rss-link" href="https://macvos.blogspot.com/feeds/posts/default" rel="alternate" target="_blank" title="RSS Feed" type="application/rss+xml"><i class="fa fa-rss"> RSS Feed <i class="fa fa-copy" onclick="copyToClipboardCN('blog-rss-link', 'href')" style="cursor: pointer;" title="Copy RSS link to clipboard">

<a id="blog-rss-link" href="https://macvos.blogspot.com/feeds/posts/default" rel="alternate" target="_blank" title="RSS Feed" type="application/rss+xml"><i class="fa fa-rss"> RSS Feed <i class="fa fa-copy" onclick="copyToClipboardID('blog-rss-link', 'href')" style="cursor: pointer;" title="Copy RSS link to clipboard">

I have thought about combining the two functions into one, but i find that dangerous. In case you don't, here it is:
function copyToClipboard(element, attr) {
var x = document.getElementById(element);
if(x === undefined || x === null) {
x = document.getElementsByClassName(element);
if(x !== undefined && x !== null && x[0] !== undefined) {
x = x[0];
}
else {
x = undefined;
}
}
if(x !== undefined) {
var textarea = document.createElement("textarea");
document.body.appendChild(textarea);
textarea.value = x[attr];
textarea.select();
var status = document.execCommand('copy');
textarea.remove();
}
}


 View Comments

SetEXIFData 6.7 #setexifdata #photo #foto #image #fotobewerking #exiftool #exif #exifdata #photography #fotografie #keywords #copyright #author #artist

 Permalink
setexifdata
A new version of SetEXIFData , my GUI for exiftool by Phil Harvey , is now available:

v6.7
(09-february-2018)

Added:
  • Warning that on macOS 10.7 RAW image previews are not supported, unless macOS 10.7 supports them.
Fixed:
  • Crash when trying to display thumbnails of RAW images on macOS 10.11 or lower.
  • Replaced all floating modal dialogs with sheet-windows.
  • Multiple sheet-windows do not show over one another anymore, unless necessary.
  • Situation where the check for the presence of exiftool or dcraw would fail.
 View Comments

SetEXIFData 6.6

 Permalink
setexifdata
A new version of SetEXIFData , my GUI for exiftool by Phil Harvey , is now available:

v6.6
(06-february-2018)

New:
- Added the use of the RAW image converter 'dcraw' (created by Dave Coffin) to enable the displaying of RAW image thumbnails in the preview window. You'll find an installer package on the DMG. This will instal 'dcraw' in '/usr/local/bin/', so you can use it yourself too, system wide. When you click on a line which has a RAW image, and SetEXIFData finds that it gets no data via Mac OS X, SetEXIFData will use 'dcraw' to extract the thumbnail. It will write a TIFF file in /tmp, which name begins with 'sed_', for example sed_myimage.arw.tiff and use that TIFF as a thumbnail in the preview window. On app exit, it will remove these files again.

Fixed:
- Crash when trying to display a thumbnail of RAW images, which are unsupported by your version of Mac OS X's Camera Raw extension.
 View Comments

Stilleven van een leesmandje - Still Life of a Reading Basket #foto #photo #art #fotografie #photography #reading #lezen #stilleven #silllife

 Permalink
Stilleven van een leesmandje / Still life of a reading basket
 View Comments

ICSviewer 3.3 #icsviewer #ical #calendar #viewer #xojo #event #planning #planned #timeline

 Permalink
icsviewer
The ical/ics calendar file viewer ICS Viewer is updated to version 3.3.

v3.3
What is new:

- New: Added Extra Database Fields to the MySQL export preferences and the MySQL export process.

What has changed:
- A bug preventing Unit to be exported to MySQL has been fixed.
 View Comments

SetEXIFData 6.5

 Permalink
setexifdata
A new version of SetEXIFData , my GUI for exiftool by Phil Harvey , is now available:

v6.5
(30-december-2017)

Fixed:
- Added the -m option to suppress minor errors, which often occurs with 'maker notes'.
- All relevant screen fields are emptied and reset when 'Start over' is clicked.
 View Comments

SetEXIFData 6.4

 Permalink
setexifdata
A new version of SetEXIFData , my GUI for exiftool by Phil Harvey , is now available:

v6.4
(08-december-2017)

Fixed:
- Getting the date/time from file name repeated the same date/time to all photos when no interval was used.
- Getting the sequence-number or subseconds from file name only picked 2 digits. This is now 4 digits.
 View Comments

Keuken Stilleven - Kitchen Still Life

 Permalink
Keuken stilleven - Kitchen still life
 View Comments

SetEXIFData 6.3

 Permalink
setexifdata
A new version of SetEXIFData , my GUI for exiftool by Phil Harvey , is now available:

v6.3
(20-november-2017)

Fixed:
- Clicking the red close button of the main window would cause the 64bit version of SetEXIFData to crash.
 View Comments

SetEXIFData 6.2

 Permalink
setexifdata
A new version of SetEXIFData , my GUI for exiftool by Phil Harvey , is now available:

v6.2
(19-november-2017)

Fixed:
- Saved startup-geocoordinates were sorted ascending. This was a bug that's been there since v5.3 and wasn't discovered until yesterday.
 View Comments
See Older Posts ...
© 1997- Marc Vos (and others) Contact Me