Login اسم المستخدم أو البريد الإلكتروني * كلمة المرور * تذكرنى var image_save_msg = 'You are not allowed to save images!'; var no_menu_msg = 'Context menu disabled!'; var smessage = "تنبيه: لا يُسمح لك بنسخ المحتوى"; "use strict"; /* This because search property "includes" does not supported by IE*/ if (!String.prototype.includes) { String.prototype.includes = function(search, start) { if (typeof start !== 'number') { start = 0; } if (start + search.length > this.length) { return false; } else { return this.indexOf(search, start) !== -1; } }; } /*////////////////////////////////////*/ let canCall = true; function call_disable_copy_WithDelay(e) { if (canCall) { canCall = false; disable_copy(e); setTimeout(() => { canCall = true; }, 1000); } } function disable_copy(e) { window.wccp_pro_iscontenteditable_flag = false; wccp_pro_log_to_console_if_allowed("disable_copy"); var e = e || window.event; // also there is no e.target property in IE. instead IE uses window.event.srcElement var target = e.target || e.srcElement; var elemtype = e.target.nodeName; elemtype = elemtype.toUpperCase(); if (apply_class_exclusion(e) == "Yes") return true; if(wccp_pro_iscontenteditable(e) == true) {return true;} if(is_content_editable_element(current_clicked_element) == true) { return true; } else { if (smessage !== "" && e.detail == 2) show_wccp_pro_message(smessage); if (isSafari) { return true; } else { //wccp_pro_clear_any_selection(); return false; } } /*disable context menu when shift + right click is pressed*/ var shiftPressed = 0; var evt = e?e:window.event; if (parseInt(navigator.appVersion)>3) { if (document.layers && navigator.appName=="Netscape") shiftPressed = (e.modifiers-0>3); else shiftPressed = e.shiftKey; if (shiftPressed) { if (smessage !== "") show_wccp_pro_message(smessage); var isFirefox = typeof InstallTrigger !== 'undefined'; /* Firefox 1.0+ */ if (isFirefox) { evt.cancelBubble = true; if (evt.stopPropagation) evt.stopPropagation(); if (evt.preventDefault()) evt.preventDefault(); show_wccp_pro_message (smessage); wccp_pro_clear_any_selection(); return false; } wccp_pro_clear_any_selection(); return false; } } if(e.which === 2 ){ var clickedTag_a = (e==null) ? event.srcElement.tagName : e.target.tagName; show_wccp_pro_message(smessage); wccp_pro_clear_any_selection(); return false; } var isSafari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor); var checker_IMG = 'checked'; if (elemtype == "IMG" && checker_IMG == 'checked' && e.detail == 2) {show_wccp_pro_message(alertMsg_IMG);wccp_pro_clear_any_selection();return false;} //elemtype must be merged by elemtype checker on function disable_copy & disable_hot_keys if (is_content_editable_element(elemtype) == false) { if (smessage !== "" && e.detail == 2) show_wccp_pro_message(smessage); if (isSafari) { return true; } else { wccp_pro_clear_any_selection(); return false; } } else { return true; } } //////////////////////////// function disable_copy_ie() { wccp_pro_log_to_console_if_allowed("disable_copy_ie_function_started"); var e = e || window.event; /*also there is no e.target property in IE.*/ /*instead IE uses window.event.srcElement*/ var target = e.target || e.srcElement; var elemtype = window.event.srcElement.nodeName; elemtype = elemtype.toUpperCase(); if(wccp_pro_iscontenteditable(e) == true) return true; if (apply_class_exclusion(e) == "Yes") return true; if (elemtype == "IMG") {show_wccp_pro_message(alertMsg_IMG);return false;} //elemtype must be merged by elemtype checker on function disable_copy & disable_hot_keys if (is_content_editable_element(elemtype) == false) { return false; } } function disable_drag_text(e) { wccp_pro_log_to_console_if_allowed("disable_drag_text"); /*var isSafari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);*/ /*if (isSafari) {show_wccp_pro_message(alertMsg_IMG);return false;}*/ var e = e || window.event; // also there is no e.target property in IE. instead IE uses window.event.srcElement*/ var target = e.target || e.srcElement; /*For contenteditable tags*/ if (apply_class_exclusion(e) == "Yes") return true; var elemtype = e.target.nodeName; elemtype = elemtype.toUpperCase(); var disable_drag_text_drop = 'checked'; if (disable_drag_text_drop != "checked") return true; if (window.location.href.indexOf("/user/") > -1) { return true; /*To allow users to drag & drop images when editing thier profiles*/ } return false; } /*/////////////////special for safari Start////////////////*/ var onlongtouch; var timer; var touchduration = 1000; /*length of time we want the user to touch before we do something*/ var elemtype = ""; function touchstart(e) { wccp_pro_log_to_console_if_allowed("touchstart"); e = e || window.event;// also there is no e.target property in IE. instead IE uses window.event.srcElement var target = e.target || e.srcElement; var elemtype = e.target.nodeName; elemtype = elemtype.toUpperCase(); //if (elemtype == "A") return; if (apply_class_exclusion(elemtype) == 'Yes') return; /*also there is no e.target property in IE.*/ /*instead IE uses window.event.srcElement*/ if(!wccp_pro_is_passive()) e.preventDefault(); if (!timer) { timer = setTimeout(onlongtouch, touchduration); } } function touchend() { wccp_pro_log_to_console_if_allowed("touchend"); /*stops short touches from firing the event*/ if (timer) { clearTimeout(timer); timer = null; } onlongtouch(); } onlongtouch = function(e)/*this will clear the current selection if any_not_editable_thing selected*/ { wccp_pro_log_to_console_if_allowed("onlongtouch"); if (is_content_editable_element(elemtype) == false) { if (window.getSelection) { if (window.getSelection().empty) { /*Chrome*/ window.getSelection().empty(); } else if (window.getSelection().removeAllRanges) { /*Firefox*/ window.getSelection().removeAllRanges(); } } else if (document.selection) { /*IE?*/ var textRange = document.body.createTextRange(); textRange.moveToElementText(element); textRange.select(); document.selection.empty(); } return false; } }; document.addEventListener("DOMContentLoaded", function(event) { window.addEventListener("touchstart", touchstart, false); window.addEventListener("touchend", touchend, false); }); function wccp_pro_is_passive() { wccp_pro_log_to_console_if_allowed("wccp_pro_is_passive"); var cold = false, hike = function() {}; try { var aid = Object.defineProperty({}, 'passive', { get() {cold = true} }); window.addEventListener('test', hike, aid); window.removeEventListener('test', hike, aid); } catch (e) {} return cold; } /*/////////////////////////////////////////////////////////////////*/ function reEnable() { return true; } if(navigator.userAgent.indexOf('MSIE')==-1) //If not IE { document.ondragstart = disable_drag_text; document.onselectstart = call_disable_copy_WithDelay; document.onselectionchange = call_disable_copy_WithDelay; //document.onmousedown = disable_copy; //document.addEventListener('click', disable_copy, false); //document.addEventListener('click', set_current_clicked_element, false); document.addEventListener('mousedown', set_current_clicked_element, false); //document.onclick = reEnable; }else { document.onselectstart = disable_copy_ie; } var current_clicked_element = ""; var current_clicked_object = null; function set_current_clicked_element(e) { var e = e || window.event; // also there is no e.target property in IE. instead IE uses window.event.srcElement var target = e.target || e.srcElement; var elemtype = e.target.nodeName; elemtype = elemtype.toUpperCase(); current_clicked_element = elemtype; wccp_pro_log_to_console_if_allowed("current_clicked_element = " + current_clicked_element, arguments.callee.name); } function wccp_pro_nocontext(e) { wccp_pro_log_to_console_if_allowed("wccp_pro_nocontext function"); const caller = wccp_pro_nocontext.caller; if (caller) wccp_pro_log_to_console_if_allowed("Caller function is: " + caller.name); e = e || window.event; // also there is no e.target property in IE. instead IE uses window.event.srcElement if (apply_class_exclusion(e) == 'Yes') return true; var exception_tags = 'NOTAG,'; var clickedTag = (e==null) ? event.srcElement.tagName : e.target.tagName; wccp_pro_log_to_console_if_allowed("clickedTag: " + clickedTag); var target = e.target || e.srcElement; var parent_tag = ""; var parent_of_parent_tag = ""; if(target.parentElement != null) { parent_tag = target.parentElement.tagName; if(target.parentElement.parentElement != null) parent_of_parent_tag = target.parentElement.parentElement.tagName; } var checker = 'checked'; if ((clickedTag == "IMG" || clickedTag == "FIGURE" || clickedTag == "SVG" || clickedTag == "PROTECTEDIMGDIV") && checker == 'checked') { if (alertMsg_IMG != "")show_wccp_pro_message(alertMsg_IMG); return false; }else {exception_tags = exception_tags + 'IMG,';} checker = ''; if ((clickedTag == "VIDEO" || clickedTag == "PROTECTEDWCCPVIDEO" || clickedTag == "EMBED") && checker == 'checked') { if (alertMsg_VIDEO != "")show_wccp_pro_message(alertMsg_VIDEO); return false; }else {exception_tags = exception_tags + 'VIDEO,PROTECTEDWCCPVIDEO,EMBED,';} checker = 'checked'; if ((clickedTag == "A" || clickedTag == "TIME" || parent_tag == "A" || parent_of_parent_tag == "A") && checker == 'checked') { if (alertMsg_A != "")show_wccp_pro_message(alertMsg_A); return false; }else {exception_tags = exception_tags + 'A,';if(parent_tag == "A" || parent_of_parent_tag == "A") clickedTag = "A";} checker = 'checked'; if ((clickedTag == "P" || clickedTag == "B" || clickedTag == "FONT" || clickedTag == "LI" || clickedTag == "UL" || clickedTag == "STRONG" || clickedTag == "OL" || clickedTag == "BLOCKQUOTE" || clickedTag == "TH" || clickedTag == "TR" || clickedTag == "TD" || clickedTag == "SPAN" || clickedTag == "EM" || clickedTag == "SMALL" || clickedTag == "I" || clickedTag == "BUTTON") && checker == 'checked') { if (alertMsg_PB != "")show_wccp_pro_message(alertMsg_PB); return false; }else {exception_tags = exception_tags + 'P,B,FONT,LI,UL,STRONG,OL,BLOCKQUOTE,TD,SPAN,EM,SMALL,I,BUTTON,';} checker = 'checked'; if ((clickedTag == "INPUT" || clickedTag == "PASSWORD") && checker == 'checked') { if (alertMsg_INPUT != "")show_wccp_pro_message(alertMsg_INPUT); return false; }else {exception_tags = exception_tags + 'INPUT,PASSWORD,';} checker = 'checked'; if ((clickedTag == "H1" || clickedTag == "H2" || clickedTag == "H3" || clickedTag == "H4" || clickedTag == "H5" || clickedTag == "H6" || clickedTag == "ASIDE" || clickedTag == "NAV") && checker == 'checked') { if (alertMsg_H != "")show_wccp_pro_message(alertMsg_H); return false; }else {exception_tags = exception_tags + 'H1,H2,H3,H4,H5,H6,';} checker = 'checked'; if (clickedTag == "TEXTAREA" && checker == 'checked') { if (alertMsg_TEXTAREA != "")show_wccp_pro_message(alertMsg_TEXTAREA); return false; }else {exception_tags = exception_tags + 'TEXTAREA,';} checker = 'checked'; if ((clickedTag == "DIV" || clickedTag == "BODY" || clickedTag == "HTML" || clickedTag == "ARTICLE" || clickedTag == "SECTION" || clickedTag == "NAV" || clickedTag == "HEADER" || clickedTag == "FOOTER") && checker == 'checked') { if (alertMsg_EmptySpaces != "")show_wccp_pro_message(alertMsg_EmptySpaces); return false; } else { if (exception_tags.indexOf(clickedTag)!=-1) { return true; } else return false; } } function disable_drag_images(e) {return; wccp_pro_log_to_console_if_allowed("disable_drag_images"); var e = e || window.event; // also there is no e.target property in IE. instead IE uses window.event.srcElement var target = e.target || e.srcElement; //For contenteditable tags if (apply_class_exclusion(e) == "Yes") return true; var elemtype = e.target.nodeName; if (elemtype != "IMG") {return;} elemtype = elemtype.toUpperCase(); var disable_drag_drop_images = 'checked'; if (disable_drag_drop_images != "checked") return true; if (window.location.href.indexOf("/user/") > -1) { return true; //To allow users to drag & drop images when editing thier profiles } show_wccp_pro_message(alertMsg_IMG); return false; } var alertMsg_IMG = "Alert: Protected image"; var alertMsg_A = "Alert: This link is protected"; var alertMsg_PB = "Alert: Right click on text is disabled"; var alertMsg_INPUT = "Alert: Right click is disabled"; var alertMsg_H = "Alert: Right click on headlines is disabled"; var alertMsg_TEXTAREA = "Alert: Right click is disabled"; var alertMsg_EmptySpaces = "Alert: Right click on empty spaces is disabled"; var alertMsg_VIDEO = "Alert: Right click on videos is disabled"; //document.oncontextmenu=null; window.addEventListener('load', function (){ if(window.Zepto || !window.jQuery) jQuery = $; jQuery(document).ready(function(){ jQuery(document).on('contextmenu', wccp_pro_nocontext); }); }); window.addEventListener('load', function (){ if (typeof jQuery === 'undefined') { alert("no jquery"); document.oncontextmenu = wccp_pro_nocontext; document.addEventListener("contextmenu",wccp_pro_nocontext); window.addEventListener("contextmenu",wccp_pro_nocontext); } }); تسجيل الدخول هل نسيت كلمة المرور الخاصة بك؟