Revision ce43eae7

b/snf-astakos-app/astakos/im/static/im/css/forms.css
23 23
form .form-row .extra-link 					{ color: #808080; text-decoration: none; border: none; margin-top:15px; line-height:98%; display:inline-block; padding-top:15px;   float: right; position:absolute; right:0; top:0; }
24 24
form .form-row .extra-link:hover			{ border-bottom:1px solid #9e9e9e;}
25 25
form .form-row label 						{ font-size: 1.077em; }
26
form.innerlabels label 						{ position: absolute; bottom: 11px; left: 1.5em; color: #808080 ; }
26
form.innerlabels label 						{ display: none;}
27 27
form.innerlabels p 							{ margin:0; position: relative;}
28 28
form.innerlabels p.p15px					{ font-size:1.154em;}
29 29
form.innerlabels p.p15px a					{ margin:0 5px;}
......
229 229

  
230 230
form.withlabels.upperlabels label 					{ text-transform: uppercase;}
231 231
form.withlabels.upperlabels textarea				{ margin-top:10px;}
232
form.innerlabels input::-webkit-input-placeholder {
233
   color: #808080;
234
   font-style: normal;
235
}
236

  
237
form.innerlabels input:-moz-placeholder { /* Firefox 18- */
238
   color: #808080;
239
   font-style: normal;
240
}
241

  
242
form.innerlabels input::-moz-placeholder {  /* Firefox 19+ */
243
   color: #808080;
244
   font-style: normal;
245
}
246

  
247
form.innerlabels input:-ms-input-placeholder {  
248
   color: #808080;
249
   font-style: normal;
250
}
b/snf-astakos-app/astakos/im/static/im/js/common.js
398 398
         $('.hidden-submit .form-row.submit').slideDown(500);
399 399
    });
400 400
      
401
    setTimeout(function() {
402
        var innerInputs = $('form.innerlabels input[type="text"], form.innerlabels input[type="password"]');
403
        _.each(innerInputs, function(val, key,list){
404
          if ($(val).val()){
405
            $(val).siblings('label').css('opacity','0');
406
          };
407
        });
408
    }, 200);
401
    var innerInputs = $('form.innerlabels input[type="text"], form.innerlabels input[type="password"]');
402
    _.each(innerInputs, function(val, key, list){
403
        var txt =  $(val).siblings('label').text();
404
        $(val).attr('placeholder',txt);
405
    });
406

  
407
    $(function() {
408
      $('input, textarea').placeholder();
409
    });
409 410

  
410 411
	
411
	// landing-page initialization
412
	  // landing-page initialization
412 413
    if ($('.landing-page').length > 0) {
413 414
      var wrapper = $(".landing-page");
414 415
      var services = wrapper.find(".landing-service");
b/snf-astakos-app/astakos/im/static/im/js/jquery.placeholder.js
1
/*! http://mths.be/placeholder v2.0.7 by @mathias */
2
;(function(window, document, $) {
3

  
4
    // Opera Mini v7 doesn’t support placeholder although its DOM seems to indicate so
5
    var isOperaMini = Object.prototype.toString.call(window.operamini) == '[object OperaMini]';
6
    var isInputSupported = 'placeholder' in document.createElement('input') && !isOperaMini;
7
    var isTextareaSupported = 'placeholder' in document.createElement('textarea') && !isOperaMini;
8
    var prototype = $.fn;
9
    var valHooks = $.valHooks;
10
    var propHooks = $.propHooks;
11
    var hooks;
12
    var placeholder;
13

  
14
    if (isInputSupported && isTextareaSupported) {
15

  
16
        placeholder = prototype.placeholder = function() {
17
            return this;
18
        };
19

  
20
        placeholder.input = placeholder.textarea = true;
21

  
22
    } else {
23

  
24
        placeholder = prototype.placeholder = function() {
25
            var $this = this;
26
            $this
27
                .filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]')
28
                .not('.placeholder')
29
                .bind({
30
                    'focus.placeholder': clearPlaceholder,
31
                    'blur.placeholder': setPlaceholder
32
                })
33
                .data('placeholder-enabled', true)
34
                .trigger('blur.placeholder');
35
            return $this;
36
        };
37

  
38
        placeholder.input = isInputSupported;
39
        placeholder.textarea = isTextareaSupported;
40

  
41
        hooks = {
42
            'get': function(element) {
43
                var $element = $(element);
44

  
45
                var $passwordInput = $element.data('placeholder-password');
46
                if ($passwordInput) {
47
                    return $passwordInput[0].value;
48
                }
49

  
50
                return $element.data('placeholder-enabled') && $element.hasClass('placeholder') ? '' : element.value;
51
            },
52
            'set': function(element, value) {
53
                var $element = $(element);
54

  
55
                var $passwordInput = $element.data('placeholder-password');
56
                if ($passwordInput) {
57
                    return $passwordInput[0].value = value;
58
                }
59

  
60
                if (!$element.data('placeholder-enabled')) {
61
                    return element.value = value;
62
                }
63
                if (value == '') {
64
                    element.value = value;
65
                    // Issue #56: Setting the placeholder causes problems if the element continues to have focus.
66
                    if (element != safeActiveElement()) {
67
                        // We can't use `triggerHandler` here because of dummy text/password inputs :(
68
                        setPlaceholder.call(element);
69
                    }
70
                } else if ($element.hasClass('placeholder')) {
71
                    clearPlaceholder.call(element, true, value) || (element.value = value);
72
                } else {
73
                    element.value = value;
74
                }
75
                // `set` can not return `undefined`; see http://jsapi.info/jquery/1.7.1/val#L2363
76
                return $element;
77
            }
78
        };
79

  
80
        if (!isInputSupported) {
81
            valHooks.input = hooks;
82
            propHooks.value = hooks;
83
        }
84
        if (!isTextareaSupported) {
85
            valHooks.textarea = hooks;
86
            propHooks.value = hooks;
87
        }
88

  
89
        $(function() {
90
            // Look for forms
91
            $(document).delegate('form', 'submit.placeholder', function() {
92
                // Clear the placeholder values so they don't get submitted
93
                var $inputs = $('.placeholder', this).each(clearPlaceholder);
94
                setTimeout(function() {
95
                    $inputs.each(setPlaceholder);
96
                }, 10);
97
            });
98
        });
99

  
100
        // Clear placeholder values upon page reload
101
        $(window).bind('beforeunload.placeholder', function() {
102
            $('.placeholder').each(function() {
103
                this.value = '';
104
            });
105
        });
106

  
107
    }
108

  
109
    function args(elem) {
110
        // Return an object of element attributes
111
        var newAttrs = {};
112
        var rinlinejQuery = /^jQuery\d+$/;
113
        $.each(elem.attributes, function(i, attr) {
114
            if (attr.specified && !rinlinejQuery.test(attr.name)) {
115
                newAttrs[attr.name] = attr.value;
116
            }
117
        });
118
        return newAttrs;
119
    }
120

  
121
    function clearPlaceholder(event, value) {
122
        var input = this;
123
        var $input = $(input);
124
        if (input.value == $input.attr('placeholder') && $input.hasClass('placeholder')) {
125
            if ($input.data('placeholder-password')) {
126
                $input = $input.hide().next().show().attr('id', $input.removeAttr('id').data('placeholder-id'));
127
                // If `clearPlaceholder` was called from `$.valHooks.input.set`
128
                if (event === true) {
129
                    return $input[0].value = value;
130
                }
131
                $input.focus();
132
            } else {
133
                input.value = '';
134
                $input.removeClass('placeholder');
135
                input == safeActiveElement() && input.select();
136
            }
137
        }
138
    }
139

  
140
    function setPlaceholder() {
141
        var $replacement;
142
        var input = this;
143
        var $input = $(input);
144
        var id = this.id;
145
        if (input.value == '') {
146
            if (input.type == 'password') {
147
                if (!$input.data('placeholder-textinput')) {
148
                    try {
149
                        $replacement = $input.clone().attr({ 'type': 'text' });
150
                    } catch(e) {
151
                        $replacement = $('<input>').attr($.extend(args(this), { 'type': 'text' }));
152
                    }
153
                    $replacement
154
                        .removeAttr('name')
155
                        .data({
156
                            'placeholder-password': $input,
157
                            'placeholder-id': id
158
                        })
159
                        .bind('focus.placeholder', clearPlaceholder);
160
                    $input
161
                        .data({
162
                            'placeholder-textinput': $replacement,
163
                            'placeholder-id': id
164
                        })
165
                        .before($replacement);
166
                }
167
                $input = $input.removeAttr('id').hide().prev().attr('id', id).show();
168
                // Note: `$input[0] != input` now!
169
            }
170
            $input.addClass('placeholder');
171
            $input[0].value = $input.attr('placeholder');
172
        } else {
173
            $input.removeClass('placeholder');
174
        }
175
    }
176

  
177
    function safeActiveElement() {
178
        // Avoid IE9 `document.activeElement` of death
179
        // https://github.com/mathiasbynens/jquery-placeholder/pull/99
180
        try {
181
            return document.activeElement;
182
        } catch (err) {}
183
    }
184

  
185
}(this, document, jQuery));
b/snf-astakos-app/astakos/im/templates/im/base.html
48 48
  	  <script src="{{ IM_STATIC_URL }}js/os.js"></script>	
49 49
      <script src="{{ IM_STATIC_URL }}js/modernizr-2.0.6.js"></script>	
50 50
      <script src="{{ IM_STATIC_URL }}js/jquery.js"></script>	
51
      <script src="{{ IM_STATIC_URL }}js/jquery.infieldlabel.js"></script>	
52 51
      <script src="{{ IM_STATIC_URL }}js/forms.js"></script>
53 52
      <script src="{{ IM_STATIC_URL }}js/jquery.dropkick-1.0.0.js"></script>
54 53
      <script src="{{ IM_STATIC_URL }}js/jquery-ui-1.8.21.custom.min.js"></script>
......
58 57
      <script src="{{ IM_STATIC_URL }}js/jquery.dataTables.js"></script>
59 58
      <script src="{{ IM_STATIC_URL }}js/dataTables.date.js"></script>
60 59
      <script src="{{ IM_STATIC_URL }}js/dataTables.numbersHTML.js"></script>
60
      <script src="{{ IM_STATIC_URL }}js/jquery.placeholder.js"></script>
61 61
      <script src="{{ IM_STATIC_URL }}js/common.js"></script> 
62 62
  {% endblock headjs %}
63 63
  {% block endhead %}{% endblock endhead %}
64 64

  
65 65
  <script type="text/javascript">
66 66
      $(document).ready(function() {
67
          $("form.innerlabels label").inFieldLabels();
68 67
          $("form").each(function(){
69 68
            if ($(this).hasClass("login")) { return }
70 69
            

Also available in: Unified diff