wontomedia 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
1
  ---
2
- :major: 0
3
2
  :minor: 0
4
- :patch: 1
3
+ :patch: 2
4
+ :major: 0
@@ -99,7 +99,7 @@ module FormatHelper
99
99
  def text_with_tooltip( text, tip, id = nil )
100
100
  span = id.nil? ? '<span>' : "<span id='#{id}'>"
101
101
  inner = "#{span}#{text}</span>" +
102
- "<span class='tip' style='white-space: nowrap;'>#{tip}</span>"
102
+ "<span class='tip'>#{tip}</span>"
103
103
  link_to inner, "#", :class=>'texthastip', :tabindex=>'0'
104
104
  end
105
105
 
@@ -114,7 +114,7 @@ module FormatHelper
114
114
  def link_with_tooltip( text, tip, href, id = nil )
115
115
  span = id.nil? ? '<span>' : "<span id='#{id}'>"
116
116
  inner = "#{span}#{text}</span>" +
117
- "<span class='tip' style='white-space: nowrap;'>#{tip}</span>"
117
+ "<span class='tip'>#{tip}</span>"
118
118
  link_to inner, href, :class=>'linkhastip', :tabindex=>'0'
119
119
  end
120
120
 
@@ -151,4 +151,25 @@ module FormatHelper
151
151
  return content_tag( 'span', params[:destination] + help_link,
152
152
  :style => "white-space: nowrap;" ) + " "
153
153
  end
154
+
155
+ def logo_image
156
+ logo_name = (File.exists?(
157
+ Rails.root.join( 'public', 'images', 'logo.jpg'))) ?
158
+ '/images/logo.jpg' :
159
+ '/images/logo.png'
160
+ image_tag( logo_name, :alt=>'Logo', :width=>'99%',
161
+ :style=>'margin-bottom: 0.7ex;' )
162
+ end
163
+
164
+
165
+ ALERT_CONTENT_NAME = 'dynamic_alert_content'
166
+ ALERT_CONTENT_PATH = Rails.root.join(
167
+ 'app', 'views', 'layouts', '_' + ALERT_CONTENT_NAME + '.html' )
168
+ def allpages_alert
169
+ if File.exists? ALERT_CONTENT_PATH
170
+ render :partial => File.join( 'layouts', 'dynamic_alert_framework' )
171
+ else
172
+ ''
173
+ end
174
+ end
154
175
  end
@@ -22,34 +22,48 @@
22
22
  <% if WontoMedia.ads.amazon and
23
23
  WontoMedia.ads.amazon.associate_id %>
24
24
 
25
- <div id="block-amazon" class="box" style="width: 98%; text-align: center;">
26
- <script type="text/javascript"><!--
27
- // adjust for our fluid-width layout as possible
28
- divWidth = $('block-amazon').style.width;
29
- if (divResult = divWidth.match(/^([0-9.]+)%$/)){
30
- floatWidth = $('float-left').style.width; // always a %
31
- floatWidth = parseFloat(floatWidth) / 100;
32
-
33
- divWidth = parseFloat(divResult[0]) / 100;
34
- divWidth = divWidth * floatWidth * window.innerWidth;
35
- amazon_ad_width = Math.floor(divWidth - 4).toString();
36
- }
37
- else if (divResult = divWidth.match(/^([0-9.]+)px$/)){
38
- amazon_ad_width = (parseInt(divResult[0]) - 4) + "px";
39
- }
40
- if (parseInt(amazon_ad_width) < 120)
41
- amazon_ad_product_images = "hide";
42
-
43
- // boiler-plate from Amazon
44
- amazon_ad_tag = "<%= WontoMedia.ads.amazon.associate_id -%>";
45
- amazon_ad_width = "160";
46
- amazon_ad_height = "600";
47
- amazon_ad_logo = "hide";
48
- amazon_ad_border = "hide";
49
- //--></script>
50
- <script type="text/javascript"
51
- src="http://www.assoc-amazon.com/s/ads.js"></script>
52
- </div>
25
+ <!-- specifying the height for this div prevents re-layout when content
26
+ is added later in page load. Must update if ad unit changes -->
27
+ <div id="block-amazon-ad" class="box"
28
+ style="width: 99%; height: 600px; text-align: center;"></div>
29
+ <script>
30
+ addToDivsToMove('block-amazon-ad');
31
+ </script>
53
32
 
