hulusuk - protected page

Posting here is no longer possible, please use the forum of a filter list project, such as EasyList
Locked
enbob
Posts: 408
Joined: Fri Oct 30, 2009 1:45 am

hulusuk - protected page

Post by enbob »

I don't know if this counts as an ad or just an annoyance, but this page doesn't let you highlight or right-click text. When you try, you get a prompt that says content is protected Is there a filter that can bypass this?

http://hulusuk.com/glasses-malone-after ... s-aac-m4a/
lewisje
Posts: 2743
Joined: Mon Jun 14, 2010 12:07 pm

Re: hulusuk

Post by lewisje »

It's done with an inline script, so you'd need a UserScript to counteract this; you can see the source anyway by going to this URL (Chromium-based browsers only): view-source:http://hulusuk.com/glasses-malone-after ... s-aac-m4a/

Code: Select all

/* first script element */
var image_save_msg='You Can Not Save images!';
var no_menu_msg='Context Menu disabled!';
var smessage = "Content is protected !!";

function disableEnterKey(e)
{
	if (e.ctrlKey){
     var key;
     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox (97)
    //if (key != 17) alert(key);
     if (key == 97 || key == 65 || key == 67 || key == 99 || key == 88 || key == 120 || key == 26 || key == 85  || key == 86 || key == 83 || key == 43)
     {
          show_wpcp_message('You are not allowed to copy content or view source');
          return false;
     }else
     	return true;
     }
}

function disable_copy(e)
{	
	var elemtype = e.target.nodeName;
	elemtype = elemtype.toUpperCase();
	var checker_IMG = '';
	if (elemtype == "IMG" && checker_IMG == 'checked' && e.detail >= 2) {show_wpcp_message(alertMsg_IMG);return false;}
    if (elemtype != "TEXT" && elemtype != "TEXTAREA" && elemtype != "INPUT" && elemtype != "PASSWORD" && elemtype != "SELECT")
	{
		if (smessage !== "" && e.detail >= 2)
			show_wpcp_message(smessage);
		return false;
	}	
}
function disable_copy_ie()
{
	var elemtype = window.event.srcElement.nodeName;
	elemtype = elemtype.toUpperCase();
	if (elemtype == "IMG") {show_wpcp_message(alertMsg_IMG);return false;}
	if (elemtype != "TEXT" && elemtype != "TEXTAREA" && elemtype != "INPUT" && elemtype != "PASSWORD" && elemtype != "SELECT")
	{
		//alert(navigator.userAgent.indexOf('MSIE'));
			//if (smessage !== "") show_wpcp_message(smessage);
		return false;
	}
}	
function reEnable()
{
	return true;
}
document.onkeydown = disableEnterKey;
document.onselectstart = disable_copy_ie;
if(navigator.userAgent.indexOf('MSIE')==-1)
{
	document.onmousedown = disable_copy;
	document.onclick = reEnable;
}
function disableSelection(target)
{
    //For IE This code will work
    if (typeof target.onselectstart!="undefined")
    target.onselectstart = disable_copy_ie;
    
    //For Firefox This code will work
    else if (typeof target.style.MozUserSelect!="undefined")
    {target.style.MozUserSelect="none";}
    
    //All other  (ie: Opera) This code will work
    else
    target.onmousedown=function(){return false}
    target.style.cursor = "default";
}
//Calling the JS function directly just after body load
window.onload = function(){disableSelection(document.body);};

/* second script element */
document.ondragstart = function() { return false;}
/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Disable context menu on images by GreenLava Version 1.0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */
function nocontext(e) {
   return false;
}
document.oncontextmenu = nocontext;

/* third script element */
var e = document.getElementsByTagName('body')[0];
e.setAttribute('unselectable',on);
Above, I have copied the relevant code that the site uses.

Below, here's a UserScript I developed:

Code: Select all

// ==UserScript==
// @name        Unlock Hulusuk
// @author      James Lewis
// @namespace   https://greasyfork.org/
// @icon        http://hulusuk.com/wp-content/uploads/2015/06/itunes10_white-557bd15av1_site_icon-128x128.png
// @version     0.1
// @description Allows users of Hulusuk to once again right-click, select text, and view source
// @include     http://hulusuk.com/*
// @include     http://*.hulusuk.com/*
// @include     https://hulusuk.com/*
// @include     https://*.hulusuk.com/*
// @grant       none
// @run-at      document-end
// ==/UserScript==

var body = document.body || document.getElementsByTagName('body')[0];

document.onkeydown =
  document.onselectstart =
  document.onmousedown =
  document.onclick =
  document.ondragstart =
  document.oncontextmenu =
  body.onselectstart =
  body.onmousedown =
    null;

disableEnterKey =
  disable_copy =
  disable_copy_ie =
  reEnable =
  disableSelection =
  nocontext = 
    function Empty() {};

if (typeof body.style.MozUserSelect !== 'undefined') {
  body.style.MozUserSelect = 'text';
}

body.setAttribute('unselectable', 'off');
This removes all of those event handlers, and for good measure also reassigns all the helper functions to the same empty function; then it allows the body to be selected, in two different ways.
There's a buzzin' in my brain I really can't explain; I think about it before they make me go to bed.
enbob
Posts: 408
Joined: Fri Oct 30, 2009 1:45 am

Re: hulusuk - protected page

Post by enbob »

Awesome, thank you!
Locked