Просмотр исходного кода

Added new function for clipboard access
Edited json output to go directly to clipboard

causefx 7 лет назад
Родитель
Сommit
e3b6890a36
5 измененных файлов с 17 добавлено и 3 удалено
  1. 1 0
      index.php
  2. 1 0
      js/custom.js
  3. 0 0
      js/custom.min.js
  4. 13 2
      js/functions.js
  5. 2 1
      js/jquery-lang.js

+ 1 - 0
index.php

@@ -180,6 +180,7 @@
     <!-- End Page Content -->
     <!-- ============================================================== -->
     <a href="#" id="scroll" style="display: none;"><span></span></a>
+    <button id="internal-clipboard" class="hidden"></button>
 </div>
 <!-- /#wrapper -->
 <!-- jQuery -->

+ 1 - 0
js/custom.js

@@ -9,6 +9,7 @@ $(document).ajaxComplete(function () {
 $(document).ready(function () {
     pageLoad();
     var clipboard = new Clipboard('.clipboard');
+    var internalClipboard = new Clipboard('#internal-clipboard');
     clipboard.on('success', function(e) {
         message('Clipboard',e.text,activeInfo.settings.notifications.position,'#FFF','info','5000');
         e.clearSelection();

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
js/custom.min.js


+ 13 - 2
js/functions.js

@@ -23,7 +23,7 @@ function toggleDebug(){
 }
 function highlightObject(json) {
     if (typeof json != 'string') {
-        json = JSON.stringify(json, undefined, 2);
+        json = JSON.stringify(json, undefined, '\t');
     }
     json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
     return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
@@ -74,8 +74,19 @@ function orgDebugList(cmd){
         orgDebug();
     }
 }
+function clipboard(trigger = true, string = null){
+    let clipboard = $('#internal-clipboard');
+    if(string){
+        clipboard.attr('data-clipboard-text',string );
+    }
+    if(trigger){
+        clipboard.click();
+    }
+}
 function getLangStrings(){
-    console.log(JSON.stringify(window.langStrings))
+    let strings = JSON.stringify(window.langStrings, null, '\t');
+    clipboard(true,strings);
+    console.log('Copied JSON Strings to clipboard');
 }
 function getHiddenProp(){
     var prefixes = ['webkit','moz','ms','o'];

+ 2 - 1
js/jquery-lang.js

@@ -603,7 +603,8 @@
 
                 if (!translation) {
                     if (console && console.log) {
-                        console.log('Translation for "' + text + '" not found in language pack: ' + lang + ' Type or copy this string into this console to get a full strings missing output: getLangStrings()');
+                        //console.log('Translation for "' + text + '" not found in language pack: ' + lang + ' Type or copy this string into this console to get a full strings missing output: getLangStrings()');
+                        //console.log('Translation not found in language pack: ' + lang + ' Type this command into this console to get a full strings missing output: getLangStrings()');
                         langStrings['token'][text] = text;
                     }
                 }

Некоторые файлы не были показаны из-за большого количества измененных файлов