Browse Source

Initial commit

master
Shikiryu 4 years ago
commit
725f42609c
9 changed files with 578 additions and 0 deletions
  1. BIN
      ShikiTimbre100.png
  2. BIN
      contactbg.jpg
  3. 94
    0
      index.php
  4. 198
    0
      jquery.tipsy.js
  5. 196
    0
      override.css
  6. 40
    0
      plugins.js
  7. 38
    0
      send.php
  8. 12
    0
      tipsy.css
  9. BIN
      tipsy.gif

BIN
ShikiTimbre100.png View File


BIN
contactbg.jpg View File


+ 94
- 0
index.php
File diff suppressed because it is too large
View File


+ 198
- 0
jquery.tipsy.js View File

@@ -0,0 +1,198 @@
1
+// tipsy, facebook style tooltips for jquery
2
+// version 1.0.0a
3
+// (c) 2008-2010 jason frame [jason@onehackoranother.com]
4
+// releated under the MIT license
5
+
6
+(function($) {
7
+    
8
+    function fixTitle($ele) {
9
+        if ($ele.attr('title') || typeof($ele.attr('original-title')) != 'string') {
10
+            $ele.attr('original-title', $ele.attr('title') || '').removeAttr('title');
11
+        }
12
+    }
13
+    
14
+    function Tipsy(element, options) {
15
+        this.$element = $(element);
16
+        this.options = options;
17
+        this.enabled = true;
18
+        fixTitle(this.$element);
19
+    }
20
+    
21
+    Tipsy.prototype = {
22
+        show: function() {
23
+            var title = this.getTitle();
24
+            if (title && this.enabled) {
25
+                var $tip = this.tip();
26
+                
27
+                $tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
28
+                $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
29
+                $tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body);
30
+                
31
+                var pos = $.extend({}, this.$element.offset(), {
32
+                    width: this.$element[0].offsetWidth,
33
+                    height: this.$element[0].offsetHeight
34
+                });
35
+                
36
+                var actualWidth = $tip[0].offsetWidth, actualHeight = $tip[0].offsetHeight;
37
+                var gravity = (typeof this.options.gravity == 'function')
38
+                                ? this.options.gravity.call(this.$element[0])
39
+                                : this.options.gravity;
40
+                
41
+                var tp;
42
+                switch (gravity.charAt(0)) {
43
+                    case 'n':
44
+                        tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
45
+                        break;
46
+                    case 's':
47
+                        tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
48
+                        break;
49
+                    case 'e':
50
+                        tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
51
+                        break;
52
+                    case 'w':
53
+                        tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
54
+                        break;
55
+                }
56
+                
57
+                if (gravity.length == 2) {
58
+                    if (gravity.charAt(1) == 'w') {
59
+                        tp.left = pos.left + pos.width / 2 - 15;
60
+                    } else {
61
+                        tp.left = pos.left + pos.width / 2 - actualWidth + 15;
62
+                    }
63
+                }
64
+                
65
+                $tip.css(tp).addClass('tipsy-' + gravity);
66
+                
67
+                if (this.options.fade) {
68
+                    $tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
69
+                } else {
70
+                    $tip.css({visibility: 'visible', opacity: this.options.opacity});
71
+                }
72
+            }
73
+        },
74
+        
75
+        hide: function() {
76
+            if (this.options.fade) {
77
+                this.tip().stop().fadeOut(function() { $(this).remove(); });
78
+            } else {
79
+                this.tip().remove();
80
+            }
81
+        },
82
+        
83
+        getTitle: function() {
84
+            var title, $e = this.$element, o = this.options;
85
+            fixTitle($e);
86
+            var title, o = this.options;
87
+            if (typeof o.title == 'string') {
88
+                title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
89
+            } else if (typeof o.title == 'function') {
90
+                title = o.title.call($e[0]);
91
+            }
92
+            title = ('' + title).replace(/(^\s*|\s*$)/, "");
93
+            return title || o.fallback;
94
+        },
95
+        
96
+        tip: function() {
97
+            if (!this.$tip) {
98
+                this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"/></div>');
99
+            }
100
+            return this.$tip;
101
+        },
102
+        
103
+        validate: function() {
104
+            if (!this.$element[0].parentNode) {
105
+                this.hide();
106
+                this.$element = null;
107
+                this.options = null;
108
+            }
109
+        },
110
+        
111
+        enable: function() { this.enabled = true; },
112
+        disable: function() { this.enabled = false; },
113
+        toggleEnabled: function() { this.enabled = !this.enabled; }
114
+    };
115
+    
116
+    $.fn.tipsy = function(options) {
117
+        
118
+        if (options === true) {
119
+            return this.data('tipsy');
120
+        } else if (typeof options == 'string') {
121
+            return this.data('tipsy')[options]();
122
+        }
123
+        
124
+        options = $.extend({}, $.fn.tipsy.defaults, options);
125
+        
126
+        function get(ele) {
127
+            var tipsy = $.data(ele, 'tipsy');
128
+            if (!tipsy) {
129
+                tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
130
+                $.data(ele, 'tipsy', tipsy);
131
+            }
132
+            return tipsy;
133
+        }
134
+        
135
+        function enter() {
136
+            var tipsy = get(this);
137
+            tipsy.hoverState = 'in';
138
+            if (options.delayIn == 0) {
139
+                tipsy.show();
140
+            } else {
141
+                setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
142
+            }
143
+        };
144
+        
145
+        function leave() {
146
+            var tipsy = get(this);
147
+            tipsy.hoverState = 'out';
148
+            if (options.delayOut == 0) {
149
+                tipsy.hide();
150
+            } else {
151
+                setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
152
+            }
153
+        };
154
+        
155
+        if (!options.live) this.each(function() { get(this); });
156
+        
157
+        if (options.trigger != 'manual') {
158
+            var binder   = options.live ? 'live' : 'bind',
159
+                eventIn  = options.trigger == 'hover' ? 'mouseenter' : 'focus',
160
+                eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
161
+            this[binder](eventIn, enter)[binder](eventOut, leave);
162
+        }
163
+        
164
+        return this;
165
+        
166
+    };
167
+    
168
+    $.fn.tipsy.defaults = {
169
+        delayIn: 0,
170
+        delayOut: 0,
171
+        fade: false,
172
+        fallback: '',
173
+        gravity: 'n',
174
+        html: false,
175
+        live: false,
176
+        offset: 0,
177
+        opacity: 0.8,
178
+        title: 'title',
179
+        trigger: 'hover'
180
+    };
181
+    
182
+    // Overwrite this method to provide options on a per-element basis.
183
+    // For example, you could store the gravity in a 'tipsy-gravity' attribute:
184
+    // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
185
+    // (remember - do not modify 'options' in place!)
186
+    $.fn.tipsy.elementOptions = function(ele, options) {
187
+        return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
188
+    };
189
+    
190
+    $.fn.tipsy.autoNS = function() {
191
+        return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
192
+    };
193
+    
194
+    $.fn.tipsy.autoWE = function() {
195
+        return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
196
+    };
197
+    
198
+})(jQuery);

