-
Notifications
You must be signed in to change notification settings - Fork 0
/
example-usage.html
78 lines (72 loc) · 5.53 KB
/
example-usage.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>CopyWithQ, Automatic Quotes!</title>
<!-- no more jQuery -->
<style>
:target {
border: 1px solid red;
}
</style>
</head>
<body class="vscode-body vscode-light">
<article>
<h1 id="copywithq">CopyWithQ</h1>
<p><strong>Automatic Quotes</strong></p>
<p>Simple javascript for automatic citation creation.
When use selects a part of the text, and copy it in the usual way
(both the shortcut Ctrl + c works and the use of the context menu called up by the right mouse button, the citation is automatically added to the copied text.
Just vanilla javascript. Example html included in repo.</p>
<p>It creates 3 different data types (depends on <code>settings</code>) in clipboard. Plain text, HTML snippet and single link. Snippets are used by data type when pasting (CTRL + V) the data. For example pasting in <code>notepad</code> it places plain text, when pasting in Word or <a href="https://docs.google.com/document/">Google Docs</a> it places rich html snippet.</p>
<h2 id="whats-new-in-version-21">What's new in version 2.1</h2>
<ul>
<li>Script settings by json file</li>
<li>In text snippet (mime type 'text/plain') there will be author name instead of author URL</li>
<li>Automatic author select from HTML by list of possible selectors</li>
</ul>
<p>(older news 2.0)</p>
<ul>
<li>Removed jQuery dependency. Away with jQuery!</li>
<li>Added Scroll-to-text Fragment feature (<a href="https://caniuse.com/#feat=url-scroll-to-text-fragment">support in Chrome, Edge and Opera only</a>)</li>
<li>Ability to get a link with the selected part of the text by selecting the text and using the keyboard shortcut CTRL + SHIFT + L</li>
</ul>
<h2 id="use">Use</h2>
<p>Paste the script file anywhere in the page, like any regular <code>javascript</code> module</p>
<pre><code class="language-html"><div><span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"/copyWithQ.mjs?v2.1"</span> <span class="hljs-attr">crossorigin</span>=<span class="hljs-string">"anonymous"</span> <span class="hljs-attr">integrity</span>=<span class="hljs-string">"sha256-RIEMQiYzOgrZLW3qG1Zr/dxDKkp+j83lz2DMnOUzxhs="</span>></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span>
</div></code></pre>
<p>And that's all, now will be everything works with default settings.</p>
<p>But if you want to change settings this can be done by inline json file like this:</p>
<pre><code class="language-html">
<span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text/json"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"copy-with-q-settings"</span>></span><span class="javascript">
{
<span class="hljs-string">"author"</span>: <span class="hljs-string">"John Doe"</span>,
<span class="hljs-string">"autoQuotesMinLength"</span>: <span class="hljs-number">240</span>,
<span class="hljs-string">"modulesImportPath"</span>: <span class="hljs-string">"/modules"</span>
}
</span><span class="hljs-tag"></<span class="hljs-name">script</span>></span>
<span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"/copyWithQ.mjs?v2.1"</span> <span class="hljs-attr">crossorigin</span>=<span class="hljs-string">"anonymous"</span> <span class="hljs-attr">integrity</span>=<span class="hljs-string">"sha256-RIEMQiYzOgrZLW3qG1Zr/dxDKkp+j83lz2DMnOUzxhs="</span>></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span>
</code></pre>
<h3 id="a-simple-example-of-usage-is-in-the-example-usagehtml-file">a simple example of usage is in the <code>example-usage.html</code> file</h3>
<h1 id="possible-problems">Possible problems?</h1>
<p>The mjs extension must have the correct mime type set to <code>text/javascript</code>, if it is too laborious, rename the suffix from <code>.mjs</code> to <code>.js</code>.</p>
<h2 id="services">Services</h2>
<p>Unpkg: <a href="https://unpkg.com/copywithq-automatic-quotes">https://unpkg.com/copywithq-automatic-quotes</a></p>
<p>NPM: <a href="https://www.npmjs.com/package/copywithq-automatic-quotes">https://www.npmjs.com/package/copywithq-automatic-quotes</a></p>
<h1 id="licence">Licence</h1>
<p><strong>CC BY-SA 4.0</strong></p>
<p>This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit <a href="http://creativecommons.org/licenses/by-sa/4.0/">http://creativecommons.org/licenses/by-sa/4.0/</a> or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.</p>
<hr>
<p>More info at <a href="https://iiic.dev/copywithq-automatic-quotes">https://iiic.dev/copywithq-automatic-quotes</a></p>
<a href="https://iiic.dev" class="p-author">Michal (example author name)</a>
</article>
<script type="text/json" id="copy-with-q-settings">
{
"author": "John Doe",
"autoQuotesMinLength": 40,
"modulesImportPath": "/modules"
}
</script>
<script type="module" src="/copyWithQ.mjs?v2.1" crossorigin="anonymous" integrity="sha256-RIEMQiYzOgrZLW3qG1Zr/dxDKkp+j83lz2DMnOUzxhs="></script>
</body>
</html>