Loomio

Make Diaspora work with LibreJS

PH Paul Hill Public Seen by 97

With LibreJS installed visiting diaspora does not present the user with much, the stream is missing and all the items on the black bar are missing, it can be fixed by following this guide (I think) http://www.gnu.org/software/librejs/free-your-javascript.html
http://www.gnu.org/software/librejs/

N

Nicolas Sun 14 Jun 2015 1:27PM

Thanks for the reply Jason! I'd love to help with code, but I'm not technically skilled in programming :(

Anyways, LibreJS still blocks content on Diaspora:

List of blocked JavaScript in https://diasporabr.com.br/stream

This script is detected as inline, nonfree, defining functions or 

methods, and the rest of the page as loading external scripts
if(Array.isArray === undefined) {
Array.isArray = function (arg) {
return Object.prototype.toString.call(arg) == '[object
Array]';
};
}
if ((window.history) && (window.history.pushState
=== undefined)) {
window.history.pushState = function() { };
}

NONTRIVIAL: creates script element dynamically.

//<![CDATA[
!window.jQuery && document.write(unescape('<script 

src="\/assets\/jquery-1db761a07a0a6fe3f80e026f788fef36.js"><\/script>'));

//]]>

This script is detected as inline, nonfree, defining functions or 

methods, and the rest of the page as loading external scripts

//<![CDATA[
jQuery.ajaxSetup({'cache': false});
//]]>

This script is detected as inline, nonfree, defining functions or 

methods, and the rest of the page as loading external scripts
Diaspora.I18n.load({"confirm_dialog":"Tem
certeza?","confirm_unload":"Por favor, confirme se deseja sair desta
página. Os dados que você informou não serão
salvos.","delete":"Apagar","ignore":"Ignorar","report":{"prompt":"Por
favor entre um motivo:","prompt_default":"conteúdo
ofensivo","name":"Relatar","status":{"created":"O relato foi criado com
sucesso","exists":"O relato já existe"}},"ignore_user":"Ignorar este
usuário?","ignore_failed":"Não foi possível ignorar este
usuário","hide_post":"esconder esta
publicação?","hide_post_failed":"Incapaz de esconder esta
publicação","remove_post":"Remover esta publicação?","unblock_failed":"O
desbloqueio deste usuário
falhou","and":"e","comma":",","edit":"Editar","no_results":"Nenhum
Resultado
Encontrado","timeago":{"prefixAgo":"","prefixFromNow":"","suffixAgo":"atrás","suffixFromNow":"a

partir de agora","seconds":"menos de um minuto","minute":"cerca de um
minuto","minutes":"%d minutos","hour":"cerca de uma hora","hours":"cerca
de %d ho…

This script is detected as inline, nonfree, defining functions or 

methods, and the rest of the page as loading external scripts

//<![CDATA[

window.gon={};gon.user={"id":22077,"guid":"54d640007fd5013287d0005056ba3b3d","name":"xxxredactedxxx","diaspora_id":"xxxredactedxxx","avatar":{"small":"https://diasporabr.com.br/uploads/images/xxxxredactedzzzz","medium":"https://diasporabr.com.br/uploads/images/thumb_medium_49186285e7800e40b8b8.jpg","large":"https://diasporabr.com.br/uploads/images/thumb_large_49186285e7800e40b8b8.jpg"},"notifications_count":10,"unread_messages_count":0,"admin":false,"aspects":[{"id":23225,"name":"Amigos","selected":true},{"id":23232,"name":"Serviços","selected":true},{"id":24395,"name":"Não

conhecidos","selected":true},{"id":23224,"name":"Família","selected":true},{"id":23226,"name":"Trabalho","selected":true},{"id":23227,"name":"Conhecidos","selected":true}],"services":[],"following_count":127,"configured_services":[]};gon.preloads={};

//]]>

NONTRIVIAL: an open method similar to xhr.open is used

    var _paq = _paq || [];





    _paq.push(["trackPageView"]);
    _paq.push(["enableLinkTracking"]);

    (function() {
        var u=(("https:" == document.location.protocol) ? "https" : 

"http") + "://pod1.diasporabr.com.br/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "2"]);
var d=document, g=d.createElement("script"),
s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js";
s.parentNode.insertBefore(g,s);
})();

This script is detected as inline, nonfree, defining functions or 

methods, and the rest of the page as loading external scripts
[{"attribute":"onclick","value":"$.facebox.close();"}]

    NONTRIVIAL: square bracket suffix method call detected

[{"attribute":"href","value":"(function(){f='https://diasporabr.com.br/bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&notes='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=1&';a=function(){if(!window.open(f+'noui=1&jump=doclose','diasporav1','location=yes,links=no,scrollbars=yes,toolbar=no,width=620,height=400'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"}]

NONTRIVIAL: eval has been found in code

https://diasporabr.com.br/assets/jquery_ujs-5be99745d2e19d4e06fd99998b1cb99b.js

error parsing: 7c99c132628414dd0a847377e8ce1940b3735744

https://diasporabr.com.br/assets/main-095e253fdb3755aa4844c4bb42e82ba0.js

NONTRIVIAL: an open method similar to xhr.open is used

https://diasporabr.com.br/assets/jsxc-e660beffa5fa259ea8f528e10ad756d7.js

This script is detected as nonfree, external, and as defining 

functions or methods

https://diasporabr.com.br/assets/templates-994dd5d1b8d11efc0df6804f529633ee.js

JR

Jason Robinson Sun 14 Jun 2015 1:31PM

You could raise specific issues on Github regarding individual JS parts.

Maybe something like "Fix JS to comply with LibreJS" and list individual items as tasks in that issue, using the github tasks syntax.

I realize you opened an issue already but general issues like "fix all the things" don't help developers to track what needs closing. An issue needs to have a clear goal, so a clear list of JS that needs to be refactored would help developers attack those parts of the code. By coordinating this work via an issue you can help without coding :)

N

Nicolas Sun 14 Jun 2015 1:33PM

Thanks! Will do :)