Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
copyprevention-3429625
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
copyprevention-3429625
Commits
da89ff2d
Commit
da89ff2d
authored
11 years ago
by
Andrew Berezovsky
Browse files
Options
Downloads
Patches
Plain Diff
Added disabling on context menu on images
Added uninstall function to delete variables
parent
bb017860
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
copyprevention.admin.inc
+12
-3
12 additions, 3 deletions
copyprevention.admin.inc
copyprevention.install
+13
-0
13 additions, 0 deletions
copyprevention.install
copyprevention.js
+5
-0
5 additions, 0 deletions
copyprevention.js
copyprevention.module
+7
-3
7 additions, 3 deletions
copyprevention.module
with
37 additions
and
6 deletions
copyprevention.admin.inc
+
12
−
3
View file @
da89ff2d
...
...
@@ -9,13 +9,22 @@ function copyprevention_settings_form() {
'#type'
=>
'checkboxes'
,
'#title'
=>
t
(
'Body tag attributes'
),
'#options'
=>
array
(
'selectstart'
=>
t
(
'
Add
onselectstart="return false;"'
),
'copy'
=>
t
(
'
Add
oncopy="return false;"'
),
'contextmenu'
=>
t
(
'
Add
oncontextmenu="return false;"'
),
'selectstart'
=>
t
(
'
Disable text selection:
onselectstart="return false;"'
),
'copy'
=>
t
(
'
Disable copy to clipboard operation:
oncopy="return false;"'
),
'contextmenu'
=>
t
(
'
Disable right-click context menu:
oncontextmenu="return false;"'
),
),
'#default_value'
=>
variable_get
(
'copyprevention_body'
,
array
()),
'#description'
=>
t
(
'Apply these attributes to body tag.'
),
);
$form
[
'copyprevention_images'
]
=
array
(
'#type'
=>
'checkboxes'
,
'#title'
=>
t
(
'Images protection'
),
'#options'
=>
array
(
'contextmenu'
=>
t
(
'Disable right-click context menu: oncontextmenu="return false;"'
),
),
'#default_value'
=>
variable_get
(
'copyprevention_images'
,
array
()),
'#description'
=>
t
(
'Apply these attributes to images.'
),
);
return
system_settings_form
(
$form
);
}
This diff is collapsed.
Click to expand it.
copyprevention.install
0 → 100644
+
13
−
0
View file @
da89ff2d
<?php
/**
* @file
* Install and uninstall functions for Copy Prevention module.
*/
/**
* Implements hook_uninstall().
*/
function
copyprevention_uninstall
()
{
variable_del
(
'copyprevention_body'
);
variable_del
(
'copyprevention_images'
);
}
This diff is collapsed.
Click to expand it.
copyprevention.js
+
5
−
0
View file @
da89ff2d
...
...
@@ -7,6 +7,11 @@
return
false
;
});
});
$
.
each
(
Drupal
.
settings
.
copyprevention
.
images
,
function
(
index
,
value
)
{
$
(
'
img
'
).
bind
(
value
,
function
(
event
)
{
return
false
;
});
});
};
})(
jQuery
);
This diff is collapsed.
Click to expand it.
copyprevention.module
+
7
−
3
View file @
da89ff2d
...
...
@@ -53,14 +53,18 @@ function copyprevention_preprocess_html(&$vars) {
*/
function
copyprevention_page_build
(
&
$page
)
{
if
(
user_access
(
'bypass copy prevention'
))
{
return
;
//
return;
}
$body_settings
=
array_filter
(
variable_get
(
'copyprevention_body'
,
array
()));
$copyprevention_body
=
array_filter
(
variable_get
(
'copyprevention_body'
,
array
()));
$copyprevention_images
=
array_filter
(
variable_get
(
'copyprevention_images'
,
array
()));
$region
=
array_shift
(
element_children
(
$page
));
$page
[
$region
][
'#attached'
][
'js'
][]
=
array
(
'data'
=>
array
(
'copyprevention'
=>
array
(
'body'
=>
$body_settings
),
'copyprevention'
=>
array
(
'body'
=>
$copyprevention_body
,
'images'
=>
$copyprevention_images
,
),
),
'type'
=>
'setting'
,
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment