how to find the code that prevent wordpress text selection? - html

I know this may be stupid and simple question but I really need help
there,s a wordpress website that have been created by someone and there is a text copy protection that I have no Idea how he applied to the website . I checked wordpress plugins and even tried additional css code but none of them disable that text copy protection . How can I find the code or the thing that prevent text copy protection ?
thank u so much
website address : https://www.lanamind.com/

I have added two options and both are working for me.
If you want to achieve this using plugin All in one security plugin provides this option where you can add copy protection. A plugin will always be the better option for this feature and this plugin has many other settings to secure your site.
Take a look here:
If you don't want to use this plugin you can add this code in your PHP file. I have tested it and it is working.
function output_copy_protection_code() {
?>
<meta http-equiv="imagetoolbar" content="no"><!-- disable image toolbar (if any) -->
<script type="text/javascript">
/*<![CDATA[*/
document.oncontextmenu = function() {
return false;
};
document.onselectstart = function() {
console.log("here");
if (event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password") {
return false;
}
else {
return true;
}
};
if (window.sidebar) {
document.onmousedown = function(e) {
var obj = e.target;
if (obj.tagName.toUpperCase() == 'SELECT'
|| obj.tagName.toUpperCase() == "INPUT"
|| obj.tagName.toUpperCase() == "TEXTAREA"
|| obj.tagName.toUpperCase() == "PASSWORD") {
return true;
}
else {
return false;
}
};
}
document.ondragstart = function() {
return false;
};
/*]]>*/
</script>
<?php
}
add_action('init', 'output_copy_protection_code');

Related

How to disabled submit button for if any the fields are empty?

I'm trying to disable a submit button to check if all the input fields are filled before submitting. I've checked and used most of the codes here. I have found a handful that works, but the problem is the code works when I check it on a console window, but it doesn't work when I include it on a WordPress site. I'm using Skyboot Custom Script Panel and i have put the script after the footer.
Here is the code:
var $ = jQuery.noConflict();
$(document).ready(function() {
$('button').attr('disabled', true);
$('input').on('keyup blur', function() {
if ($('[data-wof-field~="primary_email"]').val() != '' && $('[data-wof-field~="text_2"]').val() != '' && $('[data-wof-field~="number_1"]').val() != '' && $('[data-wof-field~="text_1"]').val() != '') {
$('button').attr('disabled', false);
} else {
$('button').attr('disabled', true);
}
});
});
Thanks in advance,

Bootstrap modal stack with google map

I am having problems displaying a google map in a Bootstrap modal. See below
Does anyone know why this is?
I don't know whats wrong with that, but i try to solve your problem.
This is for replacing the modal, may you can use this code to replace map again.
$.fn.modal.Constructor.prototype.enforceFocus = function () {
modal_this = this
$(document).on('focusin.modal', function (e) {
if (modal_this.$element[0] !== e.target && !modal_this.$element.has(e.target).length
// add whatever conditions you need here:
&&
!$(e.target.parentNode).hasClass('cke_dialog_ui_input_select') && !$(e.target.parentNode).hasClass('cke_dialog_ui_input_text')) {
modal_this.$element.focus()
}
});
};

WebGL pink error in chrome

I am trying to write simple 'game' from this side using pixie.js.
I tried to run it via google chrome, however I am getting strange error:
What can I do to solve it?
EDIT
Error in index.js:225 stands for this:
isWebGLSupported: function ()
{
var contextOptions = { stencil: true };
try
{
if (!window.WebGLRenderingContext)
{
return false;
}
var canvas = document.createElement('canvas'),
gl = canvas.getContext('webgl', contextOptions) || canvas.getContext('experimental-webgl', contextOptions);
return !!(gl && gl.getContextAttributes().stencil);
}
catch (e)
{
return false;
}
},
It's not an error, as another user stated. It's the welcome message that appears by default on any page with the pixi.js library loaded.
If you want to hide that message, you can add this to your page:
<script>
PIXI.utils._saidHello = true;
</script>

chrome.tabs.onUpdated.addListener() is called twice

