20 Commits
plugin ... v1.7

Author SHA1 Message Date
Tom Slominski
676c7ef3d7 Update README.md 2016-07-24 18:16:51 +01:00
Tom Slominski
9613cf1495 Admin link by default 2016-07-24 17:41:43 +01:00
Tom Slominski
f51a02c4d7 Oops, broke the transitions. 2016-07-24 17:27:25 +01:00
Tom Slominski
46b6e2c640 Fix for the last commit... 2016-07-24 17:25:48 +01:00
Tom Slominski
450de0ebf4 Replace ZeroClipboard with clipboard.js. Fixes #32. 2016-07-24 17:25:25 +01:00
Tom Slominski
fa5bd1b253 Form improvements.
Disable agressive URL validation on Chrome and make sure the fields work well on iOS Safari.
2016-07-24 13:25:57 +01:00
Tom Slominski
87fda22462 More error checking when shortening URLs. Fixes #23. 2016-07-24 13:08:48 +01:00
Tom Slominski
1f7ae5122e Dependency fixes. 2016-07-24 13:02:49 +01:00
Tom Slominski
94fa2a3285 Bugfixes. 2016-07-24 12:42:10 +01:00
Tom Slominski
d6e0a6548d WebKit animation fix. 2016-07-24 12:19:50 +01:00
Tom Slominski
859a7da47b Compress VK icon. 2016-07-24 11:50:31 +01:00
Tom Slominski
0b6635eaba Improved and compressed logo.
Included the Sketch file for future use as it imports the SVG badly.
2016-07-24 11:47:20 +01:00
Tom Slominski
acaa4175f0 Merge pull request #34 from Lord-Protector/master
VK sharing support and Google+ fix
2016-07-24 10:43:35 +01:00
Савелий Красовский
223cad80a2 VK sharing support + LinkedIn fix. 2016-07-17 23:52:43 +03:00
Tom Slominski
b0d3001712 Merge pull request #30 from LordBeaver/patch-1
Compatibility with YOURLS 1.7.1
2016-04-16 17:31:30 +01:00
LordBeaver
dd43de1246 Compatibility with YOURLS 1.7.1 2016-04-09 17:46:20 +03:00
Tom Slominski
ad89f9ff71 Change the QR code to link to the short URL instead of the long one. Fixes #24. 2016-01-04 00:46:42 +00:00
Tom Slominski
1121e81a1d Fixes #21 2015-08-21 20:13:49 +01:00
Tom Slominski
ef4cf86ebe Fixes #19 2015-08-20 13:09:56 +01:00
Tom Slominski
ff668004dd Fixes #18 2015-08-19 13:02:22 +01:00
16 changed files with 254 additions and 176 deletions

View File