33
+ <% content_for :last_bottom_page_js do %>
34
+ <div id="block-amazon-ad-content" style="display: none;">
35
+ <script type="text/javascript"><!--
36
+ // adjust for our fluid-width layout as possible
37
+ // TODO: really ought to repeat these calculations in a
38
+ // window-resize event handler....
39
+ divWidth = $('block-amazon-ad').style.width;
40
+ if (divResult = divWidth.match(/^([0-9.]+)%$/)){
41
+ floatWidth = $('float-left').style.width; // always a %
42
+ floatWidth = parseFloat(floatWidth) / 100;
43
+
44
+ divWidth = parseFloat(divResult[0]) / 100;
45
+ divWidth = divWidth * floatWidth * window.innerWidth;
46
+ amazon_ad_width = Math.floor(divWidth - 4).toString();
47
+ }
48
+ else if (divResult = divWidth.match(/^([0-9.]+)px$/))
49
+ amazon_ad_width = (parseInt(divResult[0]) - 4) + "px";
50
+
51
+ amazon_ad_width = (parseInt(amazon_ad_width) >= 160)? "160":"120";
52
+
53
+
54
+ // boiler-plate from Amazon
55
+ amazon_ad_tag = "<%= WontoMedia.ads.amazon.associate_id -%>";
56
+ amazon_ad_height = "600";
57
+ amazon_ad_logo = "hide";
58
+ amazon_ad_border = "hide";
59
+ amazon_color_border = "f8f8ff";
60
+ amazon_color_link = "1D43C0";
61
+ amazon_color_logo = "040460";
62
+ //-->
63
+ </script>
64
+ <script type="text/javascript"
65
+ src="http://www.assoc-amazon.com/s/ads.js"></script>
66
+ </div>
67
+ <% end %>
54
68
  <% end %>
55
69
  <% end %>
@@ -0,0 +1,59 @@
1
+ <%
2
+ # WontoMedia - a wontology web application
3
+ # Copyright (C) 2010 - Glen E. Ivey
4
+ # www.wontology.com
5
+ #
6
+ # This program is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU Affero General Public License version
8
+ # 3 as published by the Free Software Foundation.
9
+ #
10
+ # This program is distributed in the hope that it will be useful, but
11
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Affero General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Affero General Public License
16
+ # along with this program in the file COPYING and/or LICENSE. If not,
17
+ # see "http://www.gnu.org/licenses/".
18
+ %>
19
+
20
+
21
+ <%
22
+ # strategy: when an alert is present, it is displayed in one of two ways:
23
+ # 1) show a floating box with the alert message fixed near the top
24
+ # of the browser window. Message box includes an "X" close button.
25
+ # 2) show a single-line "Show Alert" link below the upper-right logo
26
+ # and above the other right-column boxes
27
+ #
28
+ # When a visitor first views a site page after an alert is posted,
29
+ # the box is displayed, and it is displayed on all subsequent pages
30
+ # until the alert is removed or the visitor takes action. When the
31
+ # box's "X" is clicked, the box is un-displayed and the link is
32
+ # added. This state then persists on subsequent pages. When the
33
+ # "Show Alert" list is clicked, the box is re-displayed and the link
34
+ # removed, and the box resumes its persitence across pages.
35
+ #
36
+ # implementation: alert text and managing JS code is included only
37
+ # when an alert is present. Use a session cookie, set and read from
38
+ # JS on the links, to control whether the box or link is displayed.
39
+ %>
40
+
41
+
42
+ <div id="alert_show_link"
43
+ style="display: none; margin-top: 0.7ex; margin-bottom: 0.7ex;">
44
+ <%= link_to_function "Show Alert", "dynamic_alert_show_box();" %>
45
+ </div>
46
+
47
+ <div id="alert_box" style="display: none;">
48
+ <div id="alert_box_close_link">
49
+ <%= link_to_function "X", "dynamic_alert_show_link();" %>
50
+ </div>
51
+ <%= open(FormatHelper::ALERT_CONTENT_PATH).read %>
52
+ </div>
53
+
54
+ <script>
55
+ if (Cookie.get( alert_cookie_name ) == "true")
56
+ document.getElementById('alert_show_link').style.display = 'block';
57
+ else
58
+ document.getElementById('alert_box').style.display = 'block';
59
+ </script>
@@ -23,18 +23,26 @@
23
23
  WontoMedia.ads.google.publisher_id and