+ 196
- 0
override.css
File diff suppressed because it is too large
View File


+ 40
- 0
plugins.js View File

@@ -0,0 +1,40 @@
1
+
2
+// remap jQuery to $
3
+(function($){
4
+
5
+ $('input[type=text], input[type=email], textarea').tipsy({trigger: 'focus', gravity: 'w'});
6
+
7
+
8
+$('#send').click(function(e){
9
+	e.preventDefault();
10
+	$.post('send.php', { msg: $('textarea[name=msg]').val(), name: $('input[name=name]').val(), email:  $('input[name=email]').val(), from: $('input[name=from]').val()}, function(data){if(data == 'ok'){$('#container').animate({left: '+=5000'}, 1500, 'swing', function(){$('#msgOK').fadeTo(1500, 1)});}else{$('#returnMsg').html('').append('error : '+data);}});
11
+}); 
12
+
13
+
14
+
15
+})(window.jQuery);
16
+
17
+
18
+
19
+// usage: log('inside coolFunc',this,arguments);
20
+// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
21
+window.log = function(){
22
+  log.history = log.history || [];   // store logs to an array for reference
23
+  log.history.push(arguments);
24
+  if(this.console){
25
+    console.log( Array.prototype.slice.call(arguments) );
26
+  }
27
+};
28
+
29
+
30
+
31
+// catch all document.write() calls
32
+(function(doc){
33
+  var write = doc.write;
34
+  doc.write = function(q){ 
35
+    log('document.write(): ',arguments); 
36
+    if (/docwriteregexwhitelist/.test(q)) write.apply(doc,arguments);  
37
+  };
38
+})(document);
39
+
40
+

