Clipboard extention for jQuery

Overview

jQlipboard

jQlipboard

jQlipboard is a jQuery extension that makes accessing the clipboard much easier. This plugin also has features that make it usable across all modern browsers.

The following is a brief tutorial on how to use jQlipboard. Full documentation can be found here.

Installation

To install, simply add the following script tag below the tag where jQuery.js is called:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.js"></script>
<script src="https://diriectordoc.github.io/jQlipboard/src/v0.3/jQlipboard.js"></script>

Or, for a minified script:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://diriectordoc.github.io/jQlipboard/src/v0.3/jQlipboard.min.js"></script>

Copying

There are a few ways to add text to the clipboard. To simply copy a string to the clipboard use $.copy(str):

$.copy("This string will be copied")

To copy the text in an <input> or <textarea>, simply use $(...).copy():

let element = $('<input type="text" />').val("This text will bo copied").appendTo("body")

/* The value of the textarea is copied */
element.copy()

Using $(...).copy() on any other type of element will instead copy the inside text.

<body>
	<div id="copy-text">This text will be coppied</div>

	<script>
		$("#copy-text").copy()
	</script>
</body>

Selecting

Using $(...).select() will highlight the target element. This will work on almost any element. This function extends the use of the existing jQuery function .select(), which will trigger instead if used on an <input> or <textarea> element.

<body>
	<div id="select-text">This text will be selected</div>

	<script>
		$("#select-text").select()
	</script>
</body>

Calling the function $.deselect() will nullify any selection there may be on the page.

Source

