Commits

Konstantine Rybnikov committed 9fbdaf6

more work

Comments (0)

Files changed (8)

design/css/style.css

    Author: 
    ========================================================================== */
 
+#container {
+    
+}
 
+header.index-page-header {
+    font-size: 46px;
+    font-family: Palatino,Georgia,Times,"Times New Roman";
+}
+
+header.index-page-header .index-page-header-big-screaming-thing {
+    text-transform: uppercase;
+    text-shadow: 0 0 1px #666677;
+    text-align: center;
+}
 
 
 

design/index.html

 <!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
 <!-- Consider adding an manifest.appcache: h5bp.com/d/Offline -->
 <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
-<head>
-  <meta charset="utf-8">
+    <head>
+        <meta charset="utf-8">
 
-  <!-- Use the .htaccess and remove these lines to avoid edge case issues.
-       More info: h5bp.com/b/378 -->
-  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+        <!-- Use the .htaccess and remove these lines to avoid edge case issues.
+             More info: h5bp.com/b/378 -->
+        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 
-  <title></title>
-  <meta name="description" content="">
-  <meta name="author" content="">
+        <title></title>
+        <meta name="description" content="">
+        <meta name="author" content="">
 
-  <!-- Mobile viewport optimized: j.mp/bplateviewport -->
-  <meta name="viewport" content="width=device-width,initial-scale=1">
+        <!-- Mobile viewport optimized: j.mp/bplateviewport -->
+        <meta name="viewport" content="width=device-width,initial-scale=1">
 
-  <!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->
+        <!-- Place favicon.ico and apple-touch-icon.png in the root directory:
+             mathiasbynens.be/notes/touch-icons -->
 
-  <!-- CSS: implied media=all -->
-  <!-- CSS concatenated and minified via ant build script-->
-  <link rel="stylesheet" href="css/style.css">
-  <!-- end CSS-->
+        <!-- CSS: implied media=all -->
+        <!-- CSS concatenated and minified via ant build script-->
+        <link rel="stylesheet" href="css/style.css">
+        <!-- end CSS-->
 
-  <!-- More ideas for your <head> here: h5bp.com/d/head-Tips -->
+        <!-- More ideas for your <head> here: h5bp.com/d/head-Tips -->
 
-  <!-- All JavaScript at the bottom, except for Modernizr / Respond.
-       Modernizr enables HTML5 elements & feature detects; Respond is a polyfill for min/max-width CSS3 Media Queries
-       For optimal performance, use a custom Modernizr build: www.modernizr.com/download/ -->
-  <script src="js/libs/modernizr-2.0.6.min.js"></script>
-</head>
+        <!-- All JavaScript at the bottom, except for Modernizr / Respond.
+             Modernizr enables HTML5 elements & feature detects;
+             Respond is a polyfill for min/max-width CSS3 Media Queries
+             For optimal performance, use a custom Modernizr build:
+             www.modernizr.com/download/ -->
+        <script src="js/libs/modernizr-2.0.6.min.js"></script>
+    </head>
 
-<body>
+    <body>
 
-  <div id="container">
-    <header>
+        <div id="container">
+            <header class="index-page-header">
+                <div class="index-page-header-big-screaming-thing">Fat Po Editor</div>
+            </header>
+            <div id="main" role="main">
+                <h1>Hello, gays!</h1>
+                How are you?
+            </div>
+            <footer>
+                Fat Po Editor
+            </footer>
+        </div> <!--! end of #container -->
 
-    </header>
-    <div id="main" role="main">
 
-    </div>
-    <footer>
+        <!-- JavaScript at the bottom for fast page loading -->
 
-    </footer>
-  </div> <!--! end of #container -->
+        <!-- Grab Google CDN's jQuery, with a protocol relative URL;
+             fall back to local if offline -->
+        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
+        <script>window.jQuery || document.write('<script src="js/libs/jquery-1.6.2.min.js"><\/script>')</script>
 
 
-  <!-- JavaScript at the bottom for fast page loading -->
+            <!-- scripts concatenated and minified via ant build script-->
+            <script defer src="js/plugins.js"></script>
+            <script defer src="js/script.js"></script>
+            <!-- end scripts-->
 
-  <!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
-  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
-  <script>window.jQuery || document.write('<script src="js/libs/jquery-1.6.2.min.js"><\/script>')</script>
-
-
-  <!-- scripts concatenated and minified via ant build script-->
-  <script defer src="js/plugins.js"></script>
-  <script defer src="js/script.js"></script>
-  <!-- end scripts-->
-
-	
-  <!-- Change UA-XXXXX-X to be your site's ID -->
-  <!--
-  <script>
-    window._gaq = [['_setAccount','UAXXXXXXXX1'],['_trackPageview'],['_trackPageLoadTime']];
-    Modernizr.load({
-      load: ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js'
-    });
-  </script>
-  -->
-
-
-  <!-- Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6.
-       chromium.org/developers/how-tos/chrome-frame-getting-started -->
-  <!--[if lt IE 7 ]>
-    <script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
-    <script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
-  <![endif]-->
-  
-</body>
+	        
+            <!-- Prompt IE 6 users to install Chrome Frame.
+                 Remove this if you want to support IE 6.
+                 chromium.org/developers/how-tos/chrome-frame-getting-started -->
+            <!--[if lt IE 7 ]>
+                <script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
+                <script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
+                <![endif]-->
+            
+    </body>
 </html>

