manuscript 0.2.3 → 0.3.9pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +23 -0
- data/Rakefile +7 -5
- data/VERSION +1 -1
- data/config.ru +18 -4
- data/lib/manuscript.rb +18 -5
- data/lib/manuscript/design_manager.rb +87 -0
- data/lib/manuscript/keymaster.rb +1 -2
- data/lib/manuscript/page.rb +2 -2
- data/lib/manuscript/page_manager.rb +1 -0
- data/lib/manuscript/settings.rb +30 -0
- data/lib/manuscript/settings_manager.rb +17 -0
- data/lib/manuscript/template_file.rb +10 -3
- data/lib/manuscript/views/_page.haml +8 -0
- data/lib/manuscript/views/design.haml +29 -0
- data/lib/manuscript/views/edit_template_file.haml +7 -0
- data/{views → lib/manuscript/views}/layout.haml +1 -1
- data/lib/manuscript/views/menu.haml +16 -0
- data/lib/manuscript/views/new_template_file.haml +6 -0
- data/{views → lib/manuscript/views}/page.haml +7 -6
- data/lib/manuscript/views/pages.haml +7 -0
- data/lib/manuscript/views/settings.haml +10 -0
- data/{views → lib/manuscript/views}/template.haml +5 -9
- data/manuscript.gemspec +35 -23
- data/public/css/base.css +82 -14
- data/public/css/wmd.css +133 -0
- data/public/images/buttonbg.png +0 -0
- data/public/images/wmd-buttons.png +0 -0
- data/public/js/wmd.min.js +1 -0
- data/spec/manuscript/{template_manager_spec.rb → design_manager_spec.rb} +9 -9
- data/spec/manuscript/page_manager_spec.rb +2 -2
- data/spec/manuscript/settings_manager_spec.rb +21 -0
- data/spec/manuscript/settings_spec.rb +19 -0
- data/spec/spec_helper.rb +3 -0
- metadata +126 -56
- data/lib/manuscript/template_file_manager.rb +0 -53
- data/lib/manuscript/template_manager.rb +0 -44
- data/spec/manuscript/template_file_manager_spec.rb +0 -10
- data/views/_page.haml +0 -10
- data/views/edit_template_file.haml +0 -9
- data/views/menu.haml +0 -16
- data/views/new_template_file.haml +0 -7
- data/views/pages.haml +0 -6
- data/views/template_files.haml +0 -9
- data/views/templates.haml +0 -15
@@ -0,0 +1,10 @@
|
|
1
|
+
%h1 Settings
|
2
|
+
%form#settings{:method =>:post, 'accept-charset' => "utf-8", :action => '/admin/settings', :style => "display:block;float: left;width: 400px;"}
|
3
|
+
%fieldset
|
4
|
+
%ol
|
5
|
+
%li
|
6
|
+
%label
|
7
|
+
Site name
|
8
|
+
%input{:type => "text", :name => "settings[site_name]", :id => "settings_site_name", :value => @settings[:site_name] }
|
9
|
+
%li
|
10
|
+
%input{:type => "submit", :value => "Update settings"}
|
@@ -1,17 +1,13 @@
|
|
1
|
-
%
|
2
|
-
%a{ :href => "/admin/templates" } « back
|
3
|
-
|
1
|
+
%h1 Site design
|
4
2
|
- if @template.layout?
|
5
|
-
%
|
3
|
+
%h2 Edit layout
|
6
4
|
- else
|
7
|
-
%
|
8
|
-
|
9
|
-
%form{:method =>:post, 'accept-charset' => "utf-8", :action => "/admin/#{(@template.layout?&&@template.new_record?) ? "layouts" : "templates"}/#{@template.id unless @template.new_record?}"}
|
5
|
+
%h2 Edit template
|
6
|
+
%form{:method =>:post, 'accept-charset' => "utf-8", :action => "/admin/design/#{(@template.layout?&&@template.new_record?) ? "layouts" : "templates"}/#{@template.id unless @template.new_record?}"}
|
10
7
|
- unless @template.new_record?
|
11
8
|
%input{ :type => :hidden, :name => "_method", :value => :put }
|
12
9
|
%fieldset
|
13
|
-
%
|
14
|
-
%input{ :type => :submit }
|
10
|
+
%input{ :type => :submit, :class => "btn large blue", :value => "Save" }
|
15
11
|
%label
|
16
12
|
Name
|
17
13
|
%input{:type => :text, :name => "template[name]", :value => "#{@template.name}"}
|
data/manuscript.gemspec
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{manuscript}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.9pre"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["
|
12
|
-
s.date = %q{2010-
|
11
|
+
s.authors = ["Chris Dinn"]
|
12
|
+
s.date = %q{2010-04-27}
|
13
13
|
s.description = %q{A gem for publishing a small Hot Ink authenticated site}
|
14
|
-
s.email = %q{
|
14
|
+
s.email = %q{chrisgdinn@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
17
|
"README.rdoc"
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
|
+
"Gemfile",
|
22
23
|
"LICENSE",
|
23
24
|
"README.rdoc",
|
24
25
|
"Rakefile",
|
@@ -32,54 +33,59 @@ Gem::Specification.new do |s|
|
|
32
33
|
"db/migrate/006_add_parent_to_pages.rb",
|
33
34
|
"lib/manuscript.rb",
|
34
35
|
"lib/manuscript/base.rb",
|
36
|
+
"lib/manuscript/design_manager.rb",
|
35
37
|
"lib/manuscript/keymaster.rb",
|
36
38
|
"lib/manuscript/layout_template.rb",
|
37
39
|
"lib/manuscript/page.rb",
|
38
40
|
"lib/manuscript/page_manager.rb",
|
39
41
|
"lib/manuscript/page_template.rb",
|
42
|
+
"lib/manuscript/settings.rb",
|
43
|
+
"lib/manuscript/settings_manager.rb",
|
40
44
|
"lib/manuscript/template.rb",
|
41
45
|
"lib/manuscript/template_file.rb",
|
42
|
-
"lib/manuscript/template_file_manager.rb",
|
43
|
-
"lib/manuscript/template_manager.rb",
|
44
46
|
"lib/manuscript/user.rb",
|
47
|
+
"lib/manuscript/views/_page.haml",
|
48
|
+
"lib/manuscript/views/design.haml",
|
49
|
+
"lib/manuscript/views/edit_template_file.haml",
|
50
|
+
"lib/manuscript/views/layout.haml",
|
51
|
+
"lib/manuscript/views/menu.haml",
|
52
|
+
"lib/manuscript/views/new_template_file.haml",
|
53
|
+
"lib/manuscript/views/page.haml",
|
54
|
+
"lib/manuscript/views/pages.haml",
|
55
|
+
"lib/manuscript/views/settings.haml",
|
56
|
+
"lib/manuscript/views/template.haml",
|
45
57
|
"manuscript.gemspec",
|
46
58
|
"public/css/base.css",
|
59
|
+
"public/css/wmd.css",
|
60
|
+
"public/images/buttonbg.png",
|
61
|
+
"public/images/wmd-buttons.png",
|
62
|
+
"public/js/wmd.min.js",
|
47
63
|
"spec/manuscript/base_spec.rb",
|
64
|
+
"spec/manuscript/design_manager_spec.rb",
|
48
65
|
"spec/manuscript/layout_template_spec.rb",
|
49
66
|
"spec/manuscript/page_manager_spec.rb",
|
50
67
|
"spec/manuscript/page_spec.rb",
|
51
68
|
"spec/manuscript/page_template_spec.rb",
|
52
|
-
"spec/manuscript/template_file_manager_spec.rb",
|
53
69
|
"spec/manuscript/template_file_spec.rb",
|
54
|
-
"spec/manuscript/template_manager_spec.rb",
|
55
70
|
"spec/manuscript/user_spec.rb",
|
56
71
|
"spec/spec.opts",
|
57
|
-
"spec/spec_helper.rb"
|
58
|
-
"views/_page.haml",
|
59
|
-
"views/edit_template_file.haml",
|
60
|
-
"views/layout.haml",
|
61
|
-
"views/menu.haml",
|
62
|
-
"views/new_template_file.haml",
|
63
|
-
"views/page.haml",
|
64
|
-
"views/pages.haml",
|
65
|
-
"views/template.haml",
|
66
|
-
"views/template_files.haml",
|
67
|
-
"views/templates.haml"
|
72
|
+
"spec/spec_helper.rb"
|
68
73
|
]
|
69
|
-
s.homepage = %q{http://github.com/
|
74
|
+
s.homepage = %q{http://github.com/chrisdinn/manuscript}
|
70
75
|
s.rdoc_options = ["--charset=UTF-8"]
|
71
76
|
s.require_paths = ["lib"]
|
72
|
-
s.rubygems_version = %q{1.3.
|
77
|
+
s.rubygems_version = %q{1.3.6}
|
73
78
|
s.summary = %q{A gem for publishing a small Hot Ink authenticated site}
|
74
79
|
s.test_files = [
|
75
80
|
"spec/manuscript/base_spec.rb",
|
81
|
+
"spec/manuscript/design_manager_spec.rb",
|
76
82
|
"spec/manuscript/layout_template_spec.rb",
|
77
83
|
"spec/manuscript/page_manager_spec.rb",
|
78
84
|
"spec/manuscript/page_spec.rb",
|
79
85
|
"spec/manuscript/page_template_spec.rb",
|
80
|
-
"spec/manuscript/
|
86
|
+
"spec/manuscript/settings_manager_spec.rb",
|
87
|
+
"spec/manuscript/settings_spec.rb",
|
81
88
|
"spec/manuscript/template_file_spec.rb",
|
82
|
-
"spec/manuscript/template_manager_spec.rb",
|
83
89
|
"spec/manuscript/user_spec.rb",
|
84
90
|
"spec/spec_helper.rb"
|
85
91
|
]
|
@@ -89,8 +95,10 @@ Gem::Specification.new do |s|
|
|
89
95
|
s.specification_version = 3
|
90
96
|
|
91
97
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
98
|
+
s.add_runtime_dependency(%q<ruby-openid>, [">= 0"])
|
92
99
|
s.add_runtime_dependency(%q<activerecord>, [">= 2.3.5"])
|
93
100
|
s.add_runtime_dependency(%q<rdiscount>, [">= 1.3.5"])
|
101
|
+
s.add_runtime_dependency(%q<aws-s3>, [">= 0"])
|
94
102
|
s.add_runtime_dependency(%q<sinatra>, [">= 0.9.4"])
|
95
103
|
s.add_runtime_dependency(%q<haml>, [">= 2.2.12"])
|
96
104
|
s.add_runtime_dependency(%q<gatekeeper>, [">= 0.1.1"])
|
@@ -98,8 +106,10 @@ Gem::Specification.new do |s|
|
|
98
106
|
s.add_runtime_dependency(%q<paperclip>, [">= 2.3.1.1"])
|
99
107
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
100
108
|
else
|
109
|
+
s.add_dependency(%q<ruby-openid>, [">= 0"])
|
101
110
|
s.add_dependency(%q<activerecord>, [">= 2.3.5"])
|
102
111
|
s.add_dependency(%q<rdiscount>, [">= 1.3.5"])
|
112
|
+
s.add_dependency(%q<aws-s3>, [">= 0"])
|
103
113
|
s.add_dependency(%q<sinatra>, [">= 0.9.4"])
|
104
114
|
s.add_dependency(%q<haml>, [">= 2.2.12"])
|
105
115
|
s.add_dependency(%q<gatekeeper>, [">= 0.1.1"])
|
@@ -108,8 +118,10 @@ Gem::Specification.new do |s|
|
|
108
118
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
109
119
|
end
|
110
120
|
else
|
121
|
+
s.add_dependency(%q<ruby-openid>, [">= 0"])
|
111
122
|
s.add_dependency(%q<activerecord>, [">= 2.3.5"])
|
112
123
|
s.add_dependency(%q<rdiscount>, [">= 1.3.5"])
|
124
|
+
s.add_dependency(%q<aws-s3>, [">= 0"])
|
113
125
|
s.add_dependency(%q<sinatra>, [">= 0.9.4"])
|
114
126
|
s.add_dependency(%q<haml>, [">= 2.2.12"])
|
115
127
|
s.add_dependency(%q<gatekeeper>, [">= 0.1.1"])
|
data/public/css/base.css
CHANGED
@@ -1,27 +1,95 @@
|
|
1
|
+
@import "wmd.css";
|
2
|
+
|
1
3
|
body { font-size: 16px; color: #222; line-height: 1.1em; margin:0; font-family: "Helvetica Neue", verdana, tahoma, arial, sans-serif; }
|
2
|
-
div#page_container { width: 960px; margin: 5px
|
4
|
+
div#page_container { width: 960px; margin: 5px auto; }
|
5
|
+
|
6
|
+
a { color: #2821DC; text-decoration:none;}
|
7
|
+
a:hover { text-decoration:underline;}
|
8
|
+
|
9
|
+
h1 { font-size: 36px; font-weight: 200; padding-top: 15px; margin-top: 0; }
|
10
|
+
h2 { font-size: 27px; float: left; }
|
11
|
+
h1+h2 { clear: left; }
|
12
|
+
h1+a,h2+a { margin-top: 22px; margin-left: 20px; }
|
13
|
+
h1+a+ol, h2+a+ol { clear: left; }
|
14
|
+
fieldset { clear: left; }
|
3
15
|
|
4
16
|
ol#pages small { font-size: 65%;}
|
5
17
|
ol#pages small a { text-decoration: none; font-weight: 200;}
|
6
18
|
|
7
|
-
ol.menu {
|
8
|
-
|
9
|
-
|
10
|
-
|
19
|
+
ol.menu {
|
20
|
+
background: #222 url(/images/buttonbg.png) repeat-x;
|
21
|
+
float: right;
|
22
|
+
list-style: none;
|
23
|
+
padding: 7px 5px; margin: 5px 10px 15px 10px;
|
24
|
+
-moz-border-radius: 5px;
|
25
|
+
-webkit-border-radius: 5px;
|
26
|
+
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
|
27
|
+
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
|
28
|
+
border-bottom: 1px solid rgba(0,0,0,0.25);
|
29
|
+
}
|
30
|
+
ol.menu li { color: #8AA5FF; display: inline; margin: 0 9px; }
|
31
|
+
ol.menu li a { color: #EFEFEF; font-size: 15px; font-weight: lighter; text-shadow: 0 -1px 1px rgba(0,0,0,0.25);}
|
32
|
+
ol.menu li a:hover { text-decoration: none; color: #C9C9C9;}
|
33
|
+
ol.menu li.current a { font-weight: normal; color: #ED71C9; }
|
11
34
|
|
12
|
-
ol#pages small { font-size:
|
13
|
-
ol#pages small a { text-decoration: none; }
|
35
|
+
ol#pages small { font-size: 45%;}
|
14
36
|
|
15
|
-
ol#pages { list-style: none; font-size: 20px; margin:
|
37
|
+
ol#pages { list-style: none; font-size: 20px; margin: 15px 0; }
|
16
38
|
ol#pages ol { list-style: none; font-size: 20px; margin: 10px 0; }
|
17
|
-
ol#pages li { margin:
|
39
|
+
ol#pages li, ol#templates li, ol#layouts li { margin: 25px 0; font-weight: 600; }
|
40
|
+
|
41
|
+
ol#templates, ol#layouts { list-style: none; font-size: 23px; margin: 30px 0; }
|
42
|
+
ol#templates a, ol#layouts a { font-weight: lighter; }
|
43
|
+
ol#template_files { list-style: none; padding-left: 0; font-size: 18px; }
|
44
|
+
ol#template_files li { padding: 5px 0; }
|
18
45
|
|
19
46
|
form label { display:block; padding: 10px 0; }
|
47
|
+
form fieldset { border: 0;clear:both; padding: 0; }
|
48
|
+
form fieldset ol { list-style: none; }
|
20
49
|
form input[type="text"] { font-size: 20px; width: 600px; border: 1px solid #AAA; padding: 3px; }
|
21
|
-
form textarea { font-family: "andale mono", courier, tahoma,
|
50
|
+
form textarea { font-family: Menlo, Monaco, "andale mono", courier, tahoma, monospace; padding: 5px; font-size: 15px; width: 940px; height: 500px; }
|
22
51
|
form input[type="submit"] { float: right; }
|
23
52
|
|
24
|
-
|
25
|
-
.
|
26
|
-
|
27
|
-
|
53
|
+
/* WMD buttons */
|
54
|
+
#wmd-button-bar { width: 99.5%; margin: 0; padding: 0 2px 0 1px; border: 1px solid #999; border-width: 1px 1px 0 1px; background-color: #EFEFEF; -moz-border-radius-topleft:3px;-moz-border-radius-topright:3px;-webkit-border-top-left-radius:3px;-webkit-border-top-right-radius:3px;}
|
55
|
+
#wmd-button-bar ul { margin: 0; padding: 7px 0; }
|
56
|
+
#wmd-button-bar ul li { -moz-border-radius: 2px; -webkit-border-radius: 2px; }
|
57
|
+
.wmd-button {border: 1px solid #AAAAAA;}
|
58
|
+
#wmd-input { width:100%; border: 1px solid #999; margin-bottom: 30px; background-color: #F9F9F9; padding: 5px; font-family:georgia,"times new roman",times, serif; color:#333; font-size: 15px; line-height: 21px; }
|
59
|
+
|
60
|
+
/* Standard buttons */
|
61
|
+
|
62
|
+
.btn, .btn:visited {
|
63
|
+
background: #222 url(/images/buttonbg.png) repeat-x;
|
64
|
+
display: inline-block;
|
65
|
+
padding: 5px 10px 6px;
|
66
|
+
color: #fff;
|
67
|
+
text-decoration: none;
|
68
|
+
-moz-border-radius: 5px;
|
69
|
+
-webkit-border-radius: 5px;
|
70
|
+
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
|
71
|
+
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
|
72
|
+
text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
|
73
|
+
border-bottom: 1px solid rgba(0,0,0,0.25);
|
74
|
+
position: relative;
|
75
|
+
cursor: pointer;
|
76
|
+
}
|
77
|
+
.btn:hover { background-color: #111; color: #fff; }
|
78
|
+
.btn:active { top: 1px; }
|
79
|
+
.small.btn, .small.btn:visited { font-size: 11px; }
|
80
|
+
.btn, .btn:visited,
|
81
|
+
.medium.btn, .medium.btn:visited { font-size: 13px; font-weight: bold; line-height: 1; text-shadow: 0 -1px 1px rgba(0,0,0,0.25); }
|
82
|
+
.large.btn, .large.btn:visited { font-size: 14px; padding: 8px 14px 9px; }
|
83
|
+
|
84
|
+
.green.btn, .btn.btn:visited { background-color: #6BB427; }
|
85
|
+
.green.btn:hover { background-color: #579720; }
|
86
|
+
.blue.btn, .blue.btn:visited { background-color: #3637FF; }
|
87
|
+
.blue.btn:hover { background-color: #3132E9; }
|
88
|
+
.red.btn, .red.btn:visited { background-color: #E61102; }
|
89
|
+
.red.btn:hover { background-color: #C20E02; }
|
90
|
+
.pink.btn, .pink.btn:visited { background-color: #ED1B8C; }
|
91
|
+
.pink.btn:hover { background-color: #C81879; }
|
92
|
+
.orange.btn, .orange.btn:visited { background-color: #ff5c00; }
|
93
|
+
.orange.btn:hover { background-color: #d45500; }
|
94
|
+
.yellow.btn, .yellow.btn:visited { background-color: #ffb515; }
|
95
|
+
.yellow.btn:hover { background-color: #fc9200; }
|
data/public/css/wmd.css
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
.wmd-panel
|
2
|
+
{
|
3
|
+
margin-left: 25%;
|
4
|
+
margin-right: 25%;
|
5
|
+
width: 50%;
|
6
|
+
min-width: 500px;
|
7
|
+
}
|
8
|
+
|
9
|
+
#wmd-editor
|
10
|
+
{
|
11
|
+
background-color: Aquamarine;
|
12
|
+
}
|
13
|
+
|
14
|
+
#wmd-button-bar
|
15
|
+
{
|
16
|
+
width: 100%;
|
17
|
+
}
|
18
|
+
|
19
|
+
#wmd-input
|
20
|
+
{
|
21
|
+
height: 500px;
|
22
|
+
width: 100%;
|
23
|
+
background-color: Gainsboro;
|
24
|
+
border: 1px solid DarkGray;
|
25
|
+
}
|
26
|
+
|
27
|
+
#wmd-preview
|
28
|
+
{
|
29
|
+
background-color: LightSkyBlue;
|
30
|
+
}
|
31
|
+
|
32
|
+
#wmd-output
|
33
|
+
{
|
34
|
+
background-color: Pink;
|
35
|
+
}
|
36
|
+
|
37
|
+
#wmd-button-row
|
38
|
+
{
|
39
|
+
position: relative;
|
40
|
+
margin-left: 5px;
|
41
|
+
margin-right: 5px;
|
42
|
+
margin-bottom: 5px;
|
43
|
+
margin-top: 10px;
|
44
|
+
padding: 0px;
|
45
|
+
height: 20px;
|
46
|
+
}
|
47
|
+
|
48
|
+
.wmd-spacer
|
49
|
+
{
|
50
|
+
width: 1px;
|
51
|
+
height: 20px;
|
52
|
+
margin-left: 14px;
|
53
|
+
|
54
|
+
position: absolute;
|
55
|
+
background-color: Silver;
|
56
|
+
display: inline-block;
|
57
|
+
list-style: none;
|
58
|
+
}
|
59
|
+
|
60
|
+
.wmd-button
|
61
|
+
{
|
62
|
+
width: 20px;
|
63
|
+
height: 20px;
|
64
|
+
margin-left: 5px;
|
65
|
+
margin-right: 5px;
|
66
|
+
|
67
|
+
position: absolute;
|
68
|
+
background-image: url(/images/wmd-buttons.png);
|
69
|
+
background-repeat: no-repeat;
|
70
|
+
background-position: 0px 0px;
|
71
|
+
display: inline-block;
|
72
|
+
list-style: none;
|
73
|
+
}
|
74
|
+
|
75
|
+
.wmd-button > a
|
76
|
+
{
|
77
|
+
width: 20px;
|
78
|
+
height: 20px;
|
79
|
+
margin-left: 5px;
|
80
|
+
margin-right: 5px;
|
81
|
+
|
82
|
+
position: absolute;
|
83
|
+
display: inline-block;
|
84
|
+
}
|
85
|
+
|
86
|
+
|
87
|
+
/* sprite button slicing style information */
|
88
|
+
#wmd-button-bar #wmd-bold-button {left: 0px; background-position: 0px 0;}
|
89
|
+
#wmd-button-bar #wmd-italic-button {left: 25px; background-position: -20px 0;}
|
90
|
+
#wmd-button-bar #wmd-spacer1 {left: 50px;}
|
91
|
+
#wmd-button-bar #wmd-link-button {left: 75px; background-position: -40px 0;}
|
92
|
+
#wmd-button-bar #wmd-quote-button {left: 100px; background-position: -60px 0;}
|
93
|
+
#wmd-button-bar #wmd-code-button {left: 125px; background-position: -80px 0;}
|
94
|
+
#wmd-button-bar #wmd-image-button {left: 150px; background-position: -100px 0;}
|
95
|
+
#wmd-button-bar #wmd-spacer2 {left: 175px;}
|
96
|
+
#wmd-button-bar #wmd-olist-button {left: 200px; background-position: -120px 0;}
|
97
|
+
#wmd-button-bar #wmd-ulist-button {left: 225px; background-position: -140px 0;}
|
98
|
+
#wmd-button-bar #wmd-heading-button {left: 250px; background-position: -160px 0;}
|
99
|
+
#wmd-button-bar #wmd-hr-button {left: 275px; background-position: -180px 0;}
|
100
|
+
#wmd-button-bar #wmd-spacer3 {left: 300px;}
|
101
|
+
#wmd-button-bar #wmd-undo-button {left: 325px; background-position: -200px 0;}
|
102
|
+
#wmd-button-bar #wmd-redo-button {left: 350px; background-position: -220px 0;}
|
103
|
+
#wmd-button-bar #wmd-help-button {right: 0px; background-position: -240px 0;}
|
104
|
+
|
105
|
+
|
106
|
+
.wmd-prompt-background
|
107
|
+
{
|
108
|
+
background-color: Black;
|
109
|
+
}
|
110
|
+
|
111
|
+
.wmd-prompt-dialog
|
112
|
+
{
|
113
|
+
border: 1px solid #999999;
|
114
|
+
background-color: #F5F5F5;
|
115
|
+
}
|
116
|
+
|
117
|
+
.wmd-prompt-dialog > div {
|
118
|
+
font-size: 0.8em;
|
119
|
+
font-family: arial, helvetica, sans-serif;
|
120
|
+
}
|
121
|
+
|
122
|
+
|
123
|
+
.wmd-prompt-dialog > form > input[type="text"] {
|
124
|
+
border: 1px solid #999999;
|
125
|
+
color: black;
|
126
|
+
}
|
127
|
+
|
128
|
+
.wmd-prompt-dialog > form > input[type="button"]{
|
129
|
+
border: 1px solid #888888;
|
130
|
+
font-family: trebuchet MS, helvetica, sans-serif;
|
131
|
+
font-size: 0.8em;
|
132
|
+
font-weight: bold;
|
133
|
+
}
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
var Attacklab=Attacklab||{};Attacklab.wmdBase=function(){var m=top.Attacklab;var q=top.document;var i=top.RegExp;var f=top.navigator;m.Util={};m.Position={};m.Command={};m.Global={};var a=m.Util;var p=m.Position;var d=m.Command;var j=m.Global;j.isIE=/msie/.test(f.userAgent.toLowerCase());j.isIE_5or6=/msie 6/.test(f.userAgent.toLowerCase())||/msie 5/.test(f.userAgent.toLowerCase());j.isIE_7plus=j.isIE&&!j.isIE_5or6;j.isOpera=/opera/.test(f.userAgent.toLowerCase());j.isKonqueror=/konqueror/.test(f.userAgent.toLowerCase());var o="<p style='margin-top: 0px'><b>Enter the image URL.</b></p><p>You can also add a title, which will be displayed as a tool tip.</p><p>Example:<br />http://hotink.net/images/cloud1.jpg \"Optional title\"</p>";var r="<p style='margin-top: 0px'><b>Enter the web address.</b></p><p>You can also add a title, which will be displayed as a tool tip.</p><p>Example:<br />http://hotink.net/ \"Optional title\"</p>";var b="http://";var c="http://";var g="images/";var n=500;var l=100;var e="http://userguide.hotink.net/";var h="Hot Ink User Guid";var k="_blank";m.PanelCollection=function(){this.buttonBar=q.getElementById("wmd-button-bar");this.preview=q.getElementById("wmd-preview");this.output=q.getElementById("wmd-output");this.input=q.getElementById("wmd-input")};m.panels=undefined;m.ieCachedRange=null;m.ieRetardedClick=false;a.isVisible=function(s){if(window.getComputedStyle){return window.getComputedStyle(s,null).getPropertyValue("display")!=="none"}else{if(s.currentStyle){return s.currentStyle.display!=="none"}}};a.addEvent=function(t,s,u){if(t.attachEvent){t.attachEvent("on"+s,u)}else{t.addEventListener(s,u,false)}};a.removeEvent=function(t,s,u){if(t.detachEvent){t.detachEvent("on"+s,u)}else{t.removeEventListener(s,u,false)}};a.fixEolChars=function(s){s=s.replace(/\r\n/g,"\n");s=s.replace(/\r/g,"\n");return s};a.extendRegExp=function(v,x,u){if(x===null||x===undefined){x=""}if(u===null||u===undefined){u=""}var w=v.toString();var t="";var s=w.match(/\/([gim]*)$/);if(s===null){t=s[0]}else{t=""}w=w.replace(/(^\/|\/[gim]*$)/g,"");w=x+w+u;return new RegExp(w,t)};a.createImage=function(s){var u=g+s;var t=q.createElement("img");t.className="wmd-button";t.src=u;return t};a.prompt=function(y,B,u){var v;var s;var w;if(B===undefined){B=""}var x=function(C){var D=(C.charCode||C.keyCode);if(D===27){z(true)}};var z=function(C){a.removeEvent(q.body,"keydown",x);var D=w.value;if(C){D=null}else{D=D.replace("http://http://","http://");D=D.replace("http://https://","https://");D=D.replace("http://ftp://","ftp://");if(D.indexOf("http://")===-1&&D.indexOf("ftp://")===-1&&D.indexOf("https://")===-1){D="http://"+D}}v.parentNode.removeChild(v);s.parentNode.removeChild(s);u(D);return false};var t=function(){s=q.createElement("div");s.className="wmd-prompt-background";style=s.style;style.position="absolute";style.top="0";style.zIndex="1000";if(j.isKonqueror){style.backgroundColor="transparent"}else{if(j.isIE){style.filter="alpha(opacity=50)"}else{style.opacity="0.5"}}var C=p.getPageSize();style.height=C[1]+"px";if(j.isIE){style.left=q.documentElement.scrollLeft;style.width=q.documentElement.clientWidth}else{style.left="0";style.width="100%"}q.body.appendChild(s)};var A=function(){v=q.createElement("div");v.className="wmd-prompt-dialog";v.style.padding="10px;";v.style.position="fixed";v.style.width="400px";v.style.zIndex="1001";var C=q.createElement("div");C.innerHTML=y;C.style.padding="5px";v.appendChild(C);var D=q.createElement("form");D.onsubmit=function(){return z(false)};style=D.style;style.padding="0";style.margin="0";style.cssFloat="left";style.width="100%";style.textAlign="center";style.position="relative";v.appendChild(D);w=q.createElement("input");w.type="text";w.value=B;style=w.style;style.display="block";style.width="80%";style.marginLeft=style.marginRight="auto";D.appendChild(w);var F=q.createElement("input");F.type="button";F.onclick=function(){return z(false)};F.value="OK";style=F.style;style.margin="10px";style.display="inline";style.width="7em";var E=q.createElement("input");E.type="button";E.onclick=function(){return z(true)};E.value="Cancel";style=E.style;style.margin="10px";style.display="inline";style.width="7em";if(/mac/.test(f.platform.toLowerCase())){D.appendChild(E);D.appendChild(F)}else{D.appendChild(F);D.appendChild(E)}a.addEvent(q.body,"keydown",x);v.style.top="50%";v.style.left="50%";v.style.display="block";if(j.isIE_5or6){v.style.position="absolute";v.style.top=q.documentElement.scrollTop+200+"px";v.style.left="50%"}q.body.appendChild(v);v.style.marginTop=-(p.getHeight(v)/2)+"px";v.style.marginLeft=-(p.getWidth(v)/2)+"px"};t();top.setTimeout(function(){A();var D=B.length;if(w.selectionStart!==undefined){w.selectionStart=0;w.selectionEnd=D}else{if(w.createTextRange){var C=w.createTextRange();C.collapse(false);C.moveStart("character",-D);C.moveEnd("character",D);C.select()}}w.focus()},0)};p.getTop=function(u,t){var s=u.offsetTop;if(!t){while(u=u.offsetParent){s+=u.offsetTop}}return s};p.getHeight=function(s){return s.offsetHeight||s.scrollHeight};p.getWidth=function(s){return s.offsetWidth||s.scrollWidth};p.getPageSize=function(){var t,u;var s,x;if(self.innerHeight&&self.scrollMaxY){t=q.body.scrollWidth;u=self.innerHeight+self.scrollMaxY}else{if(q.body.scrollHeight>q.body.offsetHeight){t=q.body.scrollWidth;u=q.body.scrollHeight}else{t=q.body.offsetWidth;u=q.body.offsetHeight}}if(self.innerHeight){s=self.innerWidth;x=self.innerHeight}else{if(q.documentElement&&q.documentElement.clientHeight){s=q.documentElement.clientWidth;x=q.documentElement.clientHeight}else{if(q.body){s=q.body.clientWidth;x=q.body.clientHeight}}}var w=Math.max(t,s);var v=Math.max(u,x);return[w,v,s,x]};m.inputPoller=function(B,u){var s=this;var x=m.panels.input;var t;var v;var y;var w;this.tick=function(){if(!a.isVisible(x)){return}if(x.selectionStart||x.selectionStart===0){var D=x.selectionStart;var C=x.selectionEnd;if(D!=t||C!=v){t=D;v=C;if(y!=x.value){y=x.value;return true}}}return false};var A=function(){if(!a.isVisible(x)){return}if(s.tick()){B()}};var z=function(){w=top.setInterval(A,u)};this.destroy=function(){top.clearInterval(w)};z()};m.undoManager=function(D){var H=this;var B=[];var z=0;var y="none";var t;var E;var u;var x;var s=function(J,I){if(y!=J){y=J;if(!I){v()}}if(!j.isIE||y!="moving"){u=top.setTimeout(A,1)}else{x=null}};var A=function(){x=new m.TextareaState();E.tick();u=undefined};this.setCommandMode=function(){y="command";v();u=top.setTimeout(A,0)};this.canUndo=function(){return z>1};this.canRedo=function(){if(B[z+1]){return true}return false};this.undo=function(){if(H.canUndo()){if(t){t.restore();t=null}else{B[z]=new m.TextareaState();B[--z].restore();if(D){D()}}}y="none";m.panels.input.focus();A()};this.redo=function(){if(H.canRedo()){B[++z].restore();if(D){D()}}y="none";m.panels.input.focus();A()};var v=function(){var I=x||new m.TextareaState();if(!I){return false}if(y=="moving"){if(!t){t=I}return}if(t){if(B[z-1].text!=t.text){B[z++]=t}t=null}B[z++]=I;B[z+1]=null;if(D){D()}};var C=function(I){var K=false;if(I.ctrlKey||I.metaKey){var J=I.charCode||I.keyCode;var L=String.fromCharCode(J);switch(L){case"y":H.redo();K=true;break;case"z":if(!I.shiftKey){H.undo()}else{H.redo()}K=true;break}}if(K){if(I.preventDefault){I.preventDefault()}if(top.event){top.event.returnValue=false}return}};var G=function(I){if(!I.ctrlKey&&!I.metaKey){var J=I.keyCode;if((J>=33&&J<=40)||(J>=63232&&J<=63235)){s("moving")}else{if(J==8||J==46||J==127){s("deleting")}else{if(J==13){s("newlines")}else{if(J==27){s("escape")}else{if((J<16||J>20)&&J!=91){s("typing")}}}}}}};var w=function(){a.addEvent(m.panels.input,"keypress",function(J){if((J.ctrlKey||J.metaKey)&&(J.keyCode==89||J.keyCode==90)){J.preventDefault()}});var I=function(){if(j.isIE||(x&&x.text!=m.panels.input.value)){if(u==undefined){y="paste";v();A()}}};E=new m.inputPoller(I,l);a.addEvent(m.panels.input,"keydown",C);a.addEvent(m.panels.input,"keydown",G);a.addEvent(m.panels.input,"mousedown",function(){s("moving")});m.panels.input.onpaste=I;m.panels.input.ondrop=I};var F=function(){w();A();v()};this.destroy=function(){if(E){E.destroy()}};F()};m.editor=function(B){if(!B){B=function(){}}var y=m.panels.input;var v=0;var C=this;var x;var E;var t;var z;var A;var H=function(J){y.focus();if(J.textOp){if(A){A.setCommandMode()}var L=new m.TextareaState();if(!L){return}var N=L.getChunks();var I=function(){y.focus();if(N){L.setChunks(N)}L.restore();B()};var M=true;var K=J.textOp(N,I,M);if(!K){I()}}if(J.execute){J.execute(C)}};var F=function(){if(A){s(document.getElementById("wmd-undo-button"),A.canUndo());s(document.getElementById("wmd-redo-button"),A.canRedo())}};var s=function(I,K){var L="0px";var M="-20px";var J="-40px";if(K){I.style.backgroundPosition=I.XShift+" "+L;I.onmouseover=function(){this.style.backgroundPosition=this.XShift+" "+J};I.onmouseout=function(){this.style.backgroundPosition=this.XShift+" "+L};if(j.isIE){I.onmousedown=function(){m.ieRetardedClick=true;m.ieCachedRange=document.selection.createRange()}}if(!I.isHelp){I.onclick=function(){if(this.onmouseout){this.onmouseout()}H(this);return false}}}else{I.style.backgroundPosition=I.XShift+" "+M;I.onmouseover=I.onmouseout=I.onclick=function(){}}};var w=function(){var N=document.getElementById("wmd-button-bar");var J="0px";var M="-20px";var S="-40px";var Y=document.createElement("ul");Y.id="wmd-button-row";Y=N.appendChild(Y);var R=document.createElement("li");R.className="wmd-button";R.id="wmd-bold-button";R.title="Strong <strong> Ctrl+B";R.XShift="0px";R.textOp=d.doBold;s(R,true);Y.appendChild(R);var Q=document.createElement("li");Q.className="wmd-button";Q.id="wmd-italic-button";Q.title="Emphasis <em> Ctrl+I";Q.XShift="-20px";Q.textOp=d.doItalic;s(Q,true);Y.appendChild(Q);var V=document.createElement("li");V.className="wmd-spacer";V.id="wmd-spacer1";Y.appendChild(V);var W=document.createElement("li");W.className="wmd-button";W.id="wmd-link-button";W.title="Hyperlink <a> Ctrl+L";W.XShift="-40px";W.textOp=function(ae,af,ag){return d.doLinkOrImage(ae,af,false)};s(W,true);Y.appendChild(W);var Z=document.createElement("li");Z.className="wmd-button";Z.id="wmd-quote-button";Z.title="Blockquote <blockquote> Ctrl+Q";Z.XShift="-60px";Z.textOp=d.doBlockquote;s(Z,true);Y.appendChild(Z);var aa=document.createElement("li");aa.className="wmd-button";aa.id="wmd-code-button";aa.title="Code Sample <pre><code> Ctrl+K";aa.XShift="-80px";aa.textOp=d.doCode;s(aa,true);Y.appendChild(aa);var O=document.createElement("li");O.className="wmd-button";O.id="wmd-image-button";O.title="Image <img> Ctrl+G";O.XShift="-100px";O.textOp=function(ae,af,ag){return d.doLinkOrImage(ae,af,true)};s(O,true);Y.appendChild(O);var U=document.createElement("li");U.className="wmd-spacer";U.id="wmd-spacer2";Y.appendChild(U);var P=document.createElement("li");P.className="wmd-button";P.id="wmd-olist-button";P.title="Numbered List <ol> Ctrl+O";P.XShift="-120px";P.textOp=function(ae,af,ag){d.doList(ae,af,true,ag)};s(P,true);Y.appendChild(P);var ad=document.createElement("li");ad.className="wmd-button";ad.id="wmd-ulist-button";ad.title="Bulleted List <ul> Ctrl+U";ad.XShift="-140px";ad.textOp=function(ae,af,ag){d.doList(ae,af,false,ag)};s(ad,true);Y.appendChild(ad);var X=document.createElement("li");X.className="wmd-button";X.id="wmd-heading-button";X.title="Heading <h1>/<h2> Ctrl+H";X.XShift="-160px";X.textOp=d.doHeading;s(X,true);Y.appendChild(X);var K=document.createElement("li");K.className="wmd-button";K.id="wmd-hr-button";K.title="Horizontal Rule <hr> Ctrl+R";K.XShift="-180px";K.textOp=d.doHorizontalRule;s(K,true);Y.appendChild(K);var T=document.createElement("li");T.className="wmd-spacer";T.id="wmd-spacer3";Y.appendChild(T);var I=document.createElement("li");I.className="wmd-button";I.id="wmd-undo-button";I.title="Undo - Ctrl+Z";I.XShift="-200px";I.execute=function(ae){ae.undo()};s(I,true);Y.appendChild(I);var ac=document.createElement("li");ac.className="wmd-button";ac.id="wmd-redo-button";ac.title="Redo - Ctrl+Y";if(/win/.test(f.platform.toLowerCase())){ac.title="Redo - Ctrl+Y"}else{ac.title="Redo - Ctrl+Shift+Z"}ac.XShift="-220px";ac.execute=function(ae){ae.redo()};s(ac,true);Y.appendChild(ac);var ab=document.createElement("li");ab.className="wmd-button";ab.id="wmd-help-button";ab.XShift="-240px";ab.isHelp=true;var L=document.createElement("a");L.href=e;L.target=k;L.title=h;ab.appendChild(L);s(ab,true);Y.appendChild(ab);F()};var u=function(){if(/\?noundo/.test(q.location.href)){m.nativeUndo=true}if(!m.nativeUndo){A=new m.undoManager(function(){B();F()})}w();var J="keydown";if(j.isOpera){J="keypress"}a.addEvent(y,J,function(L){if(L.ctrlKey||L.metaKey){var M=L.charCode||L.keyCode;var K=String.fromCharCode(M).toLowerCase();switch(K){case"b":H(document.getElementById("wmd-bold-button"));break;case"i":H(document.getElementById("wmd-italic-button"));break;case"l":H(document.getElementById("wmd-link-button"));break;case"q":H(document.getElementById("wmd-quote-button"));break;case"k":H(document.getElementById("wmd-code-button"));break;case"g":H(document.getElementById("wmd-image-button"));break;case"o":H(document.getElementById("wmd-olist-button"));break;case"u":H(document.getElementById("wmd-ulist-button"));break;case"h":H(document.getElementById("wmd-heading-button"));break;case"r":H(document.getElementById("wmd-hr-button"));break;case"y":H(document.getElementById("wmd-redo-button"));break;case"z":if(L.shiftKey){H(document.getElementById("wmd-redo-button"))}else{H(document.getElementById("wmd-undo-button"))}break;default:return}if(L.preventDefault){L.preventDefault()}if(top.event){top.event.returnValue=false}}});a.addEvent(y,"keyup",function(K){if(!K.shiftKey&&!K.ctrlKey&&!K.metaKey){var L=K.charCode||K.keyCode;if(L===13){fakeButton={};fakeButton.textOp=d.doAutoindent;H(fakeButton)}}});if(j.isIE){a.addEvent(y,"keydown",function(K){var L=K.keyCode;if(L===27){return false}})}if(y.form){var I=y.form.onsubmit;y.form.onsubmit=function(){D();if(I){return I.apply(this,arguments)}}}};var D=function(){if(m.showdown){var I=new m.showdown.converter()}var J=y.value;var K=function(){y.value=J};if(!/markdown/.test(m.wmd_env.output.toLowerCase())){if(I){y.value=I.makeHtml(J);top.setTimeout(K,0)}}return true};this.undo=function(){if(A){A.undo()}};this.redo=function(){if(A){A.redo()}};var G=function(){u()};this.destroy=function(){if(A){A.destroy()}if(t.parentNode){t.parentNode.removeChild(t)}if(y){y.style.marginTop=""}top.clearInterval(z)};G()};m.TextareaState=function(){var s=this;var t=m.panels.input;this.init=function(){if(!a.isVisible(t)){return}this.setInputAreaSelectionStartEnd();this.scrollTop=t.scrollTop;if(!this.text&&t.selectionStart||t.selectionStart===0){this.text=t.value}};this.setInputAreaSelection=function(){if(!a.isVisible(t)){return}if(t.selectionStart!==undefined&&!j.isOpera){t.focus();t.selectionStart=s.start;t.selectionEnd=s.end;t.scrollTop=s.scrollTop}else{if(q.selection){if(q.activeElement&&q.activeElement!==t){return}t.focus();var u=t.createTextRange();u.moveStart("character",-t.value.length);u.moveEnd("character",-t.value.length);u.moveEnd("character",s.end);u.moveStart("character",s.start);u.select()}}};this.setInputAreaSelectionStartEnd=function(){if(t.selectionStart||t.selectionStart===0){s.start=t.selectionStart;s.end=t.selectionEnd}else{if(q.selection){s.text=a.fixEolChars(t.value);var x;if(m.ieRetardedClick&&m.ieCachedRange){x=m.ieCachedRange;m.ieRetardedClick=false}else{x=q.selection.createRange()}var y=a.fixEolChars(x.text);var w="\x07";var v=w+y+w;x.text=v;var z=a.fixEolChars(t.value);x.moveStart("character",-v.length);x.text=y;s.start=z.indexOf(w);s.end=z.lastIndexOf(w)-w.length;var u=s.text.length-a.fixEolChars(t.value).length;if(u){x.moveStart("character",-y.length);while(u--){y+="\n";s.end+=1}x.text=y}this.setInputAreaSelection()}}};this.restore=function(){if(s.text!=undefined&&s.text!=t.value){t.value=s.text}this.setInputAreaSelection();t.scrollTop=s.scrollTop};this.getChunks=function(){var u=new m.Chunks();u.before=a.fixEolChars(s.text.substring(0,s.start));u.startTag="";u.selection=a.fixEolChars(s.text.substring(s.start,s.end));u.endTag="";u.after=a.fixEolChars(s.text.substring(s.end));u.scrollTop=s.scrollTop;return u};this.setChunks=function(u){u.before=u.before+u.startTag;u.after=u.endTag+u.after;if(j.isOpera){u.before=u.before.replace(/\n/g,"\r\n");u.selection=u.selection.replace(/\n/g,"\r\n");u.after=u.after.replace(/\n/g,"\r\n")}this.start=u.before.length;this.end=u.before.length+u.selection.length;this.text=u.before+u.selection+u.after;this.scrollTop=u.scrollTop};this.init()};m.Chunks=function(){};m.Chunks.prototype.findTags=function(t,v){var s=this;var u;if(t){u=a.extendRegExp(t,"","$");this.before=this.before.replace(u,function(w){s.startTag=s.startTag+w;return""});u=a.extendRegExp(t,"^","");this.selection=this.selection.replace(u,function(w){s.startTag=s.startTag+w;return""})}if(v){u=a.extendRegExp(v,"","$");this.selection=this.selection.replace(u,function(w){s.endTag=w+s.endTag;return""});u=a.extendRegExp(v,"^","");this.after=this.after.replace(u,function(w){s.endTag=w+s.endTag;return""})}};m.Chunks.prototype.trimWhitespace=function(s){this.selection=this.selection.replace(/^(\s*)/,"");if(!s){this.before+=i.$1}this.selection=this.selection.replace(/(\s*)$/,"");if(!s){this.after=i.$1+this.after}};m.Chunks.prototype.addBlankLines=function(u,t,s){if(u===undefined){u=1}if(t===undefined){t=1}u++;t++;var v;var w;this.selection=this.selection.replace(/(^\n*)/,"");this.startTag=this.startTag+i.$1;this.selection=this.selection.replace(/(\n*$)/,"");this.endTag=this.endTag+i.$1;this.startTag=this.startTag.replace(/(^\n*)/,"");this.before=this.before+i.$1;this.endTag=this.endTag.replace(/(\n*$)/,"");this.after=this.after+i.$1;if(this.before){v=w="";while(u--){v+="\\n?";w+="\n"}if(s){v="\\n*"}this.before=this.before.replace(new i(v+"$",""),w)}if(this.after){v=w="";while(t--){v+="\\n?";w+="\n"}if(s){v="\\n*"}this.after=this.after.replace(new i(v,""),w)}};d.prefixes="(?:\\s{4,}|\\s*>|\\s*-\\s+|\\s*\\d+\\.|=|\\+|-|_|\\*|#|\\s*\\[[^\n]]+\\]:)";d.unwrap=function(t){var s=new i("([^\\n])\\n(?!(\\n|"+d.prefixes+"))","g");t.selection=t.selection.replace(s,"$1 $2")};d.wrap=function(t,s){d.unwrap(t);var u=new i("(.{1,"+s+"})( +|$\\n?)","gm");t.selection=t.selection.replace(u,function(v,w){if(new i("^"+d.prefixes,"").test(v)){return v}return w+"\n"});t.selection=t.selection.replace(/\s+$/,"")};d.doBold=function(s,t,u){return d.doBorI(s,2,"strong text")};d.doItalic=function(s,t,u){return d.doBorI(s,1,"emphasized text")};d.doBorI=function(v,z,y){v.trimWhitespace();v.selection=v.selection.replace(/\n{2,}/g,"\n");v.before.search(/(\**$)/);var x=i.$1;v.after.search(/(^\**)/);var w=i.$1;var s=Math.min(x.length,w.length);if((s>=z)&&(s!=2||z!=1)){v.before=v.before.replace(i("[*]{"+z+"}$",""),"");v.after=v.after.replace(i("^[*]{"+z+"}",""),"")}else{if(!v.selection&&w){v.after=v.after.replace(/^([*_]*)/,"");v.before=v.before.replace(/(\s?)$/,"");var u=i.$1;v.before=v.before+w+u}else{if(!v.selection&&!w){v.selection=y}var t=z<=1?"*":"**";v.before=v.before+t;v.after=t+v.after}}return};d.stripLinkDefs=function(t,s){t=t.replace(/^[ ]{0,3}\[(\d+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|$)/gm,function(x,y,u,v,w){s[y]=x.replace(/\s*$/,"");if(v){s[y]=x.replace(/["(](.+?)[")]$/,"");return v+w}return""});return t};d.addLinkDef=function(z,v){var s=0;var u={};z.before=d.stripLinkDefs(z.before,u);z.selection=d.stripLinkDefs(z.selection,u);z.after=d.stripLinkDefs(z.after,u);var t="";var y=/(\[(?:\[[^\]]*\]|[^\[\]])*\][ ]?(?:\n[ ]*)?\[)(\d+)(\])/g;var x=function(B){s++;B=B.replace(/^[ ]{0,3}\[(\d+)\]:/," ["+s+"]:");t+="\n"+B};var w=function(C,D,E,B){if(u[E]){x(u[E]);return D+s+B}return C};z.before=z.before.replace(y,w);if(v){x(v)}else{z.selection=z.selection.replace(y,w)}var A=s;z.after=z.after.replace(y,w);if(z.after){z.after=z.after.replace(/\n*$/,"")}if(!z.after){z.selection=z.selection.replace(/\n*$/,"")}z.after+="\n\n"+t;return A};d.doLinkOrImage=function(s,t,v){s.trimWhitespace();s.findTags(/\s*!?\[/,/\][ ]?(?:\n[ ]*)?(\[.*?\])?/);if(s.endTag.length>1){s.startTag=s.startTag.replace(/!?\[/,"");s.endTag="";d.addLinkDef(s,null)}else{if(/\n\n/.test(s.selection)){d.addLinkDef(s,null);return}var u=function(y){if(y!==null){s.startTag=s.endTag="";var x=" [999]: "+y;var w=d.addLinkDef(s,x);s.startTag=v?"![":"[";s.endTag="]["+w+"]";if(!s.selection){if(v){s.selection="alt text"}else{s.selection="link text"}}}t()};if(v){a.prompt(o,b,u)}else{a.prompt(r,c,u)}return true}};a.makeAPI=function(){m.wmd={};m.wmd.editor=m.editor;m.wmd.previewManager=m.previewManager};a.startEditor=function(){if(m.wmd_env.autostart===false){a.makeAPI();return}var t;var s;var u=function(){m.panels=new m.PanelCollection();s=new m.previewManager();var v=s.refresh;t=new m.editor(v);s.refresh(true)};a.addEvent(top,"load",u)};m.previewManager=function(){var u=this;var I;var s;var A;var z;var F;var B;var v=3000;var C="delayed";var x=function(K,L){a.addEvent(K,"input",L);K.onpaste=L;K.ondrop=L;a.addEvent(K,"keypress",L);a.addEvent(K,"keydown",L);s=new m.inputPoller(L,n)};var E=function(){var K=0;if(top.innerHeight){K=top.pageYOffset}else{if(q.documentElement&&q.documentElement.scrollTop){K=q.documentElement.scrollTop}else{if(q.body){K=q.body.scrollTop}}}return K};var y=function(){if(!m.panels.preview&&!m.panels.output){return}var M=m.panels.input.value;if(M&&M==F){return}else{F=M}var L=new Date().getTime();if(!I&&m.showdown){I=new m.showdown.converter()}if(I){M=I.makeHtml(M)}var K=new Date().getTime();z=K-L;t(M);B=M};var H=function(){if(A){top.clearTimeout(A);A=undefined}if(C!=="manual"){var K=0;if(C==="delayed"){K=z}if(K>v){K=v}A=top.setTimeout(y,K)}};var w=function(K){if(K.scrollHeight<=K.clientHeight){return 1}return K.scrollTop/(K.scrollHeight-K.clientHeight)};var J=function(){if(m.panels.preview){m.panels.preview.scrollTop=(m.panels.preview.scrollHeight-m.panels.preview.clientHeight)*w(m.panels.preview)}if(m.panels.output){m.panels.output.scrollTop=(m.panels.output.scrollHeight-m.panels.output.clientHeight)*w(m.panels.output)}};this.refresh=function(K){if(K){F="";y()}else{H()}};this.processingTime=function(){return z};this.output=function(){return B};this.setUpdateMode=function(K){C=K;u.refresh()};var D=true;var t=function(N){var K=p.getTop(m.panels.input)-E();if(m.panels.output){if(m.panels.output.value!==undefined){m.panels.output.value=N;m.panels.output.readOnly=true}else{var M=N.replace(/&/g,"&");M=M.replace(/</g,"<");m.panels.output.innerHTML="<pre><code>"+M+"</code></pre>"}}if(m.panels.preview){m.panels.preview.innerHTML=N}J();if(D){D=false;return}var L=p.getTop(m.panels.input)-E();if(j.isIE){top.setTimeout(function(){top.scrollBy(0,L-K)},0)}else{top.scrollBy(0,L-K)}};var G=function(){x(m.panels.input,H);y();if(m.panels.preview){m.panels.preview.scrollTop=0}if(m.panels.output){m.panels.output.scrollTop=0}};this.destroy=function(){if(s){s.destroy()}};G()};d.doAutoindent=function(s,t,u){s.before=s.before.replace(/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]*\n$/,"\n\n");s.before=s.before.replace(/(\n|^)[ ]{0,3}>[ \t]*\n$/,"\n\n");s.before=s.before.replace(/(\n|^)[ \t]+\n$/,"\n\n");u=false;if(/(\n|^)[ ]{0,3}([*+-])[ \t]+.*\n$/.test(s.before)){if(d.doList){d.doList(s,t,false,true)}}if(/(\n|^)[ ]{0,3}(\d+[.])[ \t]+.*\n$/.test(s.before)){if(d.doList){d.doList(s,t,true,true)}}if(/(\n|^)[ ]{0,3}>[ \t]+.*\n$/.test(s.before)){if(d.doBlockquote){d.doBlockquote(s,t,u)}}if(/(\n|^)(\t|[ ]{4,}).*\n$/.test(s.before)){if(d.doCode){d.doCode(s,t,u)}}};d.doBlockquote=function(t,u,w){t.selection=t.selection.replace(/^(\n*)([^\r]+?)(\n*)$/,function(A,z,y,x){t.before+=z;t.after=x+t.after;return y});t.before=t.before.replace(/(>[ \t]*)$/,function(y,x){t.selection=x+t.selection;return""});var s=w?"Blockquote":"";t.selection=t.selection.replace(/^(\s|>)+$/,"");t.selection=t.selection||s;if(t.before){t.before=t.before.replace(/\n?$/,"\n")}if(t.after){t.after=t.after.replace(/^\n?/,"\n")}t.before=t.before.replace(/(((\n|^)(\n[ \t]*)*>(.+\n)*.*)+(\n[ \t]*)*$)/,function(x){t.startTag=x;return""});t.after=t.after.replace(/^(((\n|^)(\n[ \t]*)*>(.+\n)*.*)+(\n[ \t]*)*)/,function(x){t.endTag=x;return""});var v=function(y){var x=y?"> ":"";if(t.startTag){t.startTag=t.startTag.replace(/\n((>|\s)*)\n$/,function(A,z){return"\n"+z.replace(/^[ ]{0,3}>?[ \t]*$/gm,x)+"\n"})}if(t.endTag){t.endTag=t.endTag.replace(/^\n((>|\s)*)\n/,function(A,z){return"\n"+z.replace(/^[ ]{0,3}>?[ \t]*$/gm,x)+"\n"})}};if(/^(?![ ]{0,3}>)/m.test(t.selection)){d.wrap(t,m.wmd_env.lineLength-2);t.selection=t.selection.replace(/^/gm,"> ");v(true);t.addBlankLines()}else{t.selection=t.selection.replace(/^[ ]{0,3}> ?/gm,"");d.unwrap(t);v(false);if(!/^(\n|^)[ ]{0,3}>/.test(t.selection)&&t.startTag){t.startTag=t.startTag.replace(/\n{0,2}$/,"\n\n")}if(!/(\n|^)[ ]{0,3}>.*$/.test(t.selection)&&t.endTag){t.endTag=t.endTag.replace(/^\n{0,2}/,"\n\n")}}if(!/\n/.test(t.selection)){t.selection=t.selection.replace(/^(> *)/,function(x,y){t.startTag+=y;return""})}};d.doCode=function(s,t,x){var w=/\S[ ]*$/.test(s.before);var y=/^[ ]*\S/.test(s.after);if((!y&&!w)||/\n/.test(s.selection)){s.before=s.before.replace(/[ ]{4}$/,function(z){s.selection=z+s.selection;return""});var v=1;var u=1;if(/\n(\t|[ ]{4,}).*\n$/.test(s.before)||s.after===""){v=0}if(/^\n(\t|[ ]{4,})/.test(s.after)){u=0}s.addBlankLines(v,u);if(!s.selection){s.startTag=" ";s.selection=x?"enter code here":""}else{if(/^[ ]{0,3}\S/m.test(s.selection)){s.selection=s.selection.replace(/^/gm," ")}else{s.selection=s.selection.replace(/^[ ]{4}/gm,"")}}}else{s.trimWhitespace();s.findTags(/`/,/`/);if(!s.startTag&&!s.endTag){s.startTag=s.endTag="`";if(!s.selection){s.selection=x?"enter code here":""}}else{if(s.endTag&&!s.startTag){s.before+=s.endTag;s.endTag=""}else{s.startTag=s.endTag=""}}}};d.doList=function(D,w,v,F){var G=/(\n|^)(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*$/;var E=/^\n*(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*/;var s="-";var A=1;var y=function(){var H;if(v){H=" "+A+". ";A++}else{H=" "+s+" "}return H};var z=function(H){if(v===undefined){v=/^\s*\d/.test(H)}H=H.replace(/^[ ]{0,3}([*+-]|\d+[.])\s/gm,function(I){return y()});return H};D.findTags(/(\n|^)*[ ]{0,3}([*+-]|\d+[.])\s+/,null);if(D.before&&!/\n$/.test(D.before)&&!/^\n/.test(D.startTag)){D.before+=D.startTag;D.startTag=""}if(D.startTag){var u=/\d+[.]/.test(D.startTag);D.startTag="";D.selection=D.selection.replace(/\n[ ]{4}/g,"\n");d.unwrap(D);D.addBlankLines();if(u){D.after=D.after.replace(E,z)}if(v==u){return}}var x=1;D.before=D.before.replace(G,function(H){if(/^\s*([*+-])/.test(H)){s=i.$1}x=/[^\n]\n\n[^\n]/.test(H)?1:0;return z(H)});if(!D.selection){D.selection=F?"List item":" "}var B=y();var t=1;D.after=D.after.replace(E,function(H){t=/[^\n]\n\n[^\n]/.test(H)?1:0;return z(H)});D.trimWhitespace(true);D.addBlankLines(x,t,true);D.startTag=B;var C=B.replace(/./g," ");d.wrap(D,m.wmd_env.lineLength-C.length);D.selection=D.selection.replace(/\n/g,"\n"+C)};d.doHeading=function(u,v,y){u.selection=u.selection.replace(/\s+/g," ");u.selection=u.selection.replace(/(^\s+|\s+$)/g,"");if(!u.selection){u.startTag="## ";u.selection="Heading";u.endTag=" ##";return}var w=0;u.findTags(/#+[ ]*/,/[ ]*#+/);if(/#+/.test(u.startTag)){w=i.lastMatch.length}u.startTag=u.endTag="";u.findTags(null,/\s?(-+|=+)/);if(/=+/.test(u.endTag)){w=1}if(/-+/.test(u.endTag)){w=2}u.startTag=u.endTag="";u.addBlankLines(1,1);var x=w==0?2:w-1;if(x>0){var t=x>=2?"-":"=";var s=u.selection.length;if(s>m.wmd_env.lineLength){s=m.wmd_env.lineLength}u.endTag="\n";while(s--){u.endTag+=t}}};d.doHorizontalRule=function(s,t,u){s.startTag="----------\n";s.selection="";s.addBlankLines(2,1,true)}};Attacklab.wmd_env={};Attacklab.account_options={};Attacklab.wmd_defaults={version:1,output:"HTML",lineLength:40,delayLoad:false};if(!Attacklab.wmd){Attacklab.wmd=function(){Attacklab.loadEnv=function(){var b=function(d){if(!d){return}for(var c in d){Attacklab.wmd_env[c]=d[c]}};b(Attacklab.wmd_defaults);b(Attacklab.account_options);b(top.wmd_options);Attacklab.full=true;var a="bold italic link blockquote code image ol ul heading hr";Attacklab.wmd_env.buttons=Attacklab.wmd_env.buttons||a};Attacklab.loadEnv()};Attacklab.wmd();Attacklab.wmdBase();Attacklab.Util.startEditor()};
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
|
-
describe Manuscript::
|
3
|
+
describe Manuscript::DesignManager do
|
4
4
|
include Rack::Test::Methods
|
5
5
|
|
6
6
|
def app
|
7
|
-
Manuscript::
|
7
|
+
Manuscript::DesignManager
|
8
8
|
end
|
9
9
|
|
10
10
|
describe "when there are templates and layouts" do
|
@@ -14,7 +14,7 @@ describe Manuscript::TemplateManager do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should display list with both templates and both layouts" do
|
17
|
-
get "/admin/
|
17
|
+
get "/admin/design"
|
18
18
|
last_response.should be_ok
|
19
19
|
last_response.body.should include("Template 1")
|
20
20
|
last_response.body.should include("Template 2")
|
@@ -23,10 +23,10 @@ describe Manuscript::TemplateManager do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should allow new template to be created" do
|
26
|
-
get "/admin/templates/new"
|
26
|
+
get "/admin/design/templates/new"
|
27
27
|
last_response.should be_ok
|
28
28
|
|
29
|
-
post "/admin/templates", :template => { :name => "New template" }
|
29
|
+
post "/admin/design/templates", :template => { :name => "New template" }
|
30
30
|
last_response.should be_redirect
|
31
31
|
follow_redirect!
|
32
32
|
last_response.should be_ok
|
@@ -34,10 +34,10 @@ describe Manuscript::TemplateManager do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should allow new layout to be created" do
|
37
|
-
get "/admin/layouts/new"
|
37
|
+
get "/admin/design/layouts/new"
|
38
38
|
last_response.should be_ok
|
39
39
|
|
40
|
-
post "/admin/layouts", :template => { :name => "New layout" }
|
40
|
+
post "/admin/design/layouts", :template => { :name => "New layout" }
|
41
41
|
last_response.should be_redirect
|
42
42
|
follow_redirect!
|
43
43
|
last_response.body.should include("New layout")
|
@@ -45,11 +45,11 @@ describe Manuscript::TemplateManager do
|
|
45
45
|
|
46
46
|
it "should allow templates to be edited" do
|
47
47
|
template = Manuscript::Template.first
|
48
|
-
get "/admin/templates/#{template.id}/edit"
|
48
|
+
get "/admin/design/templates/#{template.id}/edit"
|
49
49
|
last_response.should be_ok
|
50
50
|
last_response.body.should include(template.name)
|
51
51
|
|
52
|
-
put "/admin/templates/#{template.id}", :template => { :name => "My new template" }
|
52
|
+
put "/admin/design/templates/#{template.id}", :template => { :name => "My new template" }
|
53
53
|
last_response.should be_redirect
|
54
54
|
follow_redirect!
|
55
55
|
last_response.should be_ok
|