فهرست منبع

chore: minor fixes

ppoffice 9 سال پیش
والد
کامیت
b421b47e18
4فایلهای تغییر یافته به همراه48 افزوده شده و 119 حذف شده
  1. 0 19
      .editorconfig
  2. 0 46
      Gruntfile.js
  3. 2 9
      package.json
  4. 46 45
      source/js/main.js

+ 0 - 19
.editorconfig

@@ -1,19 +0,0 @@
-# EditorConfig is awesome: http://EditorConfig.org
-
-# top-most EditorConfig file
-root = true
-
-# Unix-style newlines with a newline ending every file
-[*]
-end_of_line = lf
-insert_final_newline = true
-
-# Matches multiple files with brace expansion notation
-# Set default charset
-[*.{js,py}]
-charset = utf-8
-
-# 4 space indentation
-[{*.json,*.yml,*.styl,*.ejs}]
-indent_style = space
-indent_size = 2

+ 0 - 46
Gruntfile.js

@@ -1,46 +0,0 @@
-module.exports = function(grunt){
-  grunt.initConfig({
-    gitclone: {
-      fontawesome: {
-        options: {
-          repository: 'https://github.com/FortAwesome/Font-Awesome.git',
-          directory: 'tmp/fontawesome'
-        },
-      },
-      fancybox: {
-        options: {
-          repository: 'https://github.com/fancyapps/fancyBox.git',
-          directory: 'tmp/fancybox'
-        }
-      }
-    },
-    copy: {
-      fontawesome: {
-        expand: true,
-        cwd: 'tmp/fontawesome/fonts/',
-        src: ['**'],
-        dest: 'source/css/fonts/'
-      },
-      fancybox: {
-        expand: true,
-        cwd: 'tmp/fancybox/source/',
-        src: ['**'],
-        dest: 'source/fancybox/'
-      }
-    },
-    _clean: {
-      tmp: ['tmp'],
-      fontawesome: ['source/css/fonts'],
-      fancybox: ['source/fancybox']
-    }
-  });
-
-  require('load-grunt-tasks')(grunt);
-
-  grunt.renameTask('clean', '_clean');
-
-  grunt.registerTask('fontawesome', ['gitclone:fontawesome', 'copy:fontawesome', '_clean:tmp']);
-  grunt.registerTask('fancybox', ['gitclone:fancybox', 'copy:fancybox', '_clean:tmp']);
-  grunt.registerTask('default', ['gitclone', 'copy', '_clean:tmp']);
-  grunt.registerTask('clean', ['_clean']);
-};

+ 2 - 9
package.json

@@ -1,12 +1,5 @@
 {
   "name": "hexo-theme-icarus",
-  "version": "0.0.1",
-  "private": true,
-  "devDependencies": {
-    "grunt": "~0.4.2",
-    "load-grunt-tasks": "~0.2.0",
-    "grunt-git": "~0.2.2",
-    "grunt-contrib-clean": "~0.5.0",
-    "grunt-contrib-copy": "~0.4.1"
-  }
+  "version": "0.2.0",
+  "private": true
 }

+ 46 - 45
source/js/main.js

@@ -1,52 +1,53 @@
 (function($){
-  var toTop = $('#toTop').length ? $('#toTop').offset().top - $(window).height() + 20 : 0;
-
-  // Caption
-  $('.article-entry').each(function(i){
-    $(this).find('img').each(function(){
-      if ($(this).parent().hasClass('fancybox')) return;
-
-      var alt = this.alt;
-
-      if (alt) $(this).after('<span class="caption">' + alt + '</span>');
-
-      $(this).wrap('<a href="' + this.src + '" title="' + alt + '" class="fancybox"></a>');
+    var toTop = $('#toTop').length ? $('#toTop').offset().top - $(window).height() + 20 : 0;
+
+    // Caption
+    $('.article-entry').each(function(i){
+        $(this).find('img').each(function(){
+            if ($(this).parent().hasClass('fancybox')) {
+                return;
+            }
+            var alt = this.alt;
+            if (alt) {
+                $(this).after('<span class="caption">' + alt + '</span>');
+            }
+
+            $(this).wrap('<a href="' + this.src + '" title="' + alt + '" class="fancybox"></a>');
+        });
+
+        $(this).find('.fancybox').each(function(){
+            $(this).attr('rel', 'article' + i);
+        });
     });
+    if ($.fancybox){
+        $('.fancybox').fancybox();
+    }
 
-    $(this).find('.fancybox').each(function(){
-      $(this).attr('rel', 'article' + i);
+    // Profile card
+    $(document).on('click', function () {
+        $('#profile').removeClass('card');
+    }).on('click', '#profile-anchor', function (e) {
+        e.stopPropagation();
+        $('#profile').toggleClass('card');
+    }).on('click', '.profile-inner', function (e) {
+        e.stopPropagation();
     });
-  });
 
-  if ($.fancybox){
-    $('.fancybox').fancybox();
-  }
-
-  // Profile card
-  $(document).on('click', function () {
-    $('#profile').removeClass('card');
-  }).on('click', '#profile-anchor', function (e) {
-    e.stopPropagation();
-    $('#profile').toggleClass('card');
-  }).on('click', '.profile-inner', function (e) {
-    e.stopPropagation();
-  });
-
-  // To Top
-  $(document).on('scroll', function () {
-    if ($(document).width() >= 800) {
-      if($(this).scrollTop() > toTop) {
-        $('#toTop').addClass('fix');
-        $('#toTop').css('left', $('#sidebar').offset().left);
-      } else {
-        $('#toTop').removeClass('fix');
-      }
-    } else {
-      $('#toTop').addClass('fix');
-      $('#toTop').css('right', 20);
-    }
-  }).on('click', '#toTop', function () {
-    $(document).scrollTop(0);
-  });
+    // To Top
+    $(document).on('scroll', function () {
+        if ($(document).width() >= 800) {
+            if($(this).scrollTop() > toTop) {
+                $('#toTop').addClass('fix');
+                $('#toTop').css('left', $('#sidebar').offset().left);
+            } else {
+                $('#toTop').removeClass('fix');
+            }
+        } else {
+            $('#toTop').addClass('fix');
+            $('#toTop').css('right', 20);
+        }
+    }).on('click', '#toTop', function () {
+        $('body, html').animate({ scrollTop: 0 }, 600);
+    });
 
 })(jQuery);