Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
a14197f1
Commit
a14197f1
authored
16 years ago
by
Dmitry Katsubo
Browse files
Options
Downloads
Patches
Plain Diff
preserve "wrap textarea" setting state in cookie
darcs-hash:20081007192342-2c343-ea27e0a0396da425af69a6d0fcd8857b033cb8e6.gz
parent
33ec8c3f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/scripts/script.js
+28
-13
28 additions, 13 deletions
lib/scripts/script.js
with
28 additions
and
13 deletions
lib/scripts/script.js
+
28
−
13
View file @
a14197f1
...
...
@@ -411,6 +411,11 @@ function initSizeCtl(ctlid,edid){
textarea
.
style
.
height
=
'
300px
'
;
}
var
wrp
=
DokuCookie
.
getValue
(
'
wrapCtl
'
);
if
(
wrp
){
setWrap
(
textarea
,
wrp
);
}
// else use default value
var
l
=
document
.
createElement
(
'
img
'
);
var
s
=
document
.
createElement
(
'
img
'
);
var
w
=
document
.
createElement
(
'
img
'
);
...
...
@@ -439,25 +444,35 @@ function sizeCtl(edid,val){
/**
* Toggle the wrapping mode of a textarea
*
* @author Fluffy Convict <fluffyconvict@hotmail.com>
* @link http://news.hping.org/comp.lang.javascript.archive/12265.html
* @author <shutdown@flashmail.com>
* @link https://bugzilla.mozilla.org/show_bug.cgi?id=302710#c2
*/
function
toggleWrap
(
edid
){
var
txtarea
=
$
(
edid
);
var
wrap
=
txtarea
.
getAttribute
(
'
wrap
'
);
var
t
e
xtarea
=
$
(
edid
);
var
wrap
=
t
e
xtarea
.
getAttribute
(
'
wrap
'
);
if
(
wrap
&&
wrap
.
toLowerCase
()
==
'
off
'
){
txtarea
.
setAttribute
(
'
wrap
'
,
'
soft
'
);
setWrap
(
textarea
,
'
soft
'
);
}
else
{
txtarea
.
setAttribute
(
'
wrap
'
,
'
off
'
);
setWrap
(
textarea
,
'
off
'
);
}
DokuCookie
.
setValue
(
'
wrapCtl
'
,
textarea
.
getAttribute
(
'
wrap
'
));
}
/**
* Set the wrapping mode of a textarea
*
* @author Fluffy Convict <fluffyconvict@hotmail.com>
* @author <shutdown@flashmail.com>
* @link http://news.hping.org/comp.lang.javascript.archive/12265.html
* @link https://bugzilla.mozilla.org/show_bug.cgi?id=41464
*/
function
setWrap
(
textarea
,
wrapAttrValue
){
textarea
.
setAttribute
(
'
wrap
'
,
wrapAttrValue
);
// Fix display for mozilla
var
parNod
=
txtarea
.
parentNode
;
var
nxtSib
=
txtarea
.
nextSibling
;
parNod
.
removeChild
(
txtarea
);
parNod
.
insertBefore
(
txtarea
,
nxtSib
);
var
parNod
=
t
e
xtarea
.
parentNode
;
var
nxtSib
=
t
e
xtarea
.
nextSibling
;
parNod
.
removeChild
(
t
e
xtarea
);
parNod
.
insertBefore
(
t
e
xtarea
,
nxtSib
);
}
/**
...
...
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