I'm writing a chrome extension and in some web sites chrome.tabs.onUpdated.addListener() is called twice.
It mostly happens if i click on a link and not when i type in a URL by myself.
From what i found on the web and from many questions asked on StackOverflow there was a bug on chrome but it was fixed several years ago.
Some people claim it happens if there are several iframes in the page, but in my case there are no iframes in my page.
This is my code:
var storage = chrome.storage.local;
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
if (changeInfo.status == 'complete' && tab.status == 'complete' && tab.url != undefined) {
storage.get('URLs', function(URLs){
for (var item in URLs)
{
if (tab.url == item)
{
return;
}
else
{
//alert ("tab load complete");
storage.set({URLs: [tab.url]});
chrome.tabs.executeScript(tab.id, {
"file": "flashblocker.js"
}, function () { // Execute your code
console.log("Script Executed .. "); // Notification on Completion
});
}
}
});
}
});
How can i make it run only once?
Thanks.
Use a variable and add a check inside the listener to check the value of this variable before executing the alert. You can do something like this:
var tabUpdated = false;
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
if (changeInfo.status == 'complete' && tab.status == 'complete' && tab.url != undefined) {
if (!tabUpdated) {
alert("tab load complete");
tabUpdated = true;
}
}
});
But this will fail if the content script is actually loading twice as the tabUpdated variable will again be initialized to false. In that case you can use the chrome's Storage API and store the URL for which the listener has been already invoked. Simply add a check for this, if the URL is there in storage, the alert wont be invoked, else it will invoke. You can then clear the storage at the browser start or close.
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
if (changeInfo.status == 'complete' && tab.status == 'complete' && tab.url != undefined) {
chrome.local.storage.get('URLs', function(URL's) {
// Iterate through this list here and match with tab.url, if the match is found, just return.
if (url is there in list) {return;}
else {
alert("tab load complete");
chrome.local.set({URLs: [tab.url]});
}
});
}
});
This is just an example of how you can achieve it. Tweak it according to your needs.
I hope this helps.

Basic toggle for a Chrome Exstension

I cannot believe I am still have basic programming problems... I know the basics, but still have a hard time implementing the logic I think of. Anyways
I am building this basic Chrome Extension that has one JavaScript file and it does work! The only issue is that once I click the icon it is forever on, that is until I remove it. I want to add a basic toggle functionality, but I am having difficulty getting a working prototype. Here is a couple of my ideas:
var toggle == 1; // or true, i.e. clicked
if (functionName() == 1) {
function functionName() {
Do whatever it is when clicked;
blah blah blah;
} else if (functionName() == 0) {
Turn off;
} else {};
}
switch(toggle)
{
case 1:
Do whatever it is when clicked;
blah blah blah;
break;
case 2:
Turn off;
break;
default:
error;
break;
}
If both if statement and switch statement had a different order, say case 1 and 2 were swapped, I do not think it would be a difference. I do not think a switch statement would be the best way because there is no more than two options, on or off.
What about a while loop to change the conditions of the extension? I do know the modulo operator, and code could be written like:
1 % 2 = False,
2 % 2 = True,
3 % 2 = False, etc
Then a basic if-statement could work....
something like:
var i = 1;
while (i % 2 == 1) {
Do whatever it is when clicked;
blah blah blah;
i++;
}
Does anybody have an idea of the best way to do this? I have played with the jQuery .toggle() event, but I do not think this would make since. I have nothing in the html document and only a JavaScript file. It makes no since loading the library and then using the jQuery selector$("chrome.browserAction.onClicked.addListener(function)") when simple JavaScript can be used. Plus I do not even know if that would be the right selector...
Any help would be great, thanks in advance.
For the record I found the sample extensions useless when it comes to something that should not be complicated.
Thanks!
UPDATE code with my function in background.js:
function trigger() {
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.windows.onFocusChanged.addListener(function(windowId) {
if (windowId != chrome.windows.WINDOW_ID_NONE) {
chrome.tabs.query({ active:true, windowId:windowId }, function(tabs) {
if (tabs.length == 1) {
var tab = tabs[0];
chrome.tabs.reload(tab.id);
}
});
}
});
});
}
var functionOn = false;
chrome.browserAction.onClicked.addListener(function() {
if (functionOn === false) {
document.addEventListener('DOMContentLoaded', function() {
trigger();
});
functionOn = true;
} else if (functionOn === true) {
document.addEventListener('DOMContentLoaded', function() {
//nothing...
});
functionOn = false;
}
The if statement does not work at the moment, my exstension works with this call instead of the if statement at the end:
document.addEventListener('DOMContentLoaded', function() {
trigger();
});
It's hard to give you a super detailed answer without knowing exactly what is supposed to be toggled, but in a nutshell you just need to add something like this to your background script:
var functionOn = false;
chrome.browserAction.onClicked.addListener(function() {
if (functionOn === false) {
doSomething();
functionOn = true;
} else {
functionOn = false;
// Don't do anything.
}
});
By putting the variable "functionOn" in the background page the state is persistent. You may already be aware of this, but to create a background script you simply add this to the manifest file:
"background": {
"scripts": ["background.js"]
},
It's hard to tell what you're trying to do with the toggle, but the doSomething() would basically be whatever action you're trying to perform, whether it's injecting code via a content script or showing a popup, etc.