Browse Source

app abbozzata

cri 8 years ago
parent
commit
82e8e83c03

+ 398 - 0
Gruntfile-example.js

@@ -0,0 +1,398 @@
+// Generated on 2015-02-03 using
+// generator-webapp 0.5.1
+'use strict';
+
+// # Globbing
+// for performance reasons we're only matching one level down:
+// 'test/spec/{,*/}*.js'
+// If you want to recursively match all subfolders, use:
+// 'test/spec/**/*.js'
+
+module.exports = function (grunt) {
+
+  // Time how long tasks take. Can help when optimizing build times
+  require('time-grunt')(grunt);
+
+  // Load grunt tasks automatically
+  require('load-grunt-tasks')(grunt);
+
+  // Configurable paths
+  var config = {
+    app: 'app',
+    dist: 'dist'
+  };
+
+  // Define the configuration for all the tasks
+  grunt.initConfig({
+
+    // Project settings
+    config: config,
+
+    // Watches files for changes and runs tasks based on the changed files
+    watch: {
+      bower: {
+        files: ['bower.json'],
+        tasks: ['wiredep']
+      },
+      js: {
+        files: ['<%= config.app %>/scripts/{,*/}*.js'],
+        tasks: ['jshint'],
+        options: {
+          livereload: true
+        }
+      },
+      jstest: {
+        files: ['test/spec/{,*/}*.js'],
+        tasks: ['test:watch']
+      },
+      gruntfile: {
+        files: ['Gruntfile.js']
+      },
+      styles: {
+        files: ['<%= config.app %>/styles/{,*/}*.css'],
+        tasks: ['newer:copy:styles', 'autoprefixer']
+      },
+      livereload: {
+        options: {
+          livereload: '<%= connect.options.livereload %>'
+        },
+        files: [
+          '<%= config.app %>/{,*/}*.html',
+          '.tmp/styles/{,*/}*.css',
+          '<%= config.app %>/assets/{,*/}*'
+        ]
+      }
+    },
+
+    // The actual grunt server settings
+    connect: {
+      options: {
+        port: 8090,
+        open: true,
+        livereload: 35729,
+        // Change this to '0.0.0.0' to access the server from outside
+        hostname: 'localhost'
+      },
+      livereload: {
+        options: {
+          middleware: function(connect) {
+            return [
+              connect.static('.tmp'),
+              connect().use('/bower_components', connect.static('./bower_components')),
+              connect.static(config.app)
+            ];
+          }
+        }
+      },
+      test: {
+        options: {
+          open: false,
+          port: 9001,
+          middleware: function(connect) {
+            return [
+              connect.static('.tmp'),
+              connect.static('test'),
+              connect().use('/bower_components', connect.static('./bower_components')),
+              connect.static(config.app)
+            ];
+          }
+        }
+      },
+      dist: {
+        options: {
+          base: '<%= config.dist %>',
+          livereload: false
+        }
+      }
+    },
+
+    // Empties folders to start fresh
+    clean: {
+      dist: {
+        files: [{
+          dot: true,
+          src: [
+            '.tmp',
+            '<%= config.dist %>/*',
+            '!<%= config.dist %>/.git*'
+          ]
+        }]
+      },
+      server: '.tmp'
+    },
+
+    // Make sure code styles are up to par and there are no obvious mistakes
+    jshint: {
+      options: {
+        jshintrc: '.jshintrc',
+        reporter: require('jshint-stylish')
+      },
+      all: [
+        'Gruntfile.js',
+        '<%= config.app %>/scripts/{,*/}*.js',
+        '!<%= config.app %>/scripts/vendor/*',
+        'test/spec/{,*/}*.js'
+      ]
+    },
+
+    // Add vendor prefixed styles
+    autoprefixer: {
+      options: {
+        browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1']
+      },
+      dist: {
+        files: [{
+          expand: true,
+          cwd: '.tmp/styles/',
+          src: '{,*/}*.css',
+          dest: '.tmp/styles/'
+        }]
+      }
+    },
+
+    // Automatically inject Bower components into the HTML file
+    wiredep: {
+      app: {
+        ignorePath: /^\/|\.\.\//,
+        src: ['<%= config.app %>/index.html'],
+        exclude: ['bower_components/bootstrap/dist/js/bootstrap.js']
+      }
+    },
+
+    // Renames files for browser caching purposes
+    rev: {
+      dist: {
+        files: {
+          src: [
+            '<%= config.dist %>/scripts/{,*/}*.js',
+            '<%= config.dist %>/styles/{,*/}*.css',
+            '<%= config.dist %>/assets/{,*/}*.*',
+            '<%= config.dist %>/styles/fonts/{,*/}*.*',
+            '<%= config.dist %>/*.{ico,png}'
+          ]
+        }
+      }
+    },
+
+    // Reads HTML for usemin blocks to enable smart builds that automatically
+    // concat, minify and revision files. Creates configurations in memory so
+    // additional tasks can operate on them
+    useminPrepare: {
+      options: {
+        dest: '<%= config.dist %>'
+      },
+      html: '<%= config.app %>/index.html'
+    },
+
+    // Performs rewrites based on rev and the useminPrepare configuration
+    usemin: {
+      options: {
+        assetsDirs: [
+          '<%= config.dist %>',
+          '<%= config.dist %>/assets',
+          '<%= config.dist %>/styles'
+        ]
+      },
+      html: ['<%= config.dist %>/{,*/}*.html'],
+      css: ['<%= config.dist %>/styles/{,*/}*.css']
+    },
+
+    // The following *-min tasks produce minified files in the dist folder
+    imagemin: {
+      dist: {
+        files: [{
+          expand: true,
+          cwd: '<%= config.app %>/assets',
+          src: '{,*/}*.{gif,jpeg,jpg,png}',
+          dest: '<%= config.dist %>/assets'
+        }]
+      }
+    },
+
+    svgmin: {
+      dist: {
+        files: [{
+          expand: true,
+          cwd: '<%= config.app %>/assets',
+          src: '{,*/}*.svg',
+          dest: '<%= config.dist %>/assets'
+        }]
+      }
+    },
+
+    htmlmin: {
+      dist: {
+        options: {
+          collapseBooleanAttributes: true,
+          collapseWhitespace: true,
+          conservativeCollapse: true,
+          removeAttributeQuotes: true,
+          removeCommentsFromCDATA: true,
+          removeEmptyAttributes: true,
+          removeOptionalTags: true,
+          removeRedundantAttributes: true,
+          useShortDoctype: true
+        },
+        files: [{
+          expand: true,
+          cwd: '<%= config.dist %>',
+          src: '{,*/}*.html',
+          dest: '<%= config.dist %>'
+        }]
+      }
+    },
+
+    // By default, your `index.html`'s <!-- Usemin block --> will take care
+    // of minification. These next options are pre-configured if you do not
+    // wish to use the Usemin blocks.
+    // cssmin: {
+    //   dist: {
+    //     files: {
+    //       '<%= config.dist %>/styles/main.css': [
+    //         '.tmp/styles/{,*/}*.css',
+    //         '<%= config.app %>/styles/{,*/}*.css'
+    //       ]
+    //     }
+    //   }
+    // },
+    // uglify: {
+    //   dist: {
+    //     files: {
+    //       '<%= config.dist %>/scripts/scripts.js': [
+    //         '<%= config.dist %>/scripts/scripts.js'
+    //       ]
+    //     }
+    //   }
+    // },
+    // concat: {
+    //   dist: {}
+    // },
+
+    // Copies remaining files to places other tasks can use
+    copy: {
+      dist: {
+        files: [{
+          expand: true,
+          dot: true,
+          cwd: '<%= config.app %>',
+          dest: '<%= config.dist %>',
+          src: [
+            '*.{ico,png,txt}',
+            'assets/{,*/}*.webp',
+            '{,*/}*.html',
+            'styles/fonts/{,*/}*.*'
+          ]
+        }, {
+          src: 'node_modules/apache-server-configs/dist/.htaccess',
+          dest: '<%= config.dist %>/.htaccess'
+        }, {
+          expand: true,
+          dot: true,
+          cwd: 'bower_components/bootstrap/dist',
+          src: 'fonts/*',
+          dest: '<%= config.dist %>'
+        }]
+      },
+      styles: {
+        expand: true,
+        dot: true,
+        cwd: '<%= config.app %>/styles',
+        dest: '.tmp/styles/',
+        src: '{,*/}*.css'
+      }
+    },
+
+    // Generates a custom Modernizr build that includes only the tests you
+    // reference in your app
+    modernizr: {
+      dist: {
+        devFile: 'bower_components/modernizr/modernizr.js',
+        outputFile: '<%= config.dist %>/scripts/vendor/modernizr.js',
+        files: {
+          src: [
+            '<%= config.dist %>/scripts/{,*/}*.js',
+            '<%= config.dist %>/styles/{,*/}*.css',
+            '!<%= config.dist %>/scripts/vendor/*'
+          ]
+        },
+        uglify: true
+      }
+    },
+
+    // Run some tasks in parallel to speed up build process
+    concurrent: {
+      server: [
+        'copy:styles'
+      ],
+      test: [
+        'copy:styles'
+      ],
+      dist: [
+        'copy:styles',
+        'imagemin',
+        'svgmin'
+      ]
+    }
+  });
+
+
+  grunt.registerTask('serve', 'start the server and preview your app, --allow-remote for remote access', function (target) {
+    if (grunt.option('allow-remote')) {
+      grunt.config.set('connect.options.hostname', '0.0.0.0');
+    }
+    if (target === 'dist') {
+      return grunt.task.run(['build', 'connect:dist:keepalive']);
+    }
+
+    grunt.task.run([
+      'clean:server',
+      'wiredep',
+      'concurrent:server',
+      'autoprefixer',
+      'connect:livereload',
+      'watch'
+    ]);
+  });
+
+  grunt.registerTask('server', function (target) {
+    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
+    grunt.task.run([target ? ('serve:' + target) : 'serve']);
+  });
+
+  grunt.registerTask('test', function (target) {
+    if (target !== 'watch') {
+      grunt.task.run([
+        'clean:server',
+        'concurrent:test',
+        'autoprefixer'
+      ]);
+    }
+
+    grunt.task.run([
+      'connect:test',
+      'mocha'
+    ]);
+  });
+
+  grunt.registerTask('build', [
+    'clean:dist',
+    'wiredep',
+    'useminPrepare',
+    'concurrent:dist',
+    'autoprefixer',
+    'concat',
+    'cssmin',
+    'uglify',
+    'copy:dist',
+    'modernizr',
+    'rev',
+    'usemin',
+    'htmlmin'
+  ]);
+
+  grunt.registerTask('default', [
+    'newer:jshint',
+    'test',
+    'build'
+  ]);
+};

