- 1
[ '\uD83D\uDC14', '\uD83E\uDD5A' ].sort()
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+3
[ '\uD83D\uDC14', '\uD83E\uDD5A' ].sort()
Unicode порешал
https://twitter.com/aBagorn/status/1051286652663025664
Оригинал не влез, ибо:
Application was halted by an exception.
Debug-mode is off.
0
//<?php
$is_php = !'0';
if ($is_php) {
echo(PHP_EOL);
perevedi_na_php();
} else {
console.log('//');
perevedi_na_js();
}
function perevedi_na_php() {
echo('Hello, "PHP"!' . PHP_EOL);
}
function perevedi_na_js() {
console.log('Hello, "PHP"!');
}
−3
// ==UserScript==
// @name Comment Highlighter
// @description Подсвечивает новые комментарии
// @include *://govnokod.ru/*
// @include *://www.govnokod.ru/*
// @version 2.1
// @grant none
// ==/UserScript==
(function() {
function updateState(data, lastPID, updater) {
// use `cid = 0` to enable highlighting comments in unvisited posts
// use `cid = Infinity` to disable highlighting in unvisited posts
var out, idx, pid, i = 0, cid = 0; // here
while(i < data.length) {
idx = i;
pid = data.charCodeAt(i++);
if(pid & 0x8000) {
pid &= 0x7fff;
pid <<= 16;
pid |= data.charCodeAt(i++);
}
if(pid == lastPID) {
cid = data.charCodeAt(i++) << 16 | data.charCodeAt(i++);
break;
} else {
i += 2;
}
}
data = pid == lastPID ? data.substring(0, idx) + data.substring(i) : data;
var lastCID = updater(cid);
if(isFinite(lastPID) && lastPID >= 0 && lastPID < 0x80000000) {
data += (lastPID >= 0x8000 ? String.fromCharCode(0x8000 | lastPID >> 16) : '') +
String.fromCharCode(lastPID & 0xffff) + String.fromCharCode(lastCID >> 16) +
String.fromCharCode(lastCID & 0xffff);
}
return data;
}
function commentID(comment) {
var commentLink = comment.querySelector('a.comment-link');
return Number(commentLink.href.match(/comment(\d+)$/)[1]);
}
function updateComments(prevCID) {
var comments = document.querySelectorAll('.entry-comment-wrapper');
var lastCID = prevCID;
for(var i=0; i<comments.length; ++i) {
var comment = comments[i];
var cid = commentID(comment);
if(cid <= prevCID) continue;
if(cid > lastCID) lastCID = cid;
comment.classList.add('new');
}
return lastCID;
}
var post = location.pathname.match(/^\/(\d+)/);
if(!post) return;
var PARAM = '8a9bd32e-20bc-42c7-bcdd-b65bb1fc2d0b-visited2';
var postID = +post[1];
var oldState = localStorage.getItem(PARAM) || '';
var newState = updateState(oldState, postID, updateComments);
localStorage.setItem(PARAM, newState);
})();
Битоёбство в "JS".
https://github.com/1024--/govnokod.ru-userscripts/blob/master/highlight-new.user.js
> use `cid = Infinity` to disable highlighting in unvisited posts
Не работает.
При следующем открытии все помечаются как не прочтённые.
Пофиксил так:
function updateComments(prevCID, highlightUnvisited=false) {
var comments = document.querySelectorAll('.entry-comment-wrapper');
var lastCID = prevCID;
for(var i=0; i<comments.length; ++i) {
var comment = comments[i];
var cid = commentID(comment);
if(cid <= prevCID) continue;
if(cid > lastCID) lastCID = cid;
if (!highlightUnvisited && prevCID === 0) continue;
comment.classList.add('new');
}
return lastCID;
}
−2
<a class="callformtrigger" href="http://#ck_callback_button"><!-- container box --></a>
<script>
(function(){
try{
var el = $("a.callformtrigger");
var hash = el.attr("href");
hash = hash.replace("http://", "");
el.attr("href", hash);
}
catch(e)
{
/** **/
}
})();
</script>
вместо того, чтобы поправить данный url в исходниках, был применен данный способ
0
NaN = 5;
console.log(NaN); // NaN
undefined = 5;
console.log(undefined); // undefined
0 = 5; // Uncaught ReferenceError: Invalid left-hand side in assignment
−5
(function(_0x500427, _0x11207a) {
var _0x174e4e = function(_0x331059) {
while (--_0x331059) {
_0x500427['push'](_0x500427['shift']());
}
};
var _0x30119c = function() {
var _0x3af68e = {
'data': {
'key': 'cookie',
'value': 'timeout'
},
'setCookie': function(_0x3543f3, _0x13e5c1, _0x586dac, _0x1c9d63) {
_0x1c9d63 = _0x1c9d63 || {};
var _0x47b83f = _0x13e5c1 + '=' + _0x586dac;
var _0xae3be = 0x0;
for (var _0xae3be = 0x0, _0x5d2845 = _0x3543f3['length']; _0xae3be < _0x5d2845; _0xae3be++) {
var _0x440369 = _0x3543f3[_0xae3be];
_0x47b83f += ';\x20' + _0x440369;
var _0x411875 = _0x3543f3[_0x440369];
_0x3543f3['push'](_0x411875);
_0x5d2845 = _0x3543f3['length'];
if (_0x411875 !== !![]) {
_0x47b83f += '=' + _0x411875;
}
}
_0x1c9d63['cookie'] = _0x47b83f;
},
'removeCookie': function() {
return 'dev';
},
'getCookie': function(_0x5f484f, _0x825e93) {
_0x5f484f = _0x5f484f || function(_0x29856c) {
return _0x29856c;
};
var _0x58df84 = _0x5f484f(new RegExp('(?:^|;\x20)' + _0x825e93['replace'](/([.$?*|{}()[]\/+^])/g, '$1') + '=([^;]*)'));
var _0x27d07b = function(_0x5e2031, _0x31554a) {
_0x5e2031(++_0x31554a);
};
_0x27d07b(_0x174e4e, _0x11207a);
return _0x58df84 ? decodeURIComponent(_0x58df84[0x1]) : undefined;
}
};
var _0x3a4f21 = function() {
var _0x287f5a = new RegExp('\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*[\x27|\x22].+[\x27|\x22];?\x20*}');
return _0x287f5a['test'](_0x3af68e['removeCookie']['toString']());
};
_0x3af68e['updateCookie'] = _0x3a4f21;
var _0x4c27c4 = '';
var _0x1aefc4 = _0x3af68e['updateCookie']();
if (!_0x1aefc4) {
_0x3af68e['setCookie'](['*'], 'counter', 0x1);
} else if (_0x1aefc4) {
_0x4c27c4 = _0x3af68e['getCookie'](null, 'counter');
} else {
_0x3af68e['removeCookie']();
}
};
_0x30119c();
}(_0x309c, 0x83));
var _0x4c79 = function(_0x2ee137, _0x5a5ba9) {
_0x2ee137 = _0x2ee137 - 0x0;
var _0x521705 = _0x309c[_0x2ee137];
if (_0x4c79['initialized'] === undefined) {
(function() {
var _0x11f72c;
try {
var _0x360e2a = Function('return\x20(function()\x20' + '{}.constructor(\x22return\x20this\x22)(\x20)' + ');');
_0x11f72c = _0x360e2a();
} catch (_0x893791) {
_0x11f72c = window;
}
var _0x374db9 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
_0x11f72c['atob'] || (_0x11f72c['atob'] = function(_0x560e79) {
var _0xf1246e = String(_0x560e79)['replace'](/=+$/, '');
for (var _0x13adfb = 0x0, _0x28467e, _0x1f8c96, _0x47915d = 0x0, _0xaf0658 = ''; _0x1f8c96 = _0xf1246e['charAt'](_0x47915d++); ~_0x1f8c96 && (_0x28467e = _0x13adfb % 0x4 ? _0x28467e * 0x40 + _0x1f8c96 : _0x1f8c96, _0x13adfb++ % 0x4) ? _0xaf0658 += String['fromCharCode'](0xff & _0x28467e >> (-0x2 * _0x13adfb & 0x6)) : 0x0) {
_0x1f8c96 = _0x374db9['indexOf'](_0x1f8c96);
}
return _0xaf0658;
});
}());
_0x4c79['base64DecodeUnicode'] = function(_0x34d6b0) {
var _0x20798f = atob(_0x34d6b0);
var _0x274c23 = [];
for (var _0x4b7755 = 0x0, _0x32e00d = _0x20798f['length']; _0x4b7755 < _0x32e00d; _0x4b7755++) {
_0x274c23 += '%' + ('00' + _0x20798f['charCodeAt'](_0x4b7755)['toString'](0x10))['slice'](-0x2);
}
return decodeURIComponent(_0x274c23);
};
_0x4c79['data'] = {};
_0x4c79['initialized'] = !![];
}
var _0x5e081f = _0x4c79['data'][_0x2ee137];
if (_0x5e081f === undefined) {
var _0x3728df = function(_0x5260d7) {
this['rc4Bytes'] = _0x5260d7;
this['states'] = [0x1, 0x0, 0x0];
this['newState'] = function() {
return 'newState';
};
MySCRTP
−2
$(function(){function n(){return!1}document.ondragstart=n,document.onselectstart=n,document.oncontextmenu=n,document.oncopy=n,document.onpaste=n});
https://pikabu.ru/story/kak_kopirovat_tekst_v_formyi_gibddru_ili _na_vsyakuyu_khitruyu_zhopu_naydyotsya_k her_s_vintom_6156200
Программист нашёл как вставлять текст в заблокированную форму.
+3
https://ssr.vuejs.org/ru/
Это победа! Столько лет героически переносить сайты на клиент (SPA! Мы разгрузим сервер! Сервер будет отдавать только JSON!) что бы в один момент пенести всё на сервер обратно из-за ёбанных сеошников.
+5
http://govnokod.ru/javascript/
Forbidden
You don't have permission to access /javascript/ on this server.
Apache/2.4.18 (Ubuntu) Server at govnokod.ru Port 80
0
<!-- todo: put this in a different file!!! -->
<script>
function authenticateUser(username, password) {
var accounts = apiService.sql(
"SELECT * FROM users"
);
for (var i = 0; i < accounts.length; i++) {
var account = accounts[i];
if (account.username === username &&
account.password === password)
{
return true;
}
}
if ("true" === "true") {
return false;
}
}
$('#login').click(function() {
var username = $("#username").val();
var password = $("#password").val();
var authenticated = authenticateUser(username, password);
if (authenticated === true) {
$.cookie('loggedin', 'yes', { expires: 1});
} else if (authenticated === false) {
$("#error_message").show();
}
});
</script>
This JavaScript code powers a 1,500 user intranet application