Skip to content

Instantly share code, notes, and snippets.

@pbaruns
pbaruns / gist:c598a29d051ed34b55880a36b31c8994
Last active February 8, 2022 21:12
Download button for Blogger
<a href="add your URL here" target="_blank">
<input class="myButton" type="button" value="Download Now" />
</a>
@pbaruns
pbaruns / Blogger - disables 4 things (see desc)
Created April 27, 2020 10:46
disables 4things: rightClick, textSelection, viewingPageSource, viewingDevTools
//disable Text Selection and Copying
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src='demo-to-prevent-copy-paste-on-blogger_files/googleapis.js'>
</script>
<script type='text/javascript'>
if (typeof document.onselectstart!="undefined" ) {
document.onselectstart=new Function ("return false" );
}
else {
document.onmousedown=new Function ("return false" );
@pbaruns
pbaruns / Blogger - Disable F12 dev tools and key combination
Last active August 17, 2023 14:05
This code disables F12 key and the shortcut ctrl shift i combination
//disable F12 Key and Ctrl + shift + I combination
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(document).keydown(function (event) {
if (event.keyCode == 123) { // Prevent F12
alert('Content is protected\nYou cannot view the Dev Tools.');
return false;
} else if (event.ctrlKey && event.shiftKey && event.keyCode == 73) { // Prevent Ctrl+Shift+I
alert('Content is protected\nYou cannot view the Dev Tools.');
@pbaruns
pbaruns / Blogger - Disable viewing page source
Last active November 26, 2022 10:21
Disable the ctrl u keyboard shortcut
// disable viewing page source
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
document.onkeydown = function(e) {
if (e.ctrlKey &&
(e.keyCode === 67 ||
e.keyCode === 86 ||
e.keyCode === 85 ||
e.keyCode === 117)) {
alert('Content is protected\nYou cannot view the page source.');
@pbaruns
pbaruns / Blogger - Disabling right click context menu
Last active April 27, 2020 10:44
Blogger - disable right click menu option
//disable right click menu
<script language=javascript>
function blockOne() {
if (document.all) {
return false;
}
}
function blockTwo(e) {
if (document.layers||(document.getElementById&&!document.all))
{
@pbaruns
pbaruns / Blogger - Disable Text Selection and Copying
Last active April 27, 2020 10:44
Blogger - protect blog posts and pages by disabling text selection and copying.
//disable Text Selection and Copying
<script src='demo-to-prevent-copy-paste-on-blogger_files/googleapis.js'>
</script>
<script type='text/javascript'>
if (typeof document.onselectstart!="undefined" ) {
document.onselectstart=new Function ("return false" );
}
else {
document.onmousedown=new Function ("return false" );
document.onmouseup=new Function ("return true" );
function onOpen() {
// Add a menu with some items, some separators, and a sub-menu.
DocumentApp.getUi().createMenu('Utilities')
.addItem('Insert Date', 'insertAtCursor')
.addItem('Insert Time', 'insertTimeAtCursor')
.addItem('Insert Long Date', 'insertLDateAtCursor')
.addItem('Insert Date and Time', 'insertDTAtCursor')
.addToUi();
}
@pbaruns
pbaruns / made with love (ionic framework)
Created August 3, 2019 13:44
made with love (ionic)
<p class="love">Made with <i class="icon ion-heart"></i> Input custom text here</p>
@pbaruns
pbaruns / made with love code (genesis)
Created August 3, 2019 13:41
made with love code for genesis wordpress sites
//* Enqueue Ionicons
add_action( 'wp_enqueue_scripts', 'bg_enqueue_ionicons' );
function bg_enqueue_ionicons() {
wp_enqueue_style( 'ionicons', '//code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css', array(), CHILD_THEME_VERSION );
}
@pbaruns
pbaruns / made with love.txt
Created August 3, 2019 13:33
Made with love
Made with <span style="color: #e25555;">&hearts;</span> in India