+ 241 - 0
Gruntfile.js

@@ -0,0 +1,241 @@
+'use strict';
+
+/*global module:false*/
+module.exports = function (grunt) {
+    // Time how long tasks take. Can help when optimizing build times
+    require('time-grunt')(grunt);
+
+    // Configurable paths
+    var config = {
+        app: 'app',
+        dist: 'dist'
+    };
+
+    // Project configuration.
+    grunt.initConfig({
+        // Project settings
+        config: config,
+
+        // Metadata.
+        pkg: grunt.file.readJSON('package.json'),
+
+        banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
+            '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
+            '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
+            '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
+            ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
+
+        // Task configuration.
+        concat: {
+            options: {
+                banner: '<%= banner %>',
+                stripBanners: true
+            },
+            dist: {
+                src: ['<%= config.app %>/lib/<%= pkg.name %>.js'],
+                dest: 'dist/<%= pkg.name %>.js'
+            }
+        },
+
+        uglify: {
+            options: {
+                banner: '<%= banner %>'
+            },
+            dist: {
+                src: '<%= concat.dist.dest %>',
+                dest: 'dist/<%= pkg.name %>.min.js'
+            }
+        },
+
+        jshint: {
+            options: {
+                curly: true,
+                eqeqeq: true,
+                immed: true,
+                latedef: true,
+                newcap: true,
+                noarg: true,
+                sub: true,
+                undef: true,
+                unused: true,
+                boss: true,
+                eqnull: true,
+                browser: true,
+                globals: {
+                    jQuery: true
+                }
+            },
+            gruntfile: {
+                src: 'Gruntfile.js'
+            },
+            lib_test: {
+                src: ['<%= config.app %>/lib/**/*.js', 'test/**/*.js']
+            }
+        },
+
+        watch: {
+            bower: {
+                files: ['bower.json'],
+                tasks: ['wiredep']
+            },
+            js: {
+                files: ['<%= config.app %>/scripts/{,*/}*.js'],
+                tasks: ['jshint'],
+                options: {
+                    livereload: true
+                }
+            },
+            styles: {
+                files: ['<%= config.app %>/styles/{,*/}*.css'],
+                tasks: ['newer:copy:styles', 'autoprefixer']
+            },
+            livereload: {
+                options: {
+                    livereload: '<%= connect.options.livereload %>'
+                },
+                files: [
+                  '<%= config.app %>/{,*/}*.html',
+                  '.tmp/styles/{,*/}*.css',
+                  '<%= config.app %>/img/{,*/}*'
+                ]
+            },
+            gruntfile: {
+                files: '<%= jshint.gruntfile.src %>',
+            },
+        },
+
+        clean: {
+            dist: {
+                files: [{
+                    dot: true,
+                    src: [
+                        '.tmp',
+                        '<%= config.dist %>/*'
+                    ]
+                }]
+            },
+            server: '.tmp'
+        },
+
+        // Automatically inject Bower components into the HTML file
+        wiredep: {
+            app: {
+                ignorePath: /^\/|\.\.\//,
+                src: ['<%= config.app %>/index.html'],
+                /*exclude: ['bower_components/bootstrap/dist/js/bootstrap.js']*/
+            }
+        },
+
+        // Run some tasks in parallel to speed up build process
+        concurrent: {
+            server: [
+                'copy:styles'
+            ]
+        },
+
+        // Add vendor prefixed styles
+        autoprefixer: {
+            options: {
+                browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1']
+            },
+            dist: {
+                files: [{
+                    expand: true,
+                    cwd: '.tmp/styles/',
+                    src: '{,*/}*.css',
+                    dest: '.tmp/styles/'
+        }]
+            }
+        },
+
+        // The actual grunt server settings
+        connect: {
+            options: {
+                port: 8090,
+                open: true,
+                livereload: 35729,
+                // Change this to '0.0.0.0' to access the server from outside
+                hostname: 'localhost'
+            },
+            livereload: {
+                options: {
+                    middleware: function (connect) {
+                        return [
+                          connect.static('.tmp'),
+                          connect().use('/bower_components', connect.static('./bower_components')),
+                          connect.static(config.app)
+                        ];
+                    }
+                }
+            },
+            dist: {
+                options: {
+                    base: '<%= config.dist %>',
+                    livereload: false
+                }
+            }
+        },
+
+        // Copies remaining files to places other tasks can use
+        copy: {
+            dist: {
+                files: [{
+                    expand: true,
+                    dot: true,
+                    cwd: '<%= config.app %>',
+                    dest: '<%= config.dist %>',
+                    src: [
+                        '*.{ico,png,txt}',
+                        '{,*/}*.html',
+                        'fonts/{,*/}*.*'
+                    ]
+                    }, {
+                    src: '<%= config.app %>/.htaccess',
+                    dest: '<%= config.dist %>/.htaccess'
+                    }]
+            },
+            styles: {
+                expand: true,
+                dot: true,
+                cwd: '<%= config.app %>/styles',
+                dest: '.tmp/styles/',
+                src: '{,*/}*.css'
+            }
+        },
+    });
+
+    // These plugins provide necessary tasks.
+    grunt.loadNpmTasks('grunt-contrib-concat');
+    grunt.loadNpmTasks('grunt-contrib-uglify');
+    grunt.loadNpmTasks('grunt-contrib-jshint');
+    grunt.loadNpmTasks('grunt-contrib-watch');
+    grunt.loadNpmTasks('grunt-contrib-clean');
+    grunt.loadNpmTasks('grunt-wiredep');
+    grunt.loadNpmTasks('grunt-concurrent');
+    grunt.loadNpmTasks('grunt-autoprefixer');
+    grunt.loadNpmTasks('grunt-contrib-connect');
+    grunt.loadNpmTasks('grunt-contrib-copy');
+    grunt.loadNpmTasks('grunt-newer');
+
+    // Default task.
+    //grunt.registerTask('default', ['jshint', 'concat', 'uglify']);
+
+    grunt.registerTask('serve', 'start the server and preview your app, --allow-remote for remote access', function (target) {
+        if (grunt.option('allow-remote')) {
+            grunt.config.set('connect.options.hostname', '0.0.0.0');
+        }
+        /*if (target === 'dist') {
+            return grunt.task.run(['build', 'connect:dist:keepalive']);
+        }*/
+
+        grunt.task.run([
+          'clean:server',
+          'wiredep',
+          'concurrent:server',
+          'autoprefixer',
+          'connect:livereload',
+          'watch'
+        ]);
+    });
+
+};