24
24
  WontoMedia.ads.google.data_page_slot %>
25
25
 
26
- <div id="block-google" class="box" style="width: 98%; text-align: center;">
27
- <script type="text/javascript"><!--
28
- google_ad_client = "<%= WontoMedia.ads.google.publisher_id -%>";
29
- /* Wontology Column */
30
- google_ad_slot = "<%= WontoMedia.ads.google.data_page_slot -%>";
31
- google_ad_width = 160;
32
- google_ad_height = 600;
33
- //--></script>
34
- <script type="text/javascript"
35
- src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
36
- </script>
37
- </div>
26
+ <!-- specifying the height for this div prevents re-layout when content
27
+ is added later in page load. Must update if ad unit changes -->
28
+ <div id="block-google-ad" class="box"
29
+ style="width: 98%; height: 600px; text-align: center;"></div>
30
+ <script>
31
+ addToDivsToMove('block-google-ad');
32
+ </script>
38
33
 
34
+ <% content_for :last_bottom_page_js do %>
35
+ <div id="block-google-ad-content" style="display: none;">
36
+ <script type="text/javascript"><!--
37
+ google_ad_client = "<%= WontoMedia.ads.google.publisher_id -%>";
38
+ google_ad_slot = "<%= WontoMedia.ads.google.data_page_slot -%>";
39
+ google_ad_width = 160;
40
+ google_ad_height = 600;
41
+ //--></script>
42
+ <script type="text/javascript"
43
+ src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
44
+ </script>
45
+ </div>
46
+ <% end %>
39
47
  <% end %>
40
48
  <% end %>
@@ -17,8 +17,6 @@
17
17
  # see "http://www.gnu.org/licenses/".
18
18
  %>
19
19
 
20
- <% if @display_unimplemented %>
21
- <div id="block-help" style="float: right;">
22
- <span class="unimplemented">[top-level "Help" link]</span>
20
+ <div id="block-help">
21
+ <%= link_to 'Help', WontoMedia.help_url_prefix + "Help:Main_Page" %>
23
22
  </div>
24
- <% end %>
@@ -56,9 +56,8 @@
56
56
  </div>
57
57
  </div>
58
58
  <div id="column-left">
59
- <%= link_to(
60
- image_tag( '/images/logo.png', :alt=>'Logo', :width=>'100%',
61
- :style=>'margin-bottom: 0.7ex;' ), root_url ) %>
59
+ <%= link_to( logo_image, root_url ) %>
60
+ <%= allpages_alert %>
62
61
  <%= render :partial => "layouts/amazon_ads" %>
63
62
  </div>
64
63
  </div>
@@ -89,5 +89,8 @@
89
89
  <% end %>
90
90
  <% end %>
91
91
  <%= yield(:last_bottom_page_js) %>
92
+ <script>
93
+ moveAndDisplayDelayedDivs();
94
+ </script>
92
95
  </body>
93
96
  </html>
@@ -50,15 +50,15 @@
50
50
  <%= render :partial => "layouts/search_box" %>
51
51
  </div>
52
52
  <div id="page-top-controls"
53
- style="position: absolute; top: 0; right: 16.9%;">
53
+ style="position: absolute; top: 0; right: 15.6%;">
54
54
  <%= render :partial => "layouts/master_help" %>
55
55
  <%= render :partial => "layouts/language_select" %>
