Category Archives: JavaScript

AES decrypt in postman

sample code: var CryptoJS = require(“crypto-js”); let secretKey = ‘yourSecretKey’; function decrypt(aesStr, key) { return CryptoJS.AES.decrypt( aesStr, CryptoJS.enc.Utf8.parse(padding(key)), { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 } ).toString(CryptoJS.enc.Utf8) } function padding(key) { return key.padEnd(32, ‘\0’); } //decrypt(“encryptedData”, secretKey) Here we choose AES-256 to … Continue reading

Posted in JavaScript, Postman | Comments Off on AES decrypt in postman

[JavaScript] cannot call methods on [Object] prior to initialization; attempted to call method ‘refresh’

try to force initialize the object first. stackOverflow: selectmenu (‘refresh’, true)

Posted in JavaScript | Leave a comment

[JavaScript][jQuery] How to enable/disable select field?

[jQuery] $(‘input[type=radio][name=ldap-sync-type]’).change(function() { if (this.value == ‘0’) { $(“select[name=day-option]”).prop(“disabled”, true); $(“select[name=clock-option]”).prop(“disabled”, true); } else if (this.value == ‘1’) { $(“select[name=day-option]”).prop(“disabled”, false); $(“select[name=clock-option]”).prop(“disabled”, false); } }); [JavaScript] $(‘input[type=radio][name=ldap-sync-type]’).change(function() { if (this.value == ‘0’) { $(“select[name=day-option]”).attr(“disabled”, “disabled”); $(“select[name=clock-option]”).attr(“disabled”, “disabled”); } else if … Continue reading

Posted in JavaScript, jQuery | Leave a comment

Javascript的月份是從0開始…

受教了~修正 etherpad 的日期顯示以 “yyyy-mm-mm hh-mm” 顯示的過程中發現月份總是少一個月 可是看 code 又沒有什麼問題 所以用 google 搜尋 “jquery + 少1個月” 及 “javascript + 少1個月” 發現了是 javascript 對於月份是少一個月 Orz… 所以 etherpad 的原本的寫法還不錯,貼上來註記一下 var converterPad = function (UNIX_timestamp) { var a = new Date(UNIX_timestamp); //原本的寫法是用英文顯示 //var months … Continue reading

Posted in etherpad, JavaScript | Leave a comment

(滑鼠位置) Row顯目變色處理

這主要是透過 javascript 來讓滑鼠游標存在的 Row 變顏色 原始碼如下 (參考Change table row background colour on mouse over-move using JavaScript

Posted in JavaScript | Leave a comment