Github Private by Default

Make Private Repos the default on github.com

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==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);
    }
});