56
56
  <%= render :partial => "layouts/login_controls" %>
57
57
  </div>
58
58
  </div>
59
59
  <div id="column-left" style="width: 98%">
60
- <%= image_tag '/images/logo.png', :alt=>'Logo', :width=>'100%',
61
- :style=>'margin-bottom: 0.7ex;' %>
60
+ <%= logo_image %>
61
+ <%= allpages_alert %>
62
62
  <%= yield( :left_column ) %>
63
63
  </div>
64
64
  </div>
@@ -28,9 +28,12 @@ WontoMedia = OpenStruct.new({
28
28
 
29
29
  :ads => OpenStruct.new({
30
30
  # :amazon => OpenStruct.new({
31
+ # # the color scheme of Amazon ads is controlled from JS constants
32
+ # # in /app/views/layouts/_amazon_ads.html.erb
31
33
  # :associate_id => "your-amazon-id-here"
32
34
  # }),
33
35
  # :google => OpenStruct.new({
36
+ # # the color scheme of Google ads is controlled from their site
34
37
  # :publisher_id => "your-google-id-here",
35
38
  # # "data page" is used in the partial common/_google_ads,
36
39
  # # which is used in [items or connections]/[index or show] pages
@@ -21,10 +21,12 @@ javascripts:
21
21
  - fancybox
22
22
  - reconcileJQueryAndPrototype
23
23
  - prototype
24
+ - cookies
24
25
  - topAfterJQuery:
25
26
  - fancybox
26
27
  - reconcileJQueryAndPrototype
27
28
  - prototype
29
+ - cookies
28
30
  - bottomJS:
29
31
  - effects
30
32
  - controls
@@ -20,10 +20,8 @@
20
20
  common = uber_common + "--format progress "
21
21
  tags_common = "--tags ~@invalid"
22
22
  tags_rake = "--tags ~@extended"
23
- static = "-r features/support/local.rb " +
24
- "-r features/support/static.rb -r features/step_definitions "
25
- dynamic = "-r features/support/local.rb " +
26
- "-r features/support/dynamic.rb -r features/step_definitions "
23
+ static = "-r features/support/static.rb -r features/step_definitions "
24
+ dynamic = "-r features/support/dynamic.rb -r features/step_definitions "
27
25
  static_only = "--exclude=dynamic features "
28
26
  dynamic_only = "--exclude=static features "
29
27
  %>
@@ -15,8 +15,26 @@
15
15
  # along with this program in the file COPYING and/or LICENSE. If not,
16
16
  # see <http://www.gnu.org/licenses/>.
17
17
 
18
+ #### Active lines here at the top of file. Unused Rails boiler-plate down below
19
+
20
+ RAILS_GEM_VERSION = '~> 2.3' unless defined? RAILS_GEM_VERSION
21
+ require File.join(File.dirname(__FILE__), 'boot')
22
+
23
+ Rails::Initializer.run do |config|
24
+ # config.log_level = :debug
25
+
26
+ config.frameworks -= [ :action_mailer ]
27
+ config.time_zone = 'UTC'
28
+ config.action_controller.session = {
29
+ :session_key => '_wontomedia_session',
30
+ :secret => '1f59de398da7f80aca3f4a943eae6e8f5759efe7ec9e7690c57a4f485012f4f487ccf4530d4885a70fb20f51801306ddc50688b00bb3616da44303238cb15a64'
31
+ }
32
+ end
18
33
 
19
34
 
35
+
36
+ ###########################################################################
37
+
20
38
  # Be sure to restart your server when you modify this file
21
39
 
22
40
  # Uncomment below to force Rails into production mode when
@@ -24,12 +42,12 @@
24
42
  # ENV['RAILS_ENV'] ||= 'production'
25
43
 
26
44
  # Specifies gem version of Rails to use when vendor/rails is not present
27
- RAILS_GEM_VERSION = '~> 2.3' unless defined? RAILS_GEM_VERSION
45
+ #RAILS_GEM_VERSION = '~> 2.3' unless defined? RAILS_GEM_VERSION
28
46
 
29
47
  # Bootstrap the Rails environment, frameworks, and default configuration
30
- require File.join(File.dirname(__FILE__), 'boot')
48
+ #require File.join(File.dirname(__FILE__), 'boot')
31
49
 
32
- Rails::Initializer.run do |config|
50
+ #Rails::Initializer.run do |config|
33
51
  # Settings in config/environments/* take precedence over those specified here.
34
52
  # Application configuration should go into files in config/initializers
35
53
  # -- all .rb files in that directory are automatically loaded.
@@ -62,7 +80,7 @@ Rails::Initializer.run do |config|
62
80
  # Make Time.zone default to the specified zone, and make Active Record store time values
63
81
  # in the database in UTC, and return them converted to the specified local zone.
64
82
  # Run "rake -D time" for a list of tasks for finding time zone names. Comment line to use default local time.
65
- config.time_zone = 'UTC'
83
+ # config.time_zone = 'UTC'
66
84
 
67
85
  # The internationalization framework can be changed to have another default locale (standard is :en) or more load paths.
68
86
  # All files from config/locales/*.rb,yml are added automatically.
@@ -73,10 +91,10 @@ Rails::Initializer.run do |config|
73
91
  # If you change this key, all old sessions will become invalid!
74
92
  # Make sure the secret is at least 30 characters and all random,
75
93
  # no regular words or you'll be exposed to dictionary attacks.
76
- config.action_controller.session = {
77
- :session_key => '_wontomedia_session',
78
- :secret => '1f59de398da7f80aca3f4a943eae6e8f5759efe7ec9e7690c57a4f485012f4f487ccf4530d4885a70fb20f51801306ddc50688b00bb3616da44303238cb15a64'
79
- }
94
+ # config.action_controller.session = {
95
+ # :session_key => '_wontomedia_session',
96
+ # :secret => '1f59de398da7f80aca3f4a943eae6e8f5759efe7ec9e7690c57a4f485012f4f487ccf4530d4885a70fb20f51801306ddc50688b00bb3616da44303238cb15a64'
97
+ # }
80
98
 
81
99
  # Use the database for sessions instead of the cookie-based default,
82
100
  # which shouldn't be used to store highly confidential information
@@ -91,4 +109,4 @@ Rails::Initializer.run do |config|
91
109
  # Activate observers that should always be running
92
110
  # Please note that observers generated using script/generate observer need to have an _observer suffix
93
111
  # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
94
- end
112
+ #end
@@ -7,6 +7,7 @@
7
7
  active area background: light blue #d0d0ff
8
8
  content border: 2nd-darkest blue #b0b0ff
9
9
  dk blue #040460
10
+ error color: dk red #990000 ; scaffold.css, .png's
10
11
  unvisited link color: #1d43c0
11
12
  visited link color: #64439d
12
13
  accent color: yellow
@@ -183,6 +184,8 @@ p.unimplemented {
183
184
  }
184
185
  .tip {
185
186
  display: none;
187
+ font-weight: normal;
188
+ white-space: nowrap;
186
189
  }
187
190
  .texthastip:hover .tip,
188
191
  .linkhastip:hover .tip {
@@ -207,6 +210,35 @@ p + table { margin-bottom: 1.5em; }
207
210
  letter-spacing: -0.3em;
208
211
  }
209
212
 
213
+ #block-help {
214
+ float: right;
215
+ border-width: 1px;
216
+ border-color: #e8e8ff;
217
+ border-style: none solid solid;
218
+ background: #f8f8ff;
219
+ padding: 0 0.3em;
220
+ height: 2.7ex;
221
+ font-size: 200%;
222
+ }
223
+
224
+ #alert_box {
225
+ width: 30%;
226
+ position: fixed;
227
+ top: 18px;
228
+ left: 35%;
229
+ z-index: 150;
230
+ font-size: 110%;
231
+ font-weight: bold;
232
+ background: url("/images/alert_background.png") repeat;
233
+ text-align: center;
234
+ }
235
+ #alert_box_close_link {
236
+ float: right;
237
+ border: solid 1px #1d43c0;
238
+ margin: 0 5px;
239
+ }
240
+
241
+
210
242
 
211
243
  /* styles first intended for item & connection info tables:
212
244
  * app/views/ ** /index, home, show */
@@ -275,7 +307,7 @@ p.directions {
275
307
 
276
308
  .helpTextFlagged {
277
309
  font-weight: bold;
278
- color: #e80000;
310
+ color: #990000;
279
311
  }
280
312
 
281
313
  .confirmationTextInvisible {
@@ -284,7 +316,7 @@ p.directions {
284
316
 
285
317
  .confirmationTextShow {
286
318
  display: inline;
287
- color: #6794ff;
319
+ color: #b0b0ff;
288
320
  }
289
321
 
290
322
  .activeButton {
@@ -16,10 +16,22 @@
16
16
  // see <http://www.gnu.org/licenses/>.
17
17
 
18
18
 
19
+ // invoked at bottom of app/views/layouts/base.html.erb
20
+ function moveAndDisplayDelayedDivs(){
21
+ if (typeof divsToMove !== 'undefined')
22
+ for (var c =0; c < divsToMove.length; c++){
23
+ var targetDiv = document.getElementById( divsToMove[c] );
24
+ var divWithAd = document.getElementById( divsToMove[c] + '-content' );
19
25
 
20
- // Place your application-specific JavaScript functions and classes here
21
- // This file is automatically included by javascript_include_tag :defaults
22
-
26
+ // remove the ad div from the main document
27
+ var parent = divWithAd.parentNode;
28
+ parent.removeChild( divWithAd );
29
+ // put the ad div into its target location on the page
30
+ targetDiv.appendChild( divWithAd );
31
+ // and make it visible
32
+ divWithAd.style.display = 'block';
33
+ }
34
+ }
23
35
 
24
36
 
25
37
  // common to several forms
@@ -50,7 +62,20 @@ jQuery(document).ready(function() {
50
62
  "Click outside box or type 'ESC' to close</span>"; },
51
63
  'transitionIn' : 'elastic',
52
64
  'transitionOut' : 'elastic',
65
+ 'width' : '80%',
53
66
  'type' : 'iframe'
54
67
  });
55
68
  });
56
69
 
70
+
71
+ function dynamic_alert_show_box(){
72
+ Cookie.set( alert_cookie_name, "false" );
73
+ document.getElementById('alert_box').style.display = 'block';
74
+ document.getElementById('alert_show_link').style.display = 'none';
75
+ }
76
+
77
+ function dynamic_alert_show_link(){
78
+ Cookie.set( alert_cookie_name, "true" );
79
+ document.getElementById('alert_box').style.display = 'none';
80
+ document.getElementById('alert_show_link').style.display = 'block';
81
+ }
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Small Cookies JavaScript Helper
3
+ *
4
+ * Source code available at http://github.com/tdd/cookies-js-helper
5
+ *
6
+ * Copyright (c) 2010 Christophe Porteneuve <tdd@tddsworld.com>
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person
9
+ * obtaining a copy of this software and associated documentation
10
+ * files (the "Software"), to deal in the Software without
11
+ * restriction, including without limitation the rights to use,
12
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ * copies of the Software, and to permit persons to whom the
14
+ * Software is furnished to do so, subject to the following
15
+ * conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be
18
+ * included in all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27
+ * OTHER DEALINGS IN THE SOFTWARE.
28
+ */
29
+
30
+ (function(scope) {
31
+
32
+ var _toString = Object.prototype.toString;
33
+ function isDate(o) { return '[object Date]' == _toString.call(o); }
34
+ function isRegExp(o) { return '[object RegExp]' == _toString.call(o); }
35
+
36
+ var Cookie = {
37
+
38
+ /**
39
+ * Cookie.get(name) -> String | null
40
+ * - name (String): The name of the cookie you want to fetch.
41
+ *
42
+ * Returns the cookie’s value for the passed name, or +null+ if the cookie
43
+ * does not exist.
44
+ */
45
+ get: function get(name) {
46
+ return Cookie.has(name) ? Cookie.list()[name] : null;
47
+ },
48
+
49
+ /**
50
+ * Cookie.has(name) -> Boolean
51
+ * - name (String): The name of the cookie you want to test the presence of.
52
+ *
53
+ * Returns whether the cookie for that name exists or not.
54
+ */
55
+ has: function has(name) {
56
+ return new RegExp("(?:;\\s*|^)" + encodeURIComponent(name) + '=').test(document.cookie);
57
+ },
58
+
59
+ /**
60
+ * Cookie.list([nameRegExp]) -> { name: value[, name: value …]}
61
+ * - nameRegExp (RegExp) an optional `RegExp` to filter cookie names. If anything but
62
+ * an actual `RegExp` is passed, this argument is ignored.
63
+ *
64
+ * Returns a key-value dictionary of existing cookies for the current page.
65
+ * Note the ordering of names is basically browser-dependent (as in, JS-engine-dependent).
66
+ */
67
+ list: function list(nameRegExp) {
68
+ var pairs = document.cookie.split(';'), pair, result = {};
69
+ for (var index = 0, len = pairs.length; index < len; ++index) {
70
+ pair = pairs[index].split('=');
71
+ if (!isRegExp(nameRegExp) || nameRegExp.test(pair[0]))
72
+ result[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
73
+ }
74
+ return result;
75
+ },
76
+
77
+ /**
78
+ * Cookie.remove(name[, options]) -> String
79
+ * - name (String): The name of the cookie you want to remove.
80
+ * - options (Object): An optional set of settings for cookie removal. See Cookie.set for details.
81
+ *
82
+ * Removes the cookie value for the name you passed, honoring potential filtering options.
83
+ * Returns the actual cookie string written to the underlying `document.cookie` property.
84
+ */
85
+ remove: function remove(name, options) {
86
+ var opt2 = {};
87
+ for (var key in (options || {})) opts2[key] = options[key];
88
+ opt2.expires = new Date(0);
89
+ opt2.maxAge = -1;
90
+ return Cookie.set(name, null, opt2);
91
+ },
92
+
93
+ /**
94
+ * Cookie.set(name, value, [, options]) -> String
95
+ * - name (String): The name of the cookie you want to set.
96
+ * - value (Object): The value for the cookie you want to set. It will undergo a basic `toString()`
97
+ * transform, so if it's a complex object you likely want to, say, use its JSON representation instead.
98
+ * - options (Object): An optional set of settings for cookie setting. See below.
99
+ *
100
+ * Sets a cookie for the name and value you passed, honoring potential filtering options.
101
+ * Returns the actual cookie string written to the underlying `document.cookie` property.
102
+ *
103
+ * Possible options are:
104
+ *
105
+ * * `path` sets the path within the current domain. Defaults to the current path. Minimum is '/'.
106
+ * Ignored if blank.
107
+ * * `domain` sets the (sub)domain this cookie pertains to. At the shortest, the current root
108
+ * domain (e.g. 'example.com'), but can also be any depth of subdomain up to the current one
109
+ * (e.g. 'www.demo.example.com'). Ignored if blank.
110
+ * * `maxAge` / `max_age` / `max-age` is one way to define when the cookie should expire; this
111
+ * is a time-to-live in _seconds_. Any of the three keys is accepted, in this order of
112
+ * decreasing priority (first found key short-circuits the latter ones).
113
+ * * `expires` is the traditional way of setting a cookie expiry, using an absolute GMT date/time
114
+ * string with an RFC2822 format (e.g. 'Tue, 02 Feb 2010 22:04:47 GMT'). You can also pass
115
+ * a `Date` object set appropriately, in which case its `toUTCString()` method will be used.
116
+ * * `secure` defines whether the cookie should only be passed through HTTPS connections. It's
117
+ * used as `Boolean`-equivalent (so zero, `null`, `undefined` and the empty string are all false).
118
+ */
119
+ set: function set(name, value, options) {
120
+ options = options || {};
121
+ var def = [encodeURIComponent(name) + '=' + encodeURIComponent(value)];
122
+ if (options.path) def.push('path=' + options.path);
123
+ if (options.domain) def.push('domain=' + options.path);
124
+ var maxAge = 'maxAge' in options ? options.maxAge :
125
+ ('max_age' in options ? options.max_age : options['max-age']), maxAgeNbr;
126
+ if ('undefined' != typeof maxAge && 'null' != typeof maxAge && (!isNaN(maxAgeNbr = parseFloat(maxAge))))
127
+ def.push('max-age=' + maxAgeNbr);
128
+ var expires = isDate(options.expires) ? options.expires.toUTCString() : options.expires;
129
+ if (expires) def.push('expires=' + expires);
130
+ if (options.secure) def.push('secure');
131
+ def = def.join('; ');
132
+ document.cookie = def;
133
+ return def;
134
+ },
135
+
136
+ /**
137
+ * Cookie.test() -> Boolean
138
+ *
139
+ * Tests whether cookies are enabled or not.
140
+ */
141
+ test: function test() {
142
+ var key = '70ab3d396b85e670f25b93be05e027e4eb655b71', value = 'Élodie Jaubert'
143
+ Cookie.remove(key);
144
+ Cookie.set(key, value);
145
+ var result = value == Cookie.get(key);
146
+ Cookie.remove(key);
147
+ return result;
148
+ },
149
+ };
150
+ scope.Cookie = Cookie;
151
+ })(window);
@@ -16,4 +16,15 @@
16
16
  // see <http://www.gnu.org/licenses/>.
17
17
 
18
18
 
19
+ // this has to execute between when we load jQuery and when we load Prototype
19
20
  jQuery.noConflict(); // free-up '$' for 'prototype' (in :defaults)
21
+
22
+
23
+ // these are WontoMedia helpers that need to be available at the top of page
24
+ function addToDivsToMove(divId){
25
+ if (typeof divsToMove === 'undefined')
26
+ divsToMove = new Array();
27
+ divsToMove[ divsToMove.length ] = divId;
28
+ }
29
+
30
+ alert_cookie_name = 'show_alert';
@@ -1,12 +1,12 @@
1
1
  .fieldWithErrors {
2
2
  padding: 2px;
3
- background-color: red;
3
+ background-color: #990000;
4
4
  display: table;
5
5
  }
6
6
 
7
7
  #errorExplanation {
8
8
  width: 400px;
9
- border: 2px solid red;
9
+ border: 2px solid #990000;
10
10
  padding: 7px;
11
11
  padding-bottom: 12px;
12
12
  margin-bottom: 20px;
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Glen E. Ivey
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-02-25 00:00:00 -08:00
17
+ date: 2010-03-08 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -80,6 +80,7 @@ files:
80
80
  - app/views/items/newpop.html.erb
81
81
  - app/views/items/show.html.erb
82
82
  - app/views/layouts/_amazon_ads.html.erb
83
+ - app/views/layouts/_dynamic_alert_framework.html.erb
83
84
  - app/views/layouts/_glossary_help_box.html.erb
84
85
  - app/views/layouts/_google_ads.html.erb
85
86
  - app/views/layouts/_language_select.html.erb
@@ -144,6 +145,7 @@ files:
144
145
  - public/dispatch.fcgi
145
146
  - public/dispatch.rb
146
147
  - public/favicon.ico
148
+ - public/images/alert_background.png
147
149
  - public/images/blank_error_icon.png
148
150
  - public/images/blank_status_icon.png
149
151
  - public/images/error_error_icon.png
@@ -155,6 +157,7 @@ files:
155
157
  - public/images/working_status_icon.gif
156
158
  - public/javascripts/application.js
157
159
  - public/javascripts/controls.js
160
+ - public/javascripts/cookies.js
158
161
  - public/javascripts/dragdrop.js
159
162
  - public/javascripts/effects.js
160
163
  - public/javascripts/event.simulate.js