+ 12 - 0
app/browserconfig.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Please read: http://msdn.microsoft.com/en-us/library/ie/dn455106.aspx -->
+<browserconfig>
+    <msapplication>
+        <tile>
+            <square70x70logo src="tile.png"/>
+            <square150x150logo src="tile.png"/>
+            <wide310x150logo src="tile-wide.png"/>
+            <square310x310logo src="tile.png"/>
+        </tile>
+    </msapplication>
+</browserconfig>

+ 15 - 0
app/crossdomain.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
+<cross-domain-policy>
+    <!-- Read this: https://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
+
+    <!-- Most restrictive policy: -->
+    <site-control permitted-cross-domain-policies="none"/>
+
+    <!-- Least restrictive policy: -->
+    <!--
+    <site-control permitted-cross-domain-policies="all"/>
+    <allow-access-from domain="*" to-ports="*" secure="false"/>
+    <allow-http-request-headers-from domain="*" headers="*" secure="false"/>
+    -->
+</cross-domain-policy>

+ 15 - 0
app/humans.txt

@@ -0,0 +1,15 @@
+# humanstxt.org/
+# The humans responsible & technology colophon
+
+# TEAM
+
+    <name> -- <role> -- <twitter>
+
+# THANKS
+
+    <name>
+
+# TECHNOLOGY COLOPHON
+
+    HTML5, CSS3
+    Normalize.css, jQuery, Modernizr