+ 38
- 0
send.php View File

@@ -0,0 +1,38 @@
1
+<?
2
+ini_set("display_errors", "off"); 
3
+ini_set("log_errors", "on");
4
+ini_set('error_log', $_SERVER['DOCUMENT_ROOT'].'/contact/log.log');
5
+set_include_path('/path/to/zend/');
6
+if(isset($_POST['email'])){
7
+	$email = $_POST['email'];
8
+	$name = $_POST['name'];
9
+	$msg = $_POST['msg'];
10
+	$from = $_POST['from'];
11
+	include 'Zend/Validate/EmailAddress.php';
12
+	$emailValidator     = new Zend_Validate_EmailAddress();
13
+	if(trim($email) == '' || trim($name) == '' || trim($msg) == ''){
14
+		echo '<div class="error"><span class="english">You must fill every fields</span><br/><span class="french">Vous devez remplir tous les champs</span></div>';
15
+		exit;
16
+	}
17
+	if($emailValidator->isValid($email) && trim($name) != '' && trim($msg) != ''){
18
+        include 'Zend/Mail.php';
19
+		$body = 'Message de '.$name.' ('.$email.")\n\n";
20
+		$body .= $msg;
21
+        $message = new Zend_Mail('utf-8');
22
+        $message->setFrom($email, 'Contact')
23
+                ->setSubject('Un message du site (ref : '.$from.')')
24
+                ->setBodyText($body)
25
+				->setReplyTo($email, $name)
26
+                ->addTo('mail@example.net');
27
+        $message->send();
28
+		echo 'ok';
29
+		exit;
30
+	}else{
31
+		$errorType = $emailValidator->getErrors();
32
+		if(isset($errorType[0])){
33
+			$errormsg = $emailValidator->getMessageTemplates();
34
+			echo '<div class="error"><span class="english">Email : '.str_replace('%value%', $email, $errormsg[$errorType[0]]).'</span></div>'; 
35
+			exit;
36
+		}
37
+	}
38
+}

+ 12
- 0
tipsy.css View File

@@ -0,0 +1,12 @@
1
+.tipsy { padding: 5px; font-size: 10px; position: absolute; z-index: 100000; }
2
+  .tipsy-inner { padding: 5px 8px 4px 8px; background-color: black; color: white; max-width: 200px; text-align: center; }
3
+  .tipsy-inner { border-radius: 3px; -moz-border-radius:3px; -webkit-border-radius:3px; }
4
+  .tipsy-arrow { position: absolute; background: url('tipsy.gif') no-repeat top left; width: 9px; height: 5px; }
5
+  .tipsy-n .tipsy-arrow { top: 0; left: 50%; margin-left: -4px; }
6
+    .tipsy-nw .tipsy-arrow { top: 0; left: 10px; }
7
+    .tipsy-ne .tipsy-arrow { top: 0; right: 10px; }
8
+  .tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -4px; background-position: bottom left; }
9
+    .tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; background-position: bottom left; }
10
+    .tipsy-se .tipsy-arrow { bottom: 0; right: 10px; background-position: bottom left; }
11
+  .tipsy-e .tipsy-arrow { top: 50%; margin-top: -4px; right: 0; width: 5px; height: 9px; background-position: top right; }
12
+  .tipsy-w .tipsy-arrow { top: 50%; margin-top: -4px; left: 0; width: 5px; height: 9px; }

BIN
tipsy.gif View File


Loading…
Cancel
Save