The source files are kept in the /src directory. Files /src/*.js and /src/w/*.js are the files that get updated gradually. Once an edit is stable enough to release, the version number of each file is updated and then placed in their respective release folder, labled with the version number ("v" for base jQlipboard and "w" for jQlipboard withPaste).

Comments
  • w0.3

    w0.3

    Changes

    • Removed check to see if jQuery object has a certain CSS
    • No longer makes the text invisible when appending temporary text. Instead, it is placed off the far left side; out of sight
    • Adjusted $.copy() to accept more than strings
      • Inputting false will now copy "false" to the clipboard
      • Inputting most objects will copy a jsonified string
      • Inputting a Date object will copy the Date's ISO String
      • Inputting an HTMLElement will copy the outterHTML of the element
      • Inputting null will clear the clipboard, but inputting undefined is the same as inputting no parameter
      • Inputting anything else with all the parameter's .toString() function before attempting to copy anything
        • Note: if the exact result of the .toString() is equal to "[object Object]", the object will be jsonified and the jsonified string will be copied instead
    opened by DiriectorDoc 0
  • v0.3

    v0.3

    Changes

    • Removed check to see if jQuery object has a certain CSS
    • No longer makes the text invisible when appending temporary text. Instead, it is placed off the far left side; out of sight
    • Adjusted $.copy() to accept more than strings
      • Inputting false will now copy "false" to the clipboard
      • Inputting most objects will copy a jsonified string
      • Inputting a Date object will copy the Date's ISO String
      • Inputting an HTMLElement will copy the outterHTML of the element
      • Inputting null will clear the clipboard, but inputting undefined is the same as inputting no parameter
      • Inputting anything else with all the parameter's .toString() function before attempting to copy anything
        • Note: if the exact result of the .toString() is equal to "[object Object]", the object will be jsonified and the jsonified string will be copied instead
    opened by DiriectorDoc 0
  • w0.2

    w0.2

    v0.2

    Since I started developing jQlipboard, I have been trying to implement the features I visioned and working out the kinks. jQlipboard has reached the next stage of development; v0.2. While this won't change much on the technical side, I feel it is necessary given how far it has come. This may sound cheesy, but I am proud of this little extension.

    On a similar note, the withPaste version of jQlipboard version will be known as w0.2 with a W instead of a V.

    Changes

    All versions

    • The $.jQlipboard.version version now has its version type prefixed before it (v for standard and w for withPaste)
    • Made it so when using $.fn.select on a <textarea> or <input> field, it actually performs the intended action, as opposed to what it was doing before, which I have no idea where I got that code
    • Replaced "static" functions with an arrow function because they do not use this it they take up less space
    • When manually setting the user-select CSS in a dynamically created element, setting that value to "auto" does nothing. This setting has been changed to "text" so it should work properly. I doubt anyone had a problem with it yet, but I'm glad I caught it before it became one.
    • Linked the full documentation page at the top of the README
    • Changed the installation code in the README to provide a static link rather than a GitHub raw link, which could change at any time
    • No longer use a try{}catch(e){} statement to check for jQluer in the minified version
    • Replaced custom function that checks an elements tagNames with a more concise method (actual jQuery)

    Startard version

    • After the shift to two separate versions, I forgot to test the standard version. Simply assigning $.jQlipboard.version a value will throw an error because $.jQlipboard is undefined whereas in withPaste it is not. This was fixed.

    withPaste

    • Removed the need to initialize jQlipboard to use paste. The way I see it, if you don't want to have the pasting function, don't use the withPaste version.
      • Consequently, the warning you get when pasting is off will no longer appear
    opened by DiriectorDoc 0
  • v0.2

    v0.2

    v0.2

    Since I started developing jQlipboard, I have been trying to implement the features I visioned and working out the kinks. jQlipboard has reached the next stage of development; v0.2. While this won't change much on the technical side, I feel it is necessary given how far it has come. This may sound cheesy, but I am proud of this little extension.

    On a similar note, the withPaste version of jQlipboard version will be known as w0.2 with a W instead of a V.

    Changes

    All versions

    • The $.jQlipboard.version version now has its version type prefixed before it (v for standard and w for withPaste)
    • Made it so when using $.fn.select on a <textarea> or <input> field, it actually performs the intended action, as opposed to what it was doing before, which I have no idea where I got that code
    • Replaced "static" functions with an arrow function because they do not use this it they take up less space
    • When manually setting the user-select CSS in a dynamically created element, setting that value to "auto" does nothing. This setting has been changed to "text" so it should work properly. I doubt anyone had a problem with it yet, but I'm glad I caught it before it became one.
    • Linked the full documentation page at the top of the README
    • Changed the installation code in the README to provide a static link rather than a GitHub raw link, which could change at any time
    • No longer use a try{}catch(e){} statement to check for jQluer in the minified version
    • Replaced custom function that checks an elements tagNames with a more concise method (actual jQuery)

    Startard version

    • After the shift to two separate versions, I forgot to test the standard version. Simply assigning $.jQlipboard.version a value will throw an error because $.jQlipboard is undefined whereas in withPaste it is not. This was fixed.

    withPaste

    • Removed the need to initialize jQlipboard to use paste. The way I see it, if you don't want to have the pasting function, don't use the withPaste version.
      • Consequently, the warning you get when pasting is off will no longer appear
    opened by DiriectorDoc 0
  • No paste

    No paste

    No more pasting by default

    Removed pasting as it is very finicky and even I don't know where I was going with it. I have preserved the code in the branch withPaste.

    A console notice has been placed on both the master branch and the NoPaste branch informing users to use the master branch. I'm not sure how many uses either branch gets, but I am hoping I can remove the notices pretty swiftly without causing too much damage. Say, two weeks should be good?

    opened by DiriectorDoc 0
  • v0.1.7

    v0.1.7

    Changes

    • When copying a table, the outterHTML will be copied to the clipboard
      • Usually when people copy a table, they paste it into a spreadsheet program or such. Keeping the HTML is better for that scenario.
    • Removed IE support
    • If copying an element while there's a selection somewhere else in the document, jQlipboard will now properly reselect the items that were deselected

    The last commit to .tomin.js, when minified, was the exact same size as it was before. In the meantime, the .min file will remain how it is until another commit is made to .tomin

    opened by DiriectorDoc 0
  • v0.1.6

    v0.1.6

    Changes

    • Made a bunch of spelling fixes in the README
    • Rename:
      • window.qlipboard$.jQlipboard.qlipboard
      • $.jQlipboardVersion$.jQlipboard.version
    • Copying a <table> element gives you the outerHTML instead of the text you would get if it were selected and copied
    • Fixed an error in $.fn.paste were it checks if $.paste doesn't exist instead of checking whether it failed to execute
    • Stopped caring about the variable names given in the .min by the minifier
    • Made reductions in the unminified file
    opened by DiriectorDoc 0
  • v0.1.5

    v0.1.5

    Changes

    • Pasting now off by default. This removes the need for permission requests upon successful copying.
    • Pasting can be switch on and off upon initialization.
      • Turning it off or leaving it by default will nullify every other config option. All other configurations rely on the ability to paste.
    • jQlipboard will now immediately initialize itself using the default setting upon loading, assuming jQuery was inserted properly.
    • Updated README
    • You no longer get an alert saying the site does not have permission to access clipboard.
    opened by DiriectorDoc 0
  • v0.1.3

    v0.1.3

    Changes

    • Spelling error: "agrant" → "grant"
    • No longer checks for $(":focus") and goes straight to $(document.activeElement)
    • Changes filenames to echo a lowercase j rather than a capital
    • Slightly more reduction in .min.js
    opened by DiriectorDoc 0
  • v0.1.2

    v0.1.2

    Changes

    • Removed the need for browser checks
    • Overhauled the initialization of jQlipboard
    • Added $.deselect() which does what you'd expect
    • Removed {permissionAlert: /* ... */} from the config – will no longer give an alert when a copy or a paste is not possible
    • Saved almost 1000 bytes in the new .min.js file
    • Removed misc.js as it was never supposed to be in this repository in the first place
    opened by DiriectorDoc 0