+ 63 - 0
app/index.html

@@ -0,0 +1,63 @@
+<!doctype html>
+<!--[if lt IE 7]>
+<html class = "no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
+<!--[if IE 7]>
+<html class = "no-js lt-ie9 lt-ie8"> <![endif]-->
+<!--[if IE 8]>
+<html class = "no-js lt-ie9"> <![endif]-->
+<!--[if gt IE 8]><!-->
+<html class="no-js">
+<!--<![endif]-->
+
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+
+    <title>arkiwiJsBoilerplate</title>
+    <meta name="description" content="Arkiwi JS Boilerplate">
+    <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
+    <!-- build:css styles/vendor.css -->
+    <!-- bower:css -->
+    <!-- endbower -->
+    <!-- endbuild -->
+    <!-- build:css(.tmp) styles/main.css -->
+    <link rel="stylesheet" href="styles/main.css">
+    <!-- endbuild -->
+
+
+<!-- Latest compiled and minified CSS -->
+<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
+
+<!-- Optional theme -->
+<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
+
+<!-- Latest compiled and minified JavaScript -->
+<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
+</head>
+
+<body>
+    <!--[if lt IE 10]>
+        <p class = "browsehappy">You are using an <strong>outdated</strong> browser. Please
+            <a href = "http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
+        <![endif]-->
+
+    <div class="container">
+        <header>
+            <h1>App Generated <small>with the html5 app generator</small></h1>
+            <p>Now go develop</p>
+        </header>
+    </div>
+    <!-- build:js scripts/vendor.js -->
+    <!-- bower:js -->
+    <script src="bower_components/jquery/dist/jquery.js"></script>
+    <script src="bower_components/mustache/mustache.js"></script>
+    <script src="bower_components/bower-parseuri/parseuri.js"></script>
+    <!-- endbower -->
+    <!-- endbuild -->
+
+    <script src="scripts/arkiwi.js"></script>
+    <script src="scripts/main.js"></script>
+</body>
+<div class="container-fluid" id="list" ><div class="row"></div></div>
+</html>

