Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
InsertNode
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
project
InsertNode
Commits
2a43416c
Commit
2a43416c
authored
16 years ago
by
AlexisWilke
Browse files
Options
Downloads
Patches
Plain Diff
Changed the use of the cookie with the better, cleaner use of the
?destination=... option
parent
76b7faf6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
back_from_comment.js
+12
-26
12 additions, 26 deletions
back_from_comment.js
insert_node.module
+4
-1
4 additions, 1 deletion
insert_node.module
with
16 additions
and
27 deletions
back_from_comment.js
+
12
−
26
View file @
2a43416c
/* Code by Zewa */
/* Code first created by Zewa,
* fixed up by AlexisWilke so it works with any type of page
*/
/**
* Reply button for comments.
* Reply
, Edit & Delete
button
s
for
included
comments.
*
* Store where the user was when clicking add comment or reply,
* and bring him back there afterwards.
* and bring him
or her
back there afterwards.
*/
$
(
"
a[href*='comment/reply']
"
).
click
(
function
()
{
$
.
cookie
(
'
reply_topic_url
'
,
location
.
href
);
});
$
(
"
a[href*='comment/edit']
"
).
click
(
function
()
{
$
.
cookie
(
'
reply_topic_url
'
,
location
.
href
);
});
$
(
"
a[href*='comment/delete']
"
).
click
(
function
()
{
$
.
cookie
(
'
reply_topic_url
'
,
location
.
href
);
});
/**
* Check on each forum site.
* When the cookie has been placed, we know a forum thread was created.
*/
$
(
"
div[class='breadcrumb']
"
).
children
().
each
(
function
(){
if
(
$
(
this
).
attr
(
"
href
"
)
==
'
/drupal/?q=forum
'
)
{
var
loc
=
$
.
cookie
(
'
reply_topic_url
'
);
if
(
loc
!=
null
&&
loc
!=
undefined
)
{
$
.
cookie
(
'
reply_topic_url
'
,
""
);
document
.
location
.
href
=
loc
+
'
#attached_comment_start
'
;
}
}
});
function
node_insert_destination
(
link
){
attr
=
jQuery
(
link
).
attr
(
'
href
'
);
attr
+=
attr
.
indexOf
(
'
?
'
)
==-
1
?
'
?
'
:
'
&
'
;
url
=
location
.
pathname
.
substring
(
1
);
jQuery
(
link
).
attr
(
'
href
'
,
attr
+
'
destination=
'
+
url
);
}
jQuery
(
"
a[href*='comment/reply'],a[href*='comment/edit'],a[href*='comment/delete']
"
).
click
(
function
(){
node_insert_destination
(
this
);});
This diff is collapsed.
Click to expand it.
insert_node.module
+
4
−
1
View file @
2a43416c
...
...
@@ -9,7 +9,10 @@
function
insert_node_init
()
{
// If you experience side effects, feel free to comment out this add.
// All you lose is the coming back to the node including the comment.
drupal_add_js
(
drupal_get_path
(
'module'
,
'insert_node'
)
.
'/back_from_comment.js'
);
if
(
function_exists
(
'jquery_plugin_add'
))
{
jquery_plugin_add
(
'cookie'
);
drupal_add_js
(
drupal_get_path
(
'module'
,
'insert_node'
)
.
'/back_from_comment.js'
);
}
}
/**
...
...
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