Добавил еще ведущие нули к миллисекундам, если кому-то еще когда-то этот код понадобится
log = function (text, color, define){ var id, time, thread, logHtml, textLog; define = (typeof define == 'string') ? define.split(/[\s,.|:;]+/g) : define; if(typeof define === 'object' && define !== null){ if(Array.isArray(define)){ id = define.indexOf('id') > -1; time = define.indexOf('time') > -1; thread = define.indexOf('thread') > -1; } else{ id = define.id == true; time = define.time == true; thread = define.thread == true; } } else id = time = thread = true; id = id ? '<a href="action://action' + ScriptWorker.GetCurrentAction() + '" style="color:gray;">[' + ScriptWorker.GetCurrentAction() + ']</a>' : ''; time = time ? ' ' + getTime() : ''; thread = thread ? ' Поток №' + thread_number() : ''; logHtml = (id || time || thread) ? id + '<span style="color: white">' + time + thread + ' : </span>' : ''; logHtml += '<span style="color:' + (color ? color : 'white') + '">' + text + '</span>'; textLog = '[' + ScriptWorker.GetCurrentAction() + ']' + time + thread + ' : ' + text function getTime(){ var checkTime = function(i){ return (i < 10) ? "0" + i : i; }; var checkMilliSeconds = function(ms){ if (ms < 10) { return "00" + ms; } else if (ms < 100) { return "0" + ms; } else { return ms; } }; var d = new Date(); var hh = checkTime(d.getHours()); var mm = checkTime(d.getMinutes()); var ss = checkTime(d.getSeconds()); var ms = checkMilliSeconds(d.getMilliseconds()); return '[' + hh + ':' + mm + ':' + ss + '.' + ms + ']'; }; Logger.WriteHtml(logHtml, textLog); }Как через "Выполнить код" преобразовать определённый текст в процентный HEX?
-
Как через "Выполнить код" преобразовать всегда разные ссылки в процентный HEX?
Задача из:
http://community.bablosoft.com/topic/9335/%D0%BA%D0%B0%D0%BA-%D1%87%D0%B5%D1%80%D0%B5%D0%B7-%D0%B2%D1%8B%D0%BF%D0%BE%D0%BB%D0%BD%D0%B8%D1%82%D1%8C-%D0%BA%D0%BE%D0%B4-%D0%BF%D1%80%D0%B5%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D1%8C-%D0%BE%D0%BF%D1%80%D0%B5%D0%B4%D0%B5%D0%BB%D1%91%D0%BD%D0%BD%D1%8B%D0%B9-%D1%82%D0%B5%D0%BA%D1%81%D1%82-%D0%B2-%D0%BF%D1%80%D0%BE%D1%86%D0%B5%D0%BD%D1%82%D0%BD%D1%8B%D0%B9-hexПолучить:
%68%74%74%70%3a%2f%2f%63%6f%6d%6d%75%6e%69%74%79%2e%62%61%62%6c%6f%73%6f%66%74%2e%63%6f%6d%2f%74%6f%70%69%63%2f%39%33%33%35%2f%25%44%30%25%42%41%25%44%30%25%42%30%25%44%30%25%42%41%2d%25%44%31%25%38%37%25%44%30%25%42%35%25%44%31%25%38%30%25%44%30%25%42%35%25%44%30%25%42%37%2d%25%44%30%25%42%32%25%44%31%25%38%42%25%44%30%25%42%46%25%44%30%25%42%45%25%44%30%25%42%42%25%44%30%25%42%44%25%44%30%25%42%38%25%44%31%25%38%32%25%44%31%25%38%43%2d%25%44%30%25%42%41%25%44%30%25%42%45%25%44%30%25%42%34%2d%25%44%30%25%42%46%25%44%31%25%38%30%25%44%30%25%42%35%25%44%30%25%42%45%25%44%30%25%42%31%25%44%31%25%38%30%25%44%30%25%42%30%25%44%30%25%42%37%25%44%30%25%42%45%25%44%30%25%42%32%25%44%30%25%42%30%25%44%31%25%38%32%25%44%31%25%38%43%2d%25%44%30%25%42%45%25%44%30%25%42%46%25%44%31%25%38%30%25%44%30%25%42%35%25%44%30%25%42%34%25%44%30%25%42%35%25%44%30%25%42%42%25%44%31%25%39%31%25%44%30%25%42%44%25%44%30%25%42%44%25%44%31%25%38%42%25%44%30%25%42%39%2d%25%44%31%25%38%32%25%44%30%25%42%35%25%44%30%25%42%41%25%44%31%25%38%31%25%44%31%25%38%32%2d%25%44%30%25%42%32%2d%25%44%30%25%42%46%25%44%31%25%38%30%25%44%30%25%42%45%25%44%31%25%38%36%25%44%30%25%42%35%25%44%30%25%42%44%25%44%31%25%38%32%25%44%30%25%42%44%25%44%31%25%38%42%25%44%30%25%42%39%2d%68%65%78... без использования онлайн сервисов.