+ 62 - 0
app/index.html~

@@ -0,0 +1,62 @@
+<!doctype html>
+<!--[if lt IE 7]>
+<html class = "no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
+<!--[if IE 7]>
+<html class = "no-js lt-ie9 lt-ie8"> <![endif]-->
+<!--[if IE 8]>
+<html class = "no-js lt-ie9"> <![endif]-->
+<!--[if gt IE 8]><!-->
+<html class="no-js">
+<!--<![endif]-->
+
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <title>arkiwiJsBoilerplate</title>
+    <meta name="description" content="Arkiwi JS Boilerplate">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
+    <!-- build:css styles/vendor.css -->
+    <!-- bower:css -->
+    <!-- endbower -->
+    <!-- endbuild -->
+    <!-- build:css(.tmp) styles/main.css -->
+    <link rel="stylesheet" href="styles/main.css">
+    <!-- endbuild -->
+
+
+<!-- Latest compiled and minified CSS -->
+<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
+
+<!-- Optional theme -->
+<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
+
+<!-- Latest compiled and minified JavaScript -->
+<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
+</head>
+
+<body>
+    <!--[if lt IE 10]>
+        <p class = "browsehappy">You are using an <strong>outdated</strong> browser. Please
+            <a href = "http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
+        <![endif]-->
+
+    <div class="container">
+        <header>
+            <h1>App Generated <small>with the html5 app generator</small></h1>
+            <p>Now go develop</p>
+        </header>
+    </div>
+    <!-- build:js scripts/vendor.js -->
+    <!-- bower:js -->
+    <script src="bower_components/jquery/dist/jquery.js"></script>
+    <script src="bower_components/mustache/mustache.js"></script>
+    <script src="bower_components/bower-parseuri/parseuri.js"></script>
+    <!-- endbower -->
+    <!-- endbuild -->
+
+    <script src="scripts/arkiwi.js"></script>
+    <script src="scripts/main.js"></script>
+</body>
+<div class="container-fluid" id="list" ><div class="row"></div></div>
+</html>

+ 3 - 0
app/robots.txt

@@ -0,0 +1,3 @@
+# robotstxt.org/
+
+User-agent: *

+ 174 - 0
app/scripts/arkiwi.js

