Advertisement
jamescolin

Buildnroll admin

Dec 25th, 2022 (edited)
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.01 KB | None | 0 0
  1. <div class="jamesbody">
  2. <form>
  3. <h3>Write or copy-paste a link here:</h3>
  4.  
  5. <div class="form__field">
  6. <input id="jamesinputlink" type="text" class="form__input" size="60" pattern="https?://.+" required>
  7. <span class="icon"></span>
  8. </div>
  9.  
  10. <p>A Youtube link or any other internet link that starts with http...</p>
  11. <hr>
  12. <h4>A title to replace the default one:</h4>
  13.  
  14. <div class="form__field">
  15. <input id="jamesinputtitle" type="text" class="form__input" size="60">
  16. </div>
  17.  
  18. <p>The title will display at the top of the page.</p>
  19. <hr>
  20. <h4>A description to replace the default one:</h4>
  21.  
  22. <div class="form__field">
  23. <input id="jamesinputdescription" type="text" class="form__input" size="60">
  24. </div>
  25.  
  26. <p>The description will display above the email capture form.</p>
  27. <hr>
  28.  
  29. </form>
  30. <div id="jamesfinallinkdiv">
  31. <h3>Here is the link to your Magic Lead Capture Page:</h3>
  32. <p id="jamesfinallink"></p>
  33. <p id="jamesfinallinkcounter"></p>
  34. <p>&nbsp;<br>Right-click on the link to copy it, or:</p>
  35. </div>
  36. <div>
  37. <ul class="wrapper">
  38. <li class="icon copy">
  39. <span id="copytooltip" class="tooltip">Copy to clipboard</span>
  40. <span onclick="copytooltip();">📋</span>
  41. </li>
  42. <li class="icon facebook">
  43. <span id="shareonfacebooktooltip" class="tooltip">Share on Facebook</span>
  44. <span onclick="shareonfacebook();">f</span>
  45. </li>
  46. </ul>
  47. </div>
  48.  
  49. <div>
  50. <hr>
  51. <h3>If you can't see your Magic Lead Capture Page after a test:</h3>
  52. <p id="jamesresetlink"></p>
  53. <p>&nbsp;<br>Click on this link to reset your browser.</p>
  54. </div>
  55. </div>
  56. <script>
  57. var jamesfinalurl = window.location.origin+'/go';;
  58. function copytooltip(){
  59. copyTextToClipboard(jamesfinalurl);
  60. document.getElementById('copytooltip').innerHTML = '✓ COPIED';
  61. setTimeout(function(){
  62. document.getElementById('copytooltip').innerHTML = 'Copy to clipboard';
  63. },5000);
  64. }
  65. function shareonfacebook(){
  66. document.getElementById('shareonfacebooktooltip').innerHTML = '✓ FACEBOOK';
  67. setTimeout(function(){
  68. document.getElementById('shareonfacebooktooltip').innerHTML = 'Share on Facebook';
  69. },5000);
  70. let url = 'https://www.facebook.com/sharer/sharer.php?u=';
  71. url = url + encodeURIComponent(jamesfinalurl);
  72. openNewTab(url);
  73. }
  74. function openNewTab(url) {
  75. let mywidth = 550;
  76. let myheight = 700;
  77. let myleft = (screen.availWidth - mywidth) / 2;
  78. let mytop = (screen.availHeight - myheight) / 4;
  79. const newTab = window.open('', 'jamesShareFacebook','height='+myheight+',left='+myleft+',top='+mytop+',width='+mywidth+',location=no,menubar=no,status=no,toolbar=no');
  80. newTab.focus();
  81. if (!newTab.location.hostname) {
  82. newTab.location.href = url;
  83. }
  84. };
  85. function jameslink(url){
  86. if(url.indexOf('http')==-1) {
  87. return false;
  88. } else {
  89. url = btoa(url).replaceAll('=','').replaceAll('/','_').replaceAll('+','-');
  90. return '?u='+url;
  91. }
  92. }
  93.  
  94. function jamesyoutube(url){
  95. let urls = [url];
  96. let i, r, rx = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/;
  97. r = urls[0].match(rx);
  98. if(r != null) {
  99. return '?v='+r[1];
  100. } else {
  101. return false;
  102. }
  103. }
  104. function jamesmakefinalurl(addurl){
  105. let addparams = '';
  106. let mytitle = document.getElementById('jamesinputtitle').value.trim();
  107. let mydescription = document.getElementById('jamesinputdescription').value.trim();
  108. if(mytitle){
  109. mytitle = 'title='+encodeURIComponent(mytitle);
  110. if(mydescription) { mydescription = '&description='+encodeURIComponent(mydescription); }
  111. } else {
  112. if(mydescription) { mydescription = 'description='+encodeURIComponent(mydescription); }
  113. }
  114. addparams = mytitle+mydescription;
  115. if(addurl) {
  116. if(addparams) { addparams = '&'+addparams; }
  117. } else {
  118. if(addparams) { addparams = '?'+addparams; }
  119. }
  120. return window.location.origin+''+addurl+addparams;
  121. }
  122. function jamescheckinput(){
  123. jamesfinalurl = jamesmakefinalurl('');
  124. let jamesurl = document.getElementById('jamesinputlink').value.trim();
  125. let islink = false;
  126. islink = jameslink(jamesurl);
  127. if (islink) { jamesfinalurl = jamesmakefinalurl(islink); }
  128. let isyoutube = false;
  129. isyoutube = jamesyoutube(jamesurl);
  130. if (isyoutube) { jamesfinalurl = jamesmakefinalurl(isyoutube); }
  131.  
  132. let mynewlink = '<a href="'+jamesfinalurl+'" target="_blank">'+jamesfinalurl+'</a>';
  133. if (mynewlink != document.getElementById('jamesfinallink').innerHTML) {
  134. document.getElementById('jamesfinallink').innerHTML = mynewlink;
  135. document.getElementById('jamesfinallinkcounter').innerHTML = '<br>It is '+jamesfinalurl.length+' characters long.';
  136. if(jamesfinalurl.length>255){
  137. document.getElementById('jamesfinallinkcounter').innerHTML = document.getElementById('jamesfinallinkcounter').innerHTML + ' Sometimes, to be valid, a link must not be longer than 255 characters.';
  138. }
  139. }
  140. mynewlink = '<a href="'+window.location.origin+'?reset=1" target="_blank">'+window.location.origin+'?reset=1</a>';
  141. if (mynewlink != document.getElementById('jamesresetlink').innerHTML) {
  142. document.getElementById('jamesresetlink').innerHTML = mynewlink;
  143. }
  144. setTimeout(function(){
  145. jamescheckinput();
  146. }, 1000);
  147. }
  148.  
  149. function fallbackCopyTextToClipboard(text) {
  150. let textArea = document.createElement("textarea");
  151. textArea.value = text;
  152. textArea.style.top = "0";
  153. textArea.style.left = "0";
  154. textArea.style.position = "fixed";
  155. document.body.appendChild(textArea);
  156. textArea.focus();
  157. textArea.select();
  158. try {
  159. let successful = document.execCommand('copy');
  160. let msg = successful ? 'succès' : 'échec';
  161. console.log('La copie du texte avec le plan B a été un ' + msg);
  162. } catch (err) {
  163. console.error('Impossible de copier avec le plan B : ', err);
  164. }
  165. document.body.removeChild(textArea);
  166. }
  167. function copyTextToClipboard(text) {
  168. if (!navigator.clipboard) {
  169. fallbackCopyTextToClipboard(text);
  170. return;
  171. }
  172. navigator.clipboard.writeText(text).then(function() {
  173. console.log('Lien copié en mémoire !');
  174. }, function(err) {
  175. console.error('La copie du texte a échoué : ', err);
  176. });
  177. }
  178. </script>
  179.  
  180. <style>
  181. .wrapper {
  182. display: inline-flex;
  183. list-style: none;
  184. }
  185.  
  186. .wrapper .icon {
  187. position: relative;
  188. background: #ffffff;
  189. border-radius: 50%;
  190. padding: 15px;
  191. margin: 10px;
  192. width: 50px;
  193. height: 50px;
  194. font-size: 18px;
  195. display: flex;
  196. justify-content: center;
  197. align-items: center;
  198. flex-direction: column;
  199. box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
  200. cursor: pointer;
  201. transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  202. }
  203.  
  204. .wrapper .tooltip {
  205. position: absolute;
  206. top: 0;
  207. font-size: 14px;
  208. background: #ffffff;
  209. color: #ffffff;
  210. padding: 5px 8px;
  211. border-radius: 5px;
  212. box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
  213. opacity: 0;
  214. pointer-events: none;
  215. transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  216. }
  217.  
  218. .wrapper .tooltip::before {
  219. position: absolute;
  220. content: "";
  221. height: 8px;
  222. width: 8px;
  223. background: #ffffff;
  224. bottom: -3px;
  225. left: 50%;
  226. transform: translate(-50%) rotate(45deg);
  227. transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  228. }
  229.  
  230. .wrapper .icon:hover .tooltip {
  231. top: -65px;
  232. opacity: 1;
  233. visibility: visible;
  234. pointer-events: auto;
  235. }
  236.  
  237. .wrapper .icon:hover span,
  238. .wrapper .icon:hover .tooltip {
  239. text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.1);
  240. }
  241.  
  242. .wrapper .facebook:hover,
  243. .wrapper .facebook:hover .tooltip,
  244. .wrapper .facebook:hover .tooltip::before {
  245. background: #1877F2;
  246. color: #ffffff;
  247. }
  248.  
  249. .wrapper .copy:hover,
  250. .wrapper .copy:hover .tooltip,
  251. .wrapper .copy:hover .tooltip::before {
  252. background: #1DA1F2;
  253. color: #ffffff;
  254. }
  255.  
  256. #jamesfinallink {
  257. word-break: break-all;
  258. }
  259.  
  260. .jamesbody {
  261. display: flex;
  262. flex-direction: column;
  263. width: 100%;
  264. height: 100%;
  265. align-items: center;
  266. justify-content: center;
  267. animation: fadeIn linear 5s;
  268. -webkit-animation: fadeIn linear 5s;
  269. -moz-animation: fadeIn linear 5s;
  270. -o-animation: fadeIn linear 5s;
  271. -ms-animation: fadeIn linear 5s;
  272. }
  273.  
  274. .icon {
  275. font-size: 2rem;
  276. }
  277.  
  278. .form__field {
  279. position: relative;
  280. }
  281.  
  282. .form__field .icon {
  283. position: absolute;
  284. right: 1em;
  285. top: 50%;
  286. transform: translateY(-50%)
  287. }
  288.  
  289. .form__input {
  290. border-radius: 0.25em;
  291. border-style: solid;
  292. border-width: 2px;
  293. font-size: 1rem;
  294. padding: 0.5em 4em 0.5em 2em;
  295. font: inherit;
  296. outline: 0;
  297. width: 100%;
  298. }
  299.  
  300. .form__input:valid {
  301. border-color: forestgreen;
  302. }
  303.  
  304. .form__input:valid + .icon::after {
  305. content: '😃';
  306. }
  307.  
  308. .form__input:invalid {
  309. border-color: firebrick;
  310. }
  311.  
  312. .form__input:invalid + .icon::after {
  313. content: '😳';
  314. }
  315.  
  316. </style>
  317. <script>
  318. document.getElementById('jamesinputlink').focus();
  319. setTimeout(function(){
  320. jamescheckinput();
  321. }, 1000);
  322. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement