Github Private by Default

Make Private Repos the default on github.com

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Github Private by Default
// @namespace    http://github.com/cswarth
// @version      0.5
// @description  Make Private Repos the default on github.com
// @author       Chris Warth
// @include http://*github.com/*/new
// @include https://*github.com/*/new
// @include http://*github.com/new
// @include https://*github.com/new
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://greatest.deepsurf.us/scripts/6250-waitforkeyelements/code/waitForKeyElements.js?version=23756
// @run-at document-start
// ==/UserScript==

$(function () {
    "use strict";

	// I'm serious as cancer - public repos by default are a terrible risk!
	// Don't even present the options to accidentaly create the repo as public.
	// By hiding the option entirely, you have to go through several steps
	// to make a repo public.
    waitForKeyElements ("#new_repository > div.with-permission-fields > div:nth-child(4)", hideElement);

    function hideElement (jNode) {
        jNode.hide();
    }

	// Synthesize mouse events to pre-select the private option.
    waitForKeyElements ("#repository_public_false", triggerMostButtons);

    function triggerMostButtons (jNode) {
        triggerMouseEvent (jNode[0], "mouseover");
        triggerMouseEvent (jNode[0], "mousedown");
        triggerMouseEvent (jNode[0], "mouseup");
        triggerMouseEvent (jNode[0], "click");
    }

    function triggerMouseEvent (node, eventType) {
        var clickEvent = document.createEvent('MouseEvents');
        clickEvent.initEvent (eventType, true, true);
        node.dispatchEvent (clickEvent);
    }
});