@@ -0,0 +1,174 @@
+/*------------------------------------------------------------------------------------------------------------------------
+ @package: arkiwiJsBoilerplate
+
+ @author: cek
+ @www: arkiwi.oeg
+
+ @copyright: COPYRIGHT 18 cek
+ @license: MIT
+
+ =============================================================================
+ Filename: arkiwi.js
+ =============================================================================
+ This file is the main entry point for js on the arkiwiJsBoilerplate app.
+ --------------------------------------------------------------------------------------------------------------------- */
+
+var ARKIWI = ARKIWI || {};
+
+ARKIWI.Arkiwi = function (endpoint, defaultParameters, formName, sessionUploadProgressName) {
+    this.endpoint = endpoint;
+    this.defaultParameters = defaultParameters || '';
+    this.formName = formName || 'arkiwiUploadForm';
+    this.sessionUploadProgressName = sessionUploadProgressName || 'PHP_SESSION_UPLOAD_PROGRESS';
+
+    this.sessionId = '';
+
+    if ($('#arkiwi_hidden_iframe').length == 0)
+        $(document.body).append('<iframe id="arkiwi_hidden_iframe" name="arkiwi_hidden_iframe" src="about:blank" style="display: none;"></iframe>');
+};
+
+ARKIWI.Arkiwi.constructor = ARKIWI.Arkiwi;
+
+ARKIWI.Arkiwi.prototype.create = function (callbacks) {
+    $.ajax({
+        url: this.endpoint + '/create/?' + this.defaultParameters,
+        type: 'GET',
+        async: false,
+        cache: false,
+        context: this,
+        data: '',
+        dataType: 'json',
+        error: function (xhr, status, error) {
+            if (error != 'Unauthorized')
+                throw 'Arkiwi.create(): error ' + error;
+            else {
+                if (callbacks != undefined && callbacks.unauthorized != undefined)
+                    callbacks.unauthorized();
+            }
+        },
+        success: function (result, status, xhr) {
+            this.sessionId = result.id;
+            if (callbacks != undefined && callbacks.success != undefined)
+                callbacks.success(this.sessionId);
+        },
+        complete: function (xhr, status) {},
+    });
+};
+
+ARKIWI.Arkiwi.prototype.upload = function (form, destinationFolderBase64, callbacks) {
+    form = $(form);
+
+    form.attr('method', 'POST');
+    form.attr('action', this.endpoint + '/upload/' + this.sessionId + '/' + destinationFolderBase64 + '/?' + this.defaultParameters);
+    form.attr('id', this.formName);
+    form.attr('enctype', 'multipart/form-data');
+    form.attr('target', 'arkiwi_hidden_iframe');
+
+    form.append('<input type="hidden" value="' + this.formName + '" name="' + this.sessionUploadProgressName + '" />');
+
+    $(':file', form).attr('name', this.sessionId);
+
+    form.ajaxForm({
+        beforeSend: function () {
+            callbacks.beforeSend();
+        },
+        uploadProgress: function (event, position, total, percentComplete) {
+            callbacks.uploadProgress(event, position, total, percentComplete);
+        },
+        complete: function (xhr) {
+            callbacks.complete(xhr);
+        },
+        error: function (xhr, status, error) {
+            throw 'Arkiwi.upload(): error ' + error;
+        }
+    });
+
+    form.submit();
+};
+
+ARKIWI.Arkiwi.prototype.metadata = function (jsonKVString, callback) {
+    $.ajax({
+        url: this.endpoint + '/metadata/' + this.sessionId + '/?' + this.defaultParameters,
+        type: 'POST',
+        async: true,
+        cache: false,
+        context: this,
+        data: jsonKVString,
+        dataType: 'json',
+        error: function (xhr, status, error) {
+            throw 'Arkiwi.metadata(): status ' + status + ' error ' + error;
+        },
+        success: function (result, status, xhr) {
+            if (callback != undefined)
+                callback(result);
+        },
+        complete: function (xhr, status) {}
+    });
+};
+
+ARKIWI.Arkiwi.prototype.removeMetadata = function (jsonKVString, callback) {
+    $.ajax({
+        url: this.endpoint + '/removemetadata/' + this.sessionId + '/?' + this.defaultParameters,
+        type: 'POST',
+        async: true,
+        cache: false,
+        context: this,
+        data: jsonKVString,
+        dataType: 'json',
+        error: function (xhr, status, error) {
+            throw 'Arkiwi.removeMetadata(): status ' + status + ' error ' + error;
+        },
+        success: function (result, status, xhr) {
+            if (callback != undefined)
+                callback(result);
+        },
+        complete: function (xhr, status) {}
+    });
+};
+
+ARKIWI.Arkiwi.prototype.close = function (callback) {
+    $.ajax({
+        url: this.endpoint + '/close/' + this.sessionId + '/?' + this.defaultParameters,
+        type: 'GET',
+        async: true,
+        cache: false,
+        context: this,
+        data: '',
+        dataType: 'json',
+        error: function (xhr, status, error) {
+            throw 'Arkiwi.close(): status ' + status + ' error ' + error;
+        },
+        success: function (result, status, xhr) {
+            if (callback != undefined)
+                callback(result);
+        },
+        complete: function (xhr, status) {}
+    });
+};
+
+ARKIWI.Arkiwi.prototype.path = function (path, callback, notBase64) {
+    var pathType = notBase64 ? 'path' : 'path64';
+
+    $.getJSON(this.endpoint + '/' + pathType + '/' + path + '/jsonml/?' + this.defaultParameters, function (result) {
+        if (callback != undefined)
+            callback(result);
+    }).fail(function (error) {
+        throw 'Arkiwi.path(): status ' + status + ' error ' + error.responseText;
+    });
+};
+
+ARKIWI.Arkiwi.prototype.search = function (query, callback, jailFolder) {
+    var sanitizedQuery = query;
+    if (jailFolder) {
+        sanitizedQuery = '+file:' + jailFolder + '* AND ' + query;
+    }
+
+    sanitizedQuery = window.btoa(sanitizedQuery); //convert to Base64
+
+    $.getJSON(this.endpoint + '/search64/' + sanitizedQuery + '/jsonml/?' + this.defaultParameters, function (result) {
+        if (callback != undefined)
+            callback(result);
+    }).fail(function (error) {
+        throw 'Arkiwi.search(): status ' + status + ' error ' + error.responseText;
+    });
+};