design/js/mylibs/slots.js

+(function() {
+  var Connection, connect, connections, send, setStrict, signal, slot, strict;
+  var __slice = Array.prototype.slice;
+  Connection = (function() {
+    function Connection(sender, signal, receiver, slot) {
+      this.sender = sender;
+      this.signal = signal;
+      this.receiver = receiver;
+      this.slot = slot;
+    }
+    return Connection;
+  })();
+  connections = [];
+  strict = true;
+  send = function() {
+    var c, params, sender, signal, _i, _len, _ref, _results;
+    sender = arguments[0], signal = arguments[1], params = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
+    _results = [];
+    for (_i = 0, _len = connections.length; _i < _len; _i++) {
+      c = connections[_i];
+      _results.push(c.sender === sender && c.signal === signal ? (_ref = c.receiver)[c.slot].apply(_ref, params) : void 0);
+    }
+    return _results;
+  };
+  signal = function(clazz, name) {
+    clazz.prototype[name] = function() {
+      var params;
+      params = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+      return send.apply(null, [this, name].concat(__slice.call(params)));
+    };
+    return clazz.prototype[name].__sigslot_signal = true;
+  };
+  slot = function(clazz, name) {
+    return clazz.prototype[name].__sigslot_slot = true;
+  };
+  connect = function(sender, signal, receiver, slot) {
+    var c, cn, _i, _len;
+    if (strict) {
+      if (!sender[signal].__sigslot_signal) {
+        throw "Signal parameter '" + signal + "' to connect is not a signal";
+      }
+      if (!receiver[slot].__sigslot_slot) {
+        throw "Slot parameter '" + slot + "' to connect is not a slot";
+      }
+    }
+    cn = new Connection(sender, signal, receiver, slot);
+    for (_i = 0, _len = connections.length; _i < _len; _i++) {
+      c = connections[_i];
+      if (c.sender === cn.sender && c.signal === cn.signal && c.receiver === cn.receiver && c.slot === cn.slot) {
+        return;
+      }
+    }
+    return connections.push(cn);
+  };
+  setStrict = function(val) {
+    return strict = val;
+  };
+}).call(this);

design/js/script.js

+(function() {
+  yepnope('/mylibs/slots.js');
+  log('> log');
+  console.log('> console.log');
+}).call(this);

design/js/scripts.js

-(function() {
-  var world;
-  world = "pstojuick";
-  console.log("hello, " + world);
-}).call(this);

design/js/src/mylibs/slots.coffee

+##
+# Slots and signals implementation for classes
+# (Porting to using simple functions should be almost trivial
+##
+
+class Connection
+    constructor: (@sender, @signal, @receiver, @slot) ->
+
+connections = [] # List of connections
+strict = true
+
+# Internal function that calls all the slots connected to signal with params
+send = (sender, signal, params...) ->
+    for c in connections
+        if c.sender == sender && c.signal == signal
+            c.receiver[ c.slot ](params...)
+
+# CREATE a function with name `name` on the class with arbitrary parameters
+# Calling this function will fire the event
+# Mark the function as a signal
+signal = (clazz, name) ->
+    clazz.prototype[name] = (params...) ->
+        send(this, name, params...)
+    clazz.prototype[name].__sigslot_signal = true
+
+# MARK function as a slot
+slot = (clazz, name) -> clazz.prototype[name].__sigslot_slot = true
+
+# Connect the signal to the slot, ensuring that one signal is connected to a slot once at most
+connect = (sender, signal, receiver, slot) ->
+    # Check for valid parameters if strict flag is set
+    if strict
+        throw "Signal parameter '" + signal + "' to connect is not a signal" if not sender[signal].__sigslot_signal
+        throw "Slot parameter '" + slot + "' to connect is not a slot" if not receiver[slot].__sigslot_slot
+
+    # Craete connection, add to connection list if needed
+    cn = new Connection(sender, signal, receiver, slot)
+    for c in connections
+        if c.sender == cn.sender && c.signal == cn.signal && c.receiver == cn.receiver && c.slot == cn.slot
+            return
+    connections.push cn
+
+# Throw exception if trying to use non-signal function as signal, or non-slot function as slot?
+# Note: there's no guarantee that a function not created with `signal` used as a signal will actually fire the signal
+# A function not marked as a slot will work just fine, but strict mode won't accept it
+setStrict = (val) -> strict = val
+

design/js/src/script.coffee

+yepnope('/mylibs/slots.js')
+log('> log')
+console.log('> console.log')

design/js/src/scripts.coffee

-world = "pstojuick"
-console.log("hello, #{world}")