@@ -1,6 +1,8 @@
Infinity Squared Infinity Squared
================ ================
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/tomslominski)
A beautiful public page theme for YOURLS, carefully crafted by [Tom Slominski](http://tomslominski.net/). It can be used to give the public access to your short domain, not just registered users. A beautiful public page theme for YOURLS, carefully crafted by [Tom Slominski](http://tomslominski.net/). It can be used to give the public access to your short domain, not just registered users.
![Front page of Infinity Squared 2.0](http://i.imgur.com/Wc1cVRF.png) ![Front page of Infinity Squared 2.0](http://i.imgur.com/Wc1cVRF.png)
@@ -53,3 +55,11 @@ Licensing
Just like YOURLS, Infinity Squared is licensed under the MIT license. Basically, you can do whatever you want with it as long as you give attribution wherever you use it. There is no guarantee that this software will work. Just like YOURLS, Infinity Squared is licensed under the MIT license. Basically, you can do whatever you want with it as long as you give attribution wherever you use it. There is no guarantee that this software will work.
You can find the full license in the root directory of Infinity Squared, under LICENSE.md. You can find the full license in the root directory of Infinity Squared, under LICENSE.md.
Clipboard.js is also licensed under the MIT license.
Donations
---------
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/tomslominski)
Even though Infinity Squared is free, it takes time to build, so I'm more than happy to accept donations at the above link. Thanks!

View File

@@ -18,35 +18,16 @@
</div> </div>
</div> </div>
<?php if ( in_array( 'ZeroClipboard', $dependencies ) ) { ?> <?php global $dependencies; ?>
<!-- ZeroClipboard is MIT licensed -->
<script type="text/javascript" src="public/ZeroClipboard/ZeroClipboard.min.js"></script>
<script>
ZeroClipboard.config({
swfPath: "public/ZeroClipboard/ZeroClipboard.swf"
});
var clipboardClient = new ZeroClipboard( document.getElementsByClassName("copy-button") ); <?php if ( in_array( 'clipboard.js', $dependencies ) ) { ?>
<script src="public/js/clipboard.min.js"></script>
var copied = "<?php yourls_e( 'Copied!', 'isq_translation'); ?>"; <script src="public/js/app.js"></script>
clipboardClient.on( 'aftercopy', function(event) {
event.target.innerHTML = copied;
} );
</script>
<?php } <?php }
if ( in_array( 'reCAPTCHA', $dependencies ) ) { ?> if ( in_array( 'reCAPTCHA', $dependencies ) ) { ?>
<script src='https://www.google.com/recaptcha/api.js'></script> <script src="https://www.google.com/recaptcha/api.js"></script>
<?php } ?> <?php } ?>
<!-- Delay loading of transitions until page is fully loaded -->
<script>
window.addEventListener('load',function load() {
window.removeEventListener('load', load, false);
document.body.classList.remove('load');
},false);
</script>
</body> </body>
</html> </html>

View File

@@ -12,8 +12,11 @@ if( @include dirname(__FILE__) . '/public/config.php' ) {
class ISQ { public static $general = array(), $links = array(), $social = array(), $recaptcha = array(); } class ISQ { public static $general = array(), $links = array(), $social = array(), $recaptcha = array(); }
// Default dependencies
$dependencies = array();
// Load translations // Load translations
yourls_load_custom_textdomain( 'isq_translation', '/public/languages' ); yourls_load_custom_textdomain( 'isq_translation', 'public/languages' );
?> ?>
<html> <html>

View File

@@ -6,9 +6,9 @@ $title = isset( $_REQUEST['title'] ) ? yourls_sanitize_title( $_REQUEST['title
?> ?>
<div class="content"> <div class="content index">
<h2><?php yourls_e( 'Enter a new URL to shorten', 'isq_translation'); ?></h2> <h2><?php yourls_e( 'Enter a new URL to shorten', 'isq_translation'); ?></h2>
<form method="post" action="result.php" class="newurl"> <form method="post" action="result.php" class="newurl" novalidate>
<div class="form-item full-width"> <div class="form-item full-width">
<p><label for="url" class="primary"><?php yourls_e( 'Long URL', 'isq_translation'); ?></label></p> <p><label for="url" class="primary"><?php yourls_e( 'Long URL', 'isq_translation'); ?></label></p>
<p><label for="url" class="secondary"><?php yourls_e( 'Paste the long URL here. This is required.', 'isq_translation'); ?></label></p> <p><label for="url" class="secondary"><?php yourls_e( 'Paste the long URL here. This is required.', 'isq_translation'); ?></label></p>
@@ -16,23 +16,21 @@ $title = isset( $_REQUEST['title'] ) ? yourls_sanitize_title( $_REQUEST['title
</div> </div>
<div class="halves"> <div class="halves">
<div class="form-item half-width left">
<p><label for="keyword" class="primary"><?php yourls_e( 'Custom keyword', 'isq_translation'); ?></label></p>
<p><label for="keyword" class="secondary"><?php yourls_e( 'A keyword replaces the default short string.', 'isq_translation'); ?></label></p>
<input type="text" id="keyword" name="keyword" autocorrect="off" autocapitalize="none" value="<?php echo($keyword); ?>">
</div>
<div class="form-item half-width left"> <div class="form-item half-width right">
<p><label for="keyword" class="primary"><?php yourls_e( 'Custom keyword', 'isq_translation'); ?></label></p> <p><label for="title" class="primary"><?php yourls_e( 'Custom title', 'isq_translation'); ?></label></p>
<p><label for="keyword" class="secondary"><?php yourls_e( 'A keyword replaces the default short string.', 'isq_translation'); ?></label></p> <p><label for="title" class="secondary"><?php yourls_e( 'Optional title used when sharing a link from YOURLS using social sharers.', 'isq_translation'); ?></label></p>
<input type="text" id="keyword" name="keyword" value="<?php echo($keyword); ?>"> <input type="text" id="title" name="title" value="<?php echo($title); ?>">
</div> </div>
<div class="form-item half-width right">
<p><label for="title" class="primary"><?php yourls_e( 'Custom title', 'isq_translation'); ?></label></p>
<p><label for="title" class="secondary"><?php yourls_e( 'Optional title used when sharing a link from YOURLS using social sharers.', 'isq_translation'); ?></label></p>
<input type="text" id="title" name="title" value="<?php echo($title); ?>">
</div>
</div> </div>
<?php <?php
if ( yourls_is_valid_user() == 1 ) { if ( function_exists( 'yourls_is_valid_user' ) && yourls_is_valid_user() == 1 ) {
echo '<input type="hidden" name="antispam_method" value="user_login" class="hidden">'; echo '<input type="hidden" name="antispam_method" value="user_login" class="hidden">';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -8,7 +8,6 @@
ISQ::$general = array( ISQ::$general = array(
'name' => 'URL shortener', // The name of your URL shortener 'name' => 'URL shortener', // The name of your URL shortener
'qr' => TRUE, // Do you want to display a QR code? 'qr' => TRUE, // Do you want to display a QR code?
'clipboard' => 1, // Do you want to enable zeroClipboard? (uses flash)
'customstyle' => TRUE // Do you want to enable the custom stylesheet, found in public/custom.css? 'customstyle' => TRUE // Do you want to enable the custom stylesheet, found in public/custom.css?
); );
@@ -24,8 +23,12 @@ ISQ::$links = array(
'link' => 'http://tomslominski.net/' 'link' => 'http://tomslominski.net/'
), ),
array( array(
'name' => 'Get ∞²!', 'name' => yourls__( 'Get ∞²!', 'isq_translation' ),
'link' => 'https://github.com/tomslominski/infinity-squared/' 'link' => 'https://github.com/tomslominski/infinity-squared/'
),
array(
'name' => yourls__( 'Admin area', 'isq_translation' ),
'link' => YOURLS_SITE . '/admin/'
) )
); );
@@ -36,7 +39,8 @@ ISQ::$social = array(
'facebook' => TRUE, 'facebook' => TRUE,
'linkedin' => TRUE, 'linkedin' => TRUE,
'tumblr' => TRUE, 'tumblr' => TRUE,
'googleplus' => TRUE 'googleplus' => TRUE,
'vk' => TRUE,
); );
// reCAPTCHA API KEYS // reCAPTCHA API KEYS

12
public/images/clippy.svg Executable file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="14px" height="16px" viewBox="0 0 14 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->
<title>clippy</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Octicons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="clippy" fill="#000000">
<path d="M2,13 L6,13 L6,14 L2,14 L2,13 L2,13 Z M7,7 L2,7 L2,8 L7,8 L7,7 L7,7 Z M9,10 L9,8 L6,11 L9,14 L9,12 L14,12 L14,10 L9,10 L9,10 Z M4.5,9 L2,9 L2,10 L4.5,10 L4.5,9 L4.5,9 Z M2,12 L4.5,12 L4.5,11 L2,11 L2,12 L2,12 Z M11,13 L12,13 L12,15 C11.98,15.28 11.89,15.52 11.7,15.7 C11.51,15.88 11.28,15.98 11,16 L1,16 C0.45,16 0,15.55 0,15 L0,4 C0,3.45 0.45,3 1,3 L4,3 C4,1.89 4.89,1 6,1 C7.11,1 8,1.89 8,3 L11,3 C11.55,3 12,3.45 12,4 L12,9 L11,9 L11,6 L1,6 L1,15 L11,15 L11,13 L11,13 Z M2,5 L10,5 C10,4.45 9.55,4 9,4 L8,4 C7.45,4 7,3.55 7,3 C7,2.45 6.55,2 6,2 C5.45,2 5,2.45 5,3 C5,3.55 4.55,4 4,4 L3,4 C2.45,4 2,4.45 2,5 L2,5 Z" id="Shape"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
public/images/logo.sketch Normal file

Binary file not shown.

View File

@@ -1,24 +1 @@
<?xml version="1.0" encoding="utf-8"?> <svg width="868" height="330" viewBox="0 0 868 330" xmlns="http://www.w3.org/2000/svg"><title>logo 2</title><g stroke="#000" fill="none" fill-rule="evenodd"><path d="M395 243c4.1.5 12.9 1.6 17.2 1.6 55.1 0 96-34.5 111.8-79.6-13.6-11.5-22.7-20-39-25-5.6 32-36.7 57-72 57-7.9 0-15.3-1.2-22.5-3.4" stroke-width="17.01"/><path d="M343.9 166.5c-14.6-12.4-27.9-26.7-41-38.8-.8-.7-.8-1.9-.1-2.7 29.9-30.7 65.9-68.4 110.4-68.4 24.9 0 45.6 12.1 57.2 31.4 21.7 2.5 41.3 11.3 59.3 23.3C523.4 51.1 478.8 9 416.5 9 353 9 311.2 52.5 271.2 92.5c-.7.7-1.9.7-2.7 0-37.7-37.8-81-83.5-139-83.5C59.8 9 9 63.7 9 126.4c0 68.2 47.6 117.3 114.1 117.3 63.5 0 105.3-43.4 145.3-83.5.7-.7 1.9-.7 2.7 0 20.3 20.3 42.2 42.9 67.1 59.5m-101.4-92c-29.9 30.7-65.9 68.4-110.4 68.4-38.8 0-67.4-29.3-67.4-69.8 0-37.3 30.1-69.8 69.8-69.8 45.3 0 77.5 40 108 68.4.7.9.7 2.1 0 2.8z" stroke-width="16.075"/><path d="M473 87.3c-4.1-.5-10.8 0-15.1 0-55.1 0-99.2 32.6-114.9 77.7 13 13 29 23 45.4 27.8 5.6-32 33.4-57.9 68.7-57.9 7.9 0 15.3 1.2 22.5 3.4" stroke-width="17.01"/><path d="M524.1 164.4c14.6 12.4 27.9 26.7 41 38.8.8.7.8 1.9.1 2.7-29.9 30.7-65.9 68.4-110.4 68.4-24.9 0-45.6-12.1-57.2-31.4-21.7-2.5-41.3-11.3-59.3-23.3 6.5 60.2 51.8 102.2 113.3 102.2 63.5 0 105.3-43.4 145.3-83.5.7-.7 1.9-.7 2.7 0 37.7 37.8 81 83.5 139 83.5 69.8 0 120.5-54.7 120.5-117.3 0-68.2-46.8-117.3-114.1-117.3-63.5 0-105.3 43.4-145.3 83.5-.7.7-1.9.7-2.7 0-20.3-20.3-42.2-42.9-67.1-59.5m209.4 163.2c-45.3 0-77.5-40-108-68.4-.8-.7-.8-1.9-.1-2.7 29.9-30.7 65.9-68.4 110.4-68.4 38.8 0 67.4 29.3 67.4 69.8.1 37.2-30 69.7-69.7 69.7z" stroke-width="16.075"/></g></svg>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 866.1 328.9" enable-background="new 0 0 866.1 328.9" xml:space="preserve">
<g>
<path fill="none" stroke="#000000" stroke-width="17.0104" stroke-miterlimit="10" d="M396.6,241.9c4.1,0.5,8.3,0.7,12.6,0.7
c55.1,0,98.2-34.1,114-79.2c-13.6-11.5-28.2-21.3-44.5-26.3c-5.6,32-33.4,57.9-68.7,57.9c-7.9,0-15.3-1.2-22.5-3.4"/>
<path fill="none" stroke="#000000" stroke-width="16.0752" stroke-miterlimit="10" d="M342.9,165.5c-14.6-12.4-27.9-26.7-41-38.8
c-0.8-0.7-0.8-1.9-0.1-2.7c29.9-30.7,65.9-68.4,110.4-68.4c24.9,0,45.6,12.1,57.2,31.4c21.7,2.5,41.3,11.3,59.3,23.3
C522.4,50.1,477.8,8,415.5,8C352,8,310.2,51.5,270.2,91.5c-0.7,0.7-1.9,0.7-2.7,0C229.8,53.7,186.5,8,128.5,8
C58.8,8,8,62.7,8,125.4c0,68.2,47.6,117.3,114.1,117.3c63.5,0,105.3-43.4,145.3-83.5c0.7-0.7,1.9-0.7,2.7,0
c20.3,20.3,42.2,42.9,67.1,59.5 M235.8,126.7c-29.9,30.7-65.9,68.4-110.4,68.4c-38.8,0-67.4-29.3-67.4-69.8
c0-37.3,30.1-69.8,69.8-69.8c45.3,0,77.5,40,108,68.4C236.5,124.8,236.5,126,235.8,126.7z"/>
<path fill="none" stroke="#000000" stroke-width="17.0104" stroke-miterlimit="10" d="M469.5,87c-4.1-0.5-8.3-0.7-12.6-0.7
c-55.1,0-98.3,34.1-114,79.2c13.6,11.5,28.2,21.3,44.5,26.3c5.6-32,33.4-57.9,68.7-57.9c7.9,0,15.3,1.2,22.5,3.4"/>
<path fill="none" stroke="#000000" stroke-width="16.0752" stroke-miterlimit="10" d="M523.1,163.4c14.6,12.4,27.9,26.7,41,38.8
c0.8,0.7,0.8,1.9,0.1,2.7c-29.9,30.7-65.9,68.4-110.4,68.4c-24.9,0-45.6-12.1-57.2-31.4c-21.7-2.5-41.3-11.3-59.3-23.3
c6.5,60.2,51.8,102.2,113.3,102.2c63.5,0,105.3-43.4,145.3-83.5c0.7-0.7,1.9-0.7,2.7,0c37.7,37.8,81,83.5,139,83.5
c69.8,0,120.5-54.7,120.5-117.3c0-68.2-46.8-117.3-114.1-117.3c-63.5,0-105.3,43.4-145.3,83.5c-0.7,0.7-1.9,0.7-2.7,0
c-20.3-20.3-42.2-42.9-67.1-59.5 M738.3,273.4c-45.3,0-77.5-40-108-68.4c-0.8-0.7-0.8-1.9-0.1-2.7c29.9-30.7,65.9-68.4,110.4-68.4
c38.8,0,67.4,29.3,67.4,69.8C808.1,240.9,778,273.4,738.3,273.4z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

1
public/images/vk.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="548.358" height="548.358" viewBox="0 0 548.358 548.358"><path d="M545.45 400.298c-.663-1.43-1.282-2.618-1.857-3.57-9.514-17.134-27.695-38.166-54.532-63.1l-.566-.572-.284-.28-.287-.287h-.288c-12.18-11.612-19.893-19.42-23.123-23.416-5.91-7.614-7.234-15.32-4.004-23.13 2.282-5.9 10.854-18.36 25.696-37.397 7.807-10.09 13.99-18.175 18.556-24.267 32.93-43.78 47.208-71.756 42.828-83.94l-1.7-2.846c-1.144-1.714-4.094-3.282-8.847-4.712-4.763-1.427-10.852-1.663-18.277-.712l-82.224.568c-1.333-.472-3.235-.428-5.713.144-2.475.572-3.713.86-3.713.86l-1.43.714-1.137.86c-.952.567-2 1.566-3.142 2.994-1.137 1.423-2.088 3.093-2.848 4.996-8.952 23.03-19.13 44.444-30.553 64.238-7.043 11.803-13.51 22.032-19.418 30.693-5.9 8.658-10.848 15.037-14.842 19.126-4 4.093-7.61 7.372-10.852 9.85-3.237 2.477-5.708 3.524-7.42 3.14-1.714-.382-3.33-.762-4.858-1.142-2.663-1.713-4.805-4.044-6.42-6.994-1.622-2.95-2.714-6.663-3.285-11.136-.57-4.476-.905-8.326-1-11.563-.09-3.233-.05-7.806.144-13.706.198-5.902.287-9.896.287-11.99 0-7.234.142-15.085.425-23.555.288-8.47.52-15.18.716-20.125.195-4.95.285-10.185.285-15.705s-.336-9.85-1-12.99c-.656-3.14-1.663-6.185-2.99-9.138-1.335-2.95-3.29-5.232-5.853-6.852-2.57-1.618-5.763-2.902-9.564-3.856-10.09-2.284-22.936-3.52-38.547-3.71-35.4-.38-58.147 1.905-68.235 6.854-3.997 2.09-7.614 4.948-10.848 8.562-3.427 4.19-3.905 6.475-1.43 6.85 11.42 1.712 19.507 5.805 24.266 12.276l1.715 3.43c1.334 2.473 2.666 6.853 4 13.133 1.33 6.28 2.19 13.227 2.567 20.837.95 13.897.95 25.793 0 35.69-.953 9.9-1.853 17.606-2.712 23.126-.86 5.52-2.143 9.993-3.855 13.418-1.715 3.426-2.856 5.52-3.428 6.28-.57.76-1.047 1.24-1.425 1.427-2.474.948-5.047 1.43-7.71 1.43-2.667 0-5.9-1.333-9.707-4-3.805-2.665-7.754-6.327-11.847-10.99-4.092-4.666-8.708-11.185-13.85-19.56-5.136-8.373-10.466-18.27-15.986-29.69l-4.567-8.282c-2.855-5.327-6.755-13.085-11.704-23.266-4.952-10.185-9.33-20.037-13.134-29.554-1.522-3.997-3.807-7.04-6.852-9.134l-1.43-.86c-.95-.76-2.474-1.566-4.566-2.426-2.095-.86-4.28-1.475-6.567-1.854l-78.23.568c-7.993 0-13.417 1.81-16.273 5.428l-1.143 1.71c-.572.954-.86 2.476-.86 4.57 0 2.095.57 4.665 1.714 7.708 11.42 26.84 23.84 52.725 37.257 77.66 13.42 24.933 25.08 45.018 34.974 60.236 9.897 15.23 19.985 29.602 30.264 43.112 10.28 13.515 17.083 22.176 20.412 25.98 3.333 3.813 5.95 6.663 7.854 8.566l7.14 6.85c4.567 4.57 11.275 10.042 20.126 16.417 8.853 6.38 18.654 12.66 29.408 18.85 10.756 6.182 23.27 11.226 37.546 15.127 14.275 3.905 28.17 5.472 41.684 4.716h32.834c6.66-.575 11.704-2.67 15.133-6.283l1.136-1.43c.765-1.137 1.48-2.902 2.14-5.277.668-2.38 1-5 1-7.85-.195-8.184.428-15.56 1.852-22.125 1.423-6.564 3.045-11.513 4.86-14.846 1.812-3.33 3.858-6.14 6.135-8.418 2.282-2.283 3.908-3.666 4.862-4.142.947-.48 1.704-.804 2.275-1 4.568-1.52 9.944-.047 16.136 4.43 6.188 4.473 11.99 9.996 17.42 16.56 5.424 6.57 11.942 13.94 19.554 22.124 7.617 8.186 14.277 14.27 19.985 18.274l5.707 3.426c3.812 2.286 8.76 4.38 14.853 6.283 6.08 1.9 11.41 2.377 15.984 1.426l73.087-1.14c7.23 0 12.855-1.197 16.845-3.572 3.998-2.38 6.373-5 7.14-7.85.763-2.855.804-6.093.144-9.713-.678-3.61-1.345-6.135-2.01-7.562z"/></svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

50
public/js/app.js Normal file
View File

@@ -0,0 +1,50 @@
function filterNodeListById( nodeList, id ) {
var elements = Array.prototype.slice.call( nodeList );
for (var i = elements.length - 1; i >= 0; i--) {
if( elements[i].id == id ) {
return elements[i];
}
}
}
// Clipboard.js
if( document.querySelectorAll( '.copy-button' ).length > 0 ) {
var clipboard = new Clipboard( '.copy-button' );
var clipboardTimeout = 2000;
clipboard.on( 'success', function( event ) {
var errorElement = filterNodeListById( event.trigger.parentNode.childNodes, 'copy-success' );
errorElement.className += " visible";
window.setTimeout( function() {
errorElement.className = errorElement.className.replace(/\bvisible\b/,'');
}, clipboardTimeout );
} );
clipboard.on( 'error', function( event ) {
var errorElement = filterNodeListById( event.trigger.parentNode.childNodes, 'copy-error' );
var osClass;
if( /iPhone|iPad/i.test(navigator.userAgent) ) {
osClass = 'mobile';
} else if ( /Mac/i.test(navigator.userAgent) ) {
osClass = 'macos';
} else if ( /Windows/i.test(navigator.userAgent) || /X11/i.test(navigator.userAgent) ) {
osClass = 'pc';
} else {
osClass = 'other';
}
errorElement.className += " visible " + osClass;
window.setTimeout( function() {
errorElement.className = errorElement.className.replace(/\bvisible\b/,'');
}, clipboardTimeout );
} );
}

7
public/js/clipboard.min.js vendored Executable file

File diff suppressed because one or more lines are too long

View File

@@ -32,23 +32,6 @@ body, input {
color: #FFF; color: #FFF;
} }
.desktop-only {
display: none;
}
@media screen and (min-width: 1024px) {
.desktop-only {
display: inline-block;
}
}
.load * {
-webkit-transition: none !important;
-moz-transition: none !important;
-ms-transition: none !important;
-o-transition: none !important;
}
/* Structure and global design */ /* Structure and global design */
a, a:visited { a, a:visited {
color: #013F6D; color: #013F6D;
@@ -200,6 +183,7 @@ input:not([type=submit]):not([type=file]) {
transition: box-shadow 0.5s, border 0.5s; transition: box-shadow 0.5s, border 0.5s;
-webkit-appearance: none; -webkit-appearance: none;
border-radius: 0; border-radius: 0;
height: 45px;
} }
.g-recaptcha { .g-recaptcha {
@@ -232,7 +216,7 @@ input[type=submit] {
display: inline-block; display: inline-block;
} }
.button:hover, .zeroclipboard-is-hover { .button:hover {
background: #E2E2E2; background: #E2E2E2;
} }
@@ -253,12 +237,62 @@ input[type=submit] {
font-weight: bold; font-weight: bold;
} }
.copy-button { .input-with-copy {
margin-top: 2px; position: relative;
} }
.copy-button:focus { .input-with-copy input:not([type=submit]):not([type=file]) {
outline: none; width: calc( 100% - 45px );
}
.input-with-copy .copy-button {
position: absolute;
right: 0;
top: 5px;
height: 45px;
width: 45px;
border-left: 0;
}
.copy-message {
position: absolute;
top: 6px;
left: 1px;
height: 43px;
line-height: 43px;
width: calc( 100% - 47px );
text-align: center;
background: rgba(0, 0, 0, 0.7);
transition: opacity 0.3s, visibility 0.3s;
color: white;
opacity: 0;
visibility: hidden;
-webkit-transform: translate3d(0, 0, 0); // WebKit animation fix
}
.copy-message.visible {
opacity: 1;
visibility: visible;
}
.copy-message .os {
display: none;
}
.copy-message.error.macos .macos {
display: block;
}
.copy-message.error.pc .pc {
display: block;
}
.copy-message.error.mobile .mobile {
display: block;
}
.copy-message.error.other .other {
display: block;
} }
.social-button { .social-button {
@@ -267,6 +301,7 @@ input[type=submit] {
font-size: 0; font-size: 0;
margin-right: 2px; margin-right: 2px;
transition: opacity 0.5s; transition: opacity 0.5s;
-webkit-transform: translate3d(0, 0, 0); // WebKit animation fix
} }
.social-button:hover { .social-button:hover {
@@ -304,6 +339,10 @@ input[type=submit] {
background-color: #DD4B39; background-color: #DD4B39;
} }
.social-button.vk {
background-color: #4D7198;
}
svg#url-qr-code { svg#url-qr-code {
width: 50%; width: 50%;
height: 50%; height: 50%;
@@ -363,33 +402,16 @@ a.icon-github:hover {
} }
/* Mobile */ /* Mobile */
/*@media screen and (max-width: 720px) { @media screen and (max-width: 720px) {
body { .halves {
background:white; display: block;
margin:0; }
}
#container { .half-width {
min-width:0; width: 100%;
width:100%; }
margin:0;
padding:0;
} }
header {
width:100%;
padding:0;
}
.menu li {
margin-top:0;
}
.desktop-only, .zclip {
display:none;
}
}*/
/* Error page */ /* Error page */
#wrap > h1 > a { #wrap > h1 > a {
display: none; display: none;

View File

@@ -1,21 +1,17 @@
<?php <?php
$dependencies = array();
include('header.php'); include('header.php');
if ( ISQ::$general['clipboard'] ) { function display_error( $message, $action = null ) {
$dependencies[] = 'ZeroClipboard';
};
function display_error( $message, $action ) {
echo '<div class="content error">'; echo '<div class="content error">';
echo '<p class="message">' . $message . '</p>'; echo '<p class="message">' . $message . '</p>';
if( !empty( $action ) ) { echo '<p class="action">';
echo $action; if( !empty( $action ) ) {
} else { echo $action;
echo '<p class="action"><a href="javascript:history.go(-1)" class="button">' . yourls__( '&larr; Go back and try again', 'isq_translation' ) . '</a></p>'; } else {
} echo '<a href="' . YOURLS_SITE . '" class="button">' . yourls__( '&larr; Go home and try again', 'isq_translation' ) . '</a>';
}
echo '</p>';
echo '</div>'; echo '</div>';
include('footer.php'); include('footer.php');
@@ -26,17 +22,16 @@ if ( empty( $_REQUEST['url'] ) ) {
display_error( yourls__( 'You haven\'t entered a URL to shorten.', 'isq_translation' ) ); display_error( yourls__( 'You haven\'t entered a URL to shorten.', 'isq_translation' ) );
}; };
if ( !yourls_keyword_is_reserved( $_REQUEST['keyword'] ) ) { // Check if the keyword is reserved
if ( !empty( $_REQUEST['keyword'] ) && yourls_keyword_is_reserved( $_REQUEST['keyword'] ) ) {
display_error( sprintf( yourls__( 'The keyword %1$s is reserved.'), '<span class="key">' . $_REQUEST['keyword'] . '</span>' ) ); display_error( sprintf( yourls__( 'The keyword %1$s is reserved.'), '<span class="key">' . $_REQUEST['keyword'] . '</span>' ) );
} }
if( function_exists( 'advanced_reserved_urls' ) ) { // Check if the keyword is taken
if ( advanced_reserved_urls( $_REQUEST['keyword'] ) ) { if ( !empty( $_REQUEST['keyword'] ) && yourls_keyword_is_taken( $_REQUEST['keyword'] ) ) {
display_error( sprintf( yourls__( 'The keyword %1$s is restricted.'), '<span class="key">' . $_REQUEST['keyword'] . '</span>' ) ); display_error( sprintf( yourls__( 'The keyword %1$s is taken.'), '<span class="key">' . $_REQUEST['keyword'] . '</span>' ) );
}
} }
// Check what CAPTCHA method was used // Check what CAPTCHA method was used
$antispam_method = $_REQUEST['antispam_method']; $antispam_method = $_REQUEST['antispam_method'];
@@ -84,27 +79,21 @@ $message = isset( $return['message'] ) ? $return['message'] : '';
$title = isset( $return['title'] ) ? $return['title'] : ''; $title = isset( $return['title'] ) ? $return['title'] : '';
$status = isset( $return['status'] ) ? $return['status'] : ''; $status = isset( $return['status'] ) ? $return['status'] : '';
// Check for all other errors
if( empty( $shorturl ) ) {
display_error( yourls__( 'The URL could not be shortened.', 'isq_translation' ) );
}
// URL encoded links used in the social sharing buttons // URL encoded links used in the social sharing buttons
$encoded_shorturl = urlencode($shorturl); $encoded_shorturl = urlencode($shorturl);
$encoded_title = urlencode($title); $encoded_title = urlencode($title);
// QR code shenanigans // Add dependencies
if ( ISQ::$general['qr'] ) { $dependencies[] = 'clipboard.js';
// PHP QR Code is LGPL licensed
include('public/phpqrcode/qrlib.php');
$qrContainerId = 'url-qr-code';
$saveToFile = false;
$imageWidth = 600; // in pixels
$qrCode = QRcode::svg($url, $qrContainerId, $saveToFile, QR_ECLEVEL_L, $imageWidth);
};
?> ?>
<div class="content"> <div class="content result">
<!-- Error reporting --> <!-- Error reporting -->
<?php isset( $error ) ? $error : ''; ?> <?php isset( $error ) ? $error : ''; ?>
@@ -114,27 +103,50 @@ if ( ISQ::$general['qr'] ) {
<div class="output"> <div class="output">
<div class="form-item full-width"> <div class="form-item full-width">
<label for="longurl" class="primary"><?php yourls_e( 'Original URL', 'isq_translation'); ?></label> <label for="longurl" class="primary"><?php yourls_e( 'Original URL', 'isq_translation'); ?></label>
<input type="text" name="longurl" id="longurl" onclick="this.select();" onload="this.select();" value="<?php echo $url; ?>"> <div class="input-with-copy">
<?php if ( ISQ::$general['clipboard'] ) { echo '<button data-clipboard-target="longurl" class="desktop-only copy-button button">' . yourls__( 'Copy to clipboard', 'isq_translation' ) . '</button>'; } ?> <input type="text" name="longurl" id="longurl" onclick="this.select();" onload="this.select();" value="<?php echo $url; ?>">
<button data-clipboard-target="#longurl" class="copy-button button" title="<?php yourls_e( 'Copy to clipboard', 'isq_translation' ); ?>"><img src="public/images/clippy.svg"></button>
<div class="copy-message success" id="copy-success"><?php yourls_e( 'Copied to clipboard', 'isq_translation' ); ?></div>
<div class="copy-message error" id="copy-error">
<span class="os macos"><?php yourls_e( 'Press ⌘+C to copy', 'isq_translation' ); ?></span>
<span class="os pc"><?php yourls_e( 'Press Ctrl+C to copy', 'isq_translation' ); ?></span>
<span class="os mobile"><?php yourls_e( 'Tap copy', 'isq_translation' ); ?></span>
<span class="os other"><?php yourls_e( 'Failed to copy', 'isq_translation' ); ?></span>
</div>
</div>
</div> </div>
<div class="halves"> <div class="halves">
<div class="form-item half-width left">
<div class="form-item half-width left"> <label for="shorturl" class="primary"><?php yourls_e( 'Short URL', 'isq_translation'); ?></label>
<label for="shorturl" class="primary"><?php yourls_e( 'Short URL', 'isq_translation'); ?></label> <div class="input-with-copy">
<input type="text" name="shorturl" id="shorturl" onclick="this.select();" value="<?php echo $shorturl; ?>"> <input type="text" name="shorturl" id="shorturl" onclick="this.select();" value="<?php echo $shorturl; ?>">
<?php if ( ISQ::$general['clipboard'] ) { echo '<button data-clipboard-target="shorturl" class="desktop-only copy-button button">' . yourls__( 'Copy to clipboard', 'isq_translation' ) . '</button>'; } ?> <button data-clipboard-target="#shorturl" class="copy-button button" title="<?php yourls_e( 'Copy to clipboard', 'isq_translation' ); ?>"><img src="public/images/clippy.svg"></button>
<div class="copy-message success" id="copy-success"><?php yourls_e( 'Copied to clipboard', 'isq_translation' ); ?></div>
<div class="copy-message error" id="copy-error">
<span class="os macos"><?php yourls_e( 'Press ⌘+C to copy', 'isq_translation' ); ?></span>
<span class="os pc"><?php yourls_e( 'Press Ctrl+C to copy', 'isq_translation' ); ?></span>
<span class="os mobile"><?php yourls_e( 'Tap copy', 'isq_translation' ); ?></span>
<span class="os other"><?php yourls_e( 'Failed to copy', 'isq_translation' ); ?></span>
</div>
</div>
</div>
<div class="form-item half-width right">
<label for="stats" class="primary"><?php /* translators: This is short for statistics */ yourls_e( 'Stats', 'isq_translation'); ?></label>
<div class="input-with-copy">
<input type="text" name="stats" id="stats" onclick="this.select();" value="<?php echo $shorturl . '+'; ?>" id="stats-copy">
<button data-clipboard-target="#stats" class="copy-button button" title="<?php yourls_e( 'Copy to clipboard', 'isq_translation' ); ?>"><img src="public/images/clippy.svg"></button>
<div class="copy-message success" id="copy-success"><?php yourls_e( 'Copied to clipboard', 'isq_translation' ); ?></div>
<div class="copy-message error" id="copy-error">
<span class="os macos"><?php yourls_e( 'Press ⌘+C to copy', 'isq_translation' ); ?></span>
<span class="os pc"><?php yourls_e( 'Press Ctrl+C to copy', 'isq_translation' ); ?></span>
<span class="os mobile"><?php yourls_e( 'Tap copy', 'isq_translation' ); ?></span>
<span class="os other"><?php yourls_e( 'Failed to copy', 'isq_translation' ); ?></span>
</div>
</div>
</div>
</div> </div>
<div class="form-item half-width right">
<label for="stats" class="primary"><?php /* translators: This is short for statistics */ yourls_e( 'Stats', 'isq_translation'); ?></label>
<input type="text" name="stats" id="stats" onclick="this.select();" value="<?php echo $shorturl . '+'; ?>" id="stats-copy">
<?php if ( ISQ::$general['clipboard'] ) { echo '<button data-clipboard-target="stats" class="desktop-only copy-button button">' . yourls__( 'Copy to clipboard', 'isq_translation' ) . '</button>'; } ?>
</div>
</div>
<p class="desktop-only"><?php yourls_e( 'Click on a link and press Ctrl+C to quickly copy it.', 'isq_translation'); ?></p>
</div> </div>
<!-- Social sharers --> <!-- Social sharers -->
@@ -152,12 +164,24 @@ if ( ISQ::$general['qr'] ) {
if ( ISQ::$social['linkedin'] ) { echo '<span onclick="window.open(\'https://www.linkedin.com/shareArticle?mini=true&url=' . $encoded_shorturl . '&title=' . $encoded_title . '\',\'_blank\',\'width=550,height=380\')" class="button social-button linkedin" title="Share on LinkedIn">' . file_get_contents('public/images/linkedin.svg') . '</span>'; } if ( ISQ::$social['linkedin'] ) { echo '<span onclick="window.open(\'https://www.linkedin.com/shareArticle?mini=true&url=' . $encoded_shorturl . '&title=' . $encoded_title . '\',\'_blank\',\'width=550,height=380\')" class="button social-button linkedin" title="Share on LinkedIn">' . file_get_contents('public/images/linkedin.svg') . '</span>'; }
if ( ISQ::$social['googleplus'] ) { echo '<span onclick="window.open(\'https://plus.google.com/share?url=' . $encoded_shorturl . '\',\'_blank\',\'width=550,height=380\')" class="button social-button googleplus" title="Share on LinkedIn">' . file_get_contents('public/images/googleplus.svg') . '</span>'; } if ( ISQ::$social['googleplus'] ) { echo '<span onclick="window.open(\'https://plus.google.com/share?url=' . $encoded_shorturl . '\',\'_blank\',\'width=550,height=380\')" class="button social-button googleplus" title="Share on Google+">' . file_get_contents('public/images/googleplus.svg') . '</span>'; }
if ( ISQ::$social['vk'] ) { echo '<span onclick="window.open(\'https://vk.com/share.php?url=' . $encoded_shorturl . '\',\'_blank\',\'width=550,height=380\')" class="button social-button vk" title="Share on VK">' . file_get_contents('public/images/vk.svg') . '</span>'; }
?> ?>
</div> </div>
<!-- QR code --> <?php if ( ISQ::$general['qr'] ) : ?>
<?php if ( ISQ::$general['qr'] ) { echo '<h2>' . yourls__( 'QR code', 'isq_translation' ) . '</h2><p>' . yourls__( 'Share your link with external devices', 'isq_translation' ) . '</p>' . $qrCode; } ?> <!-- QR code -->
<h2><?php yourls_e( 'QR code', 'isq_translation' ); ?></h2>
<p><?php yourls_e( 'Share your link with external devices', 'isq_translation' ); ?></p>
<?php
// PHP QR Code is LGPL licensed
include('public/phpqrcode/qrlib.php');
echo QRcode::svg( $shorturl, 'url-qr-code', false, QR_ECLEVEL_L, '600' );
endif; ?>
</div> </div>
<?php include('footer.php'); ?> <?php include('footer.php'); ?>