+ 34 - 0
app/scripts/main.js

@@ -0,0 +1,34 @@
+/*------------------------------------------------------------------------------------------------------------------------
+ @package: arkiwiJsBoilerplate
+
+ @author: cek
+ @www: arkiwi.oeg
+
+ @copyright: COPYRIGHT 18 cek
+ @license: MIT
+
+ =============================================================================
+ Filename: main.js
+ =============================================================================
+ This file is the main entry point for js on the arkiwiJsBoilerplate app.
+ --------------------------------------------------------------------------------------------------------------------- */
+$(document).ready(function () {
+    var arkiwi = new ARKIWI.Arkiwi('http://www.arkiwi.org');
+    $.get("templates/list.txt", function (template) {
+
+	arkiwi.path("XM24", function (listone) {
+	var dioporco = Mustache.render(template, listone);
+	});
+});
+
+    var arkiwi = new ARKIWI.Arkiwi('http://www.arkiwi.org');
+    arkiwi.search('Ampioraggio', function (result) {
+        console.log('Ricerca...');
+        console.log(result);
+    });
+
+    arkiwi.path('XM24', function (result) {
+        console.log('Lettura cartella...');
+        console.log(result);
+    }, true);
+});

+ 34 - 0
app/scripts/main.js~

@@ -0,0 +1,34 @@
+/*------------------------------------------------------------------------------------------------------------------------
+ @package: arkiwiJsBoilerplate
+
+ @author: cek
+ @www: arkiwi.oeg
+
+ @copyright: COPYRIGHT 18 cek
+ @license: MIT
+
+ =============================================================================
+ Filename: main.js
+ =============================================================================
+ This file is the main entry point for js on the arkiwiJsBoilerplate app.
+ --------------------------------------------------------------------------------------------------------------------- */
+$(document).ready(function () {
+    var arkiwi = new ARKIWI.Arkiwi('http://www.arkiwi.org');
+    $.get("./templates/list.txt", function (template) {
+
+	arkiwi.path("XM24", function (listone) {
+	var dioporco = Mustache.render(template, listone);
+	});
+});
+
+    var arkiwi = new ARKIWI.Arkiwi('http://www.arkiwi.org');
+    arkiwi.search('Ampioraggio', function (result) {
+        console.log('Ricerca...');
+        console.log(result);
+    });
+
+    arkiwi.path('XM24', function (result) {
+        console.log('Lettura cartella...');
+        console.log(result);
+    }, true);
+});

+ 14 - 0
app/styles/main.css

@@ -0,0 +1,14 @@
+/*------------------------------------------------------------------------------------------------------------------------
+ @package: arkiwiJsBoilerplate
+
+ @author: cek
+ @www: arkiwi.oeg
+
+ @copyright: COPYRIGHT 18 cek
+ @license: MIT
+
+ =============================================================================
+ Filename: main.css
+ =============================================================================
+ This file is responsible for all styles on the arkiwiJsBoilerplate app.
+ --------------------------------------------------------------------------------------------------------------------- */