Owner
Started programming at age 11. Long story; it was a huge domino effect starting with an April Fools joke I took too seriously. Fastforward, now I'm a journeyman
null
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Copy to clipboard jQuery plugin.

jQuery - Copy to clipboard Plugin jQuery Copy to clipboard plugin - copy any text to the user site's clipboard. Operates on the basis of creating hidd

Milan Kyncl 16 Aug 21, 2022
A simple way to share files and clipboard within a local network.

Shortcut Simple way to share files and clipboard with devices within a local network. Usage Run the ./shortcut executable. A browser window will be op

Dhamith Hewamullage 17 Mar 13, 2022
Lightweight library to copy PNG and JPG images to clipboard

Copy Image Clipboard Created with ❤️ by Luan Eduardo da Costa | Follow me on Linkedin ?? About This library allows you to copy JPG and PNG images (onl

Luan Eduardo da Costa 34 Nov 29, 2022
Chrome Extension that extracts metroretro.io JSON to your clipboard as an HTML list

retro-clippy Chrome Extension that extracts metroretro.io JSON to your clipboard as an HTML list Installation Clone repo and run yarn to install depen

Sherman Hui 2 Apr 11, 2022
A tool for collecting data and access camera, microphone and location and clipboard via link.

Snow Build malicious links. A tool for collecting data and access camera, microphone and location and clipboard via link.

Msf 14 Dec 12, 2022
A Virtual Interactive Keyboard which replicates every key you press and a Text-Area in which everything is written and can be copied to the clipboard with a click of a button.

A Virtual Interactive Keyboard which replicates every key you press and a Text-Area in which everything is written and can be copied to the clipboard with a click of a button.

Devang Joshi 1 Mar 1, 2021
cross-platform Deno library for writing and reading clipboard.

deno-clippy This is cross-platform Deno library for writing and reading clipboard. You can read from/write image and text. This library uses Rust's ar

skanehira 34 Dec 3, 2022
Manipulate Clipboard in Node.js via native API.

@napi-rs/clipboard Manipulate Clipboard in Node.js via native API. It's a Node.js binding for 1Password/aboard API Text import { Clipboard } from '@na

LongYinan 64 Nov 7, 2022
Monitor incoming SMS for SMS-codes, add them to clipboard

MacOs only. Monitors SMS for codes, adds them to the clipboard. Monitors Messages SQLite file ~/Library/Messages/chat.db for new messages, uses regexp

Ilya Kantor 3 Sep 23, 2022
blog with angular made in sass and firebase auth with google, facebook and github also you can copy to clipboard

BlogAngular This project was generated with Angular CLI version 14.1.2. Development server Run ng serve for a dev server. Navigate to http://localhost

John Gualteros 1 Oct 2, 2022
Piccloud is a full-stack (Angular & Spring Boot) online image clipboard that lets you share images over the internet by generating a unique URL. Others can access the image via this URL.

Piccloud Piccloud is a full-stack application built with Angular & Spring Boot. It is an online image clipboard that lets you share images over the in

Olayinka Atobiloye 3 Dec 15, 2022
JQuery charCounter - jQuery Character Counter Plugin

jQuery Character Counter A jQuery based character counter for <input> and <textarea> HTML tags. What is this? This simple plugin allows you to add a c

mmmm_lemon 1 Aug 10, 2022
Jquery-actualizer - jQuery ajax actualizer

jQuery AJAX Actualizer Include jQuery & this plugin into your HTML file and use this js code: $('#target').actualizer('a'); On click at any A element,

Šimon (Simon) Rataj 1 Jul 28, 2020
jQuery quick notification plugin. jQuery плагин быстрых уведомлений

Note: English translation by Google Translate Notific About Description: this is a jQuery plugin that helps you display notifications on your site. Li

Webarion 2 Nov 7, 2021
jquery-input-mask-phone-number.js - A simple, easy jquery format phone number mask library

jquery-input-mask-phone-number A jQuery Plugin to make masks on input field to US phone format. Quick start 1. Add latest jQuery and jquery-input-mask

Raja Rama Mohan Thavalam 12 Aug 25, 2022
Examples of how to do query, style, dom, ajax, event etc like jQuery with plain javascript.

You (Might) Don't Need jQuery Frontend environments evolve rapidly nowadays and modern browsers have already implemented a great deal of DOM/BOM APIs

NEFE 20.3k Dec 24, 2022