+ 22 - 0
app/templates/copia di list.txt

@@ -0,0 +1,22 @@
+<ul>{{#items}}
+<li>
+<div class="row">
+  <div class="col-sm-6 col-md-4">
+    <div class="thumbnail">
+      <img src="..." alt="...">
+      <div class="caption">
+        <h3>Thumbnail label</h3>
+        <p>...</p>
+        <p><a href="#" class="btn btn-primary" role="button">Button</a> <a href="#" class="btn btn-default" role="button">Button</a></p>
+      </div>
+    </div>
+  </div>
+</div>
+<a href='/hack/path64/{{item.URI}}/'>{{item.title}}</a>
+{{#item.creator}}<small>by: <i>{{item.creator}}</i></small>{{/item.creator}}
+{{#item.player}}
+<p><iframe frameBorder='0' seamless='seamless' width='{{width}}' height='{{height}}' src='{{url}}'></iframe></p>
+{{/item.player}}
+<p><i>{{item.description}}</i></p>
+</li>
+{{/items}}</ul>

+ 18 - 0
app/templates/list.txt

@@ -0,0 +1,18 @@
+{{#items}}
+
+  <div class="col-sm-6 col-md-4">
+    <div class="thumbnail">
+<h3><a href='/hack/path64/{{item.URI}}/'>{{item.title}}</a></h3>
+<h4>{{#item.creator}}</h4><small>by: <i>{{item.creator}}</i></small>{{/item.creator}}
+      <img src="..." alt="...">
+{{#item.player}}
+<p><iframe style="display:none;" frameBorder='0' seamless='seamless' width='{{width}}' height='{{height}}' src='{{url}}'></iframe></p>
+{{/item.player}}
+      <div class="caption">
+        <p><i>{{item.description}}</i></p>
+        <p><a href="#" class="btn btn-primary" role="button">Button</a> <a href="#" class="btn btn-default" role="button">Button</a></p>
+      </div>
+    </div>
+  </div>
+
+{{/items}}

+ 23 - 0
app/templates/list.txt~

@@ -0,0 +1,23 @@
+{{#items}}
+
+  <div class="col-sm-6 col-md-4">
+    <div class="thumbnail">
+<h3><a href='/hack/path64/{{item.URI}}/'>{{item.title}}</a></h3>
+<h4>{{#item.creator}}</h4><small>by: <i>{{item.creator}}</i></small>{{/item.creator}}
+      <img src="..." alt="...">
+{{#item.player}}
+<p><iframe style="display:none;" frameBorder='0' seamless='seamless' width='{{width}}' height='{{height}}' src='{{url}}'></iframe></p>
+{{/item.player}}
+      <div class="caption">
+        <p><i>{{item.description}}</i></p>
+        <p><a href="#" class="btn btn-primary" role="button">Button</a> <a href="#" class="btn btn-default" role="button">Button</a></p>
+      </div>
+    </div>
+  </div>
+
+
+
+
+
+
+{{/items}}

+ 27 - 0
bower.json

@@ -0,0 +1,27 @@
+{
+  "name": "arkiwijsboilerplate",
+  "version": "0.0.1",
+  "authors": [
+    "cek<cek@posta.indivia.net>"
+  ],
+  "description": "Arkiwi JS Boilerplate",
+  "main": "app/index.html",
+  "keywords": [
+    "Arkiwi, JS, Boilerplate"
+  ],
+  "license": "MIT",
+  "homepage": "arkiwi.org",
+  "ignore": [
+    "**/.*",
+    "node_modules",
+    "bower_components",
+    "app/bower_components",
+    "test",
+    "tests"
+  ],
+  "dependencies": {
+    "jquery": "*",
+    "mustache": "~2.1.2",
+    "bower-parseuri": "~1.2.2"
+  }
+}

+ 20 - 0
package.json

@@ -0,0 +1,20 @@
+{
+  "engines": {
+    "node": ">= 0.10.0"
+  },
+  "devDependencies": {
+    "grunt": "~0.4.5",
+    "grunt-autoprefixer": "^3.0.3",
+    "grunt-concurrent": "^2.0.0",
+    "grunt-contrib-clean": "^0.6.0",
+    "grunt-contrib-concat": "~0.4.0",
+    "grunt-contrib-connect": "^0.10.1",
+    "grunt-contrib-copy": "^0.8.0",
+    "grunt-contrib-jshint": "~0.10.0",
+    "grunt-contrib-qunit": "~0.5.2",
+    "grunt-contrib-uglify": "~0.5.0",
+    "grunt-contrib-watch": "^0.6.1",
+    "grunt-newer": "^1.1.1",
+    "grunt-wiredep": "^2.0.0"
+  }
+}