diff --git a/README.md b/README.md index 2954d0c..dbb4d00 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,8 @@ - [x] 在热门标签里面,有在网上找的热门书签。可以转存收藏到自己书签里面,快捷键R随机查看热门书签。 - [x] 新增备忘录功能,有时候随手要做点纪录,就方便了。任意界面按快捷键A增加备忘录。双击备忘录可查看详情! - [x] 在设置的全局链接,可设置快捷键,用来在任何页面,快速打开设置的链接。 -- [x] 增加[Chrome插件](https://chrome.google.com/webstore/detail/%E4%B9%A6%E7%AD%BE%E5%BF%AB%E9%80%9F%E6%B7%BB%E5%8A%A0/paajmalhmjgdihaikmdfiplfmjlnkjgp),可在任意界面快速添加书签至系统。 -- [×] 适配手机平板,手机端请访问[m.mybookmark.cn](http://m.mybookmark.cn/)。 +- [x] 增加[Chrome插件](https://chrome.google.com/webstore/detail/%E4%B9%A6%E7%AD%BE%E5%BF%AB%E9%80%9F%E6%B7%BB%E5%8A%A0/paajmalhmjgdihaikmdfiplfmjlnkjgp),可在任意界面快速添加书签至系统。 +- [x] 适配手机平板,手机端请访问[m.mybookmark.cn](http://m.mybookmark.cn/)。 4 主要用到的模块说明 diff --git a/public/images/wx.png b/public/images/wx.png new file mode 100644 index 0000000..7392b83 Binary files /dev/null and b/public/images/wx.png differ diff --git a/public/images/zfb.png b/public/images/zfb.png new file mode 100644 index 0000000..7b74c47 Binary files /dev/null and b/public/images/zfb.png differ diff --git a/public/index.html b/public/index.html index 9efe30f..c61618e 100644 --- a/public/index.html +++ b/public/index.html @@ -51,7 +51,7 @@
- 我爱佳佳与这个世界  |  Copyleft ©All Rights Reserved LCQ  |  联系我(QQ:530485521)  |  网站源码  |  V1.5.0  |  由于使用国外服务器,如果加载失败,请按F5,你懂的!(●'◡'●)
+ 我爱佳佳与这个世界  |  Copyleft ©All Rights Reserved LCQ  |  移动设备访问  |  联系我(QQ:530485521)  |  网站源码  |  V1.5.0  |  加载失败,请按F5!(●'◡'●)
@@ -64,6 +64,7 @@
+ diff --git a/public/scripts/controllers/advice-controller.js b/public/scripts/controllers/advice-controller.js index e8656fe..54dab62 100644 --- a/public/scripts/controllers/advice-controller.js +++ b/public/scripts/controllers/advice-controller.js @@ -1,5 +1,9 @@ app.controller('adviceCtr', ['$scope', '$state', '$timeout', 'bookmarkService', 'pubSubService', 'dataService', function($scope, $state, $timeout, bookmarkService, pubSubService, dataService) { console.log("Hello adviceCtr"); + if(dataService.smallDevice()){ + $window.location = "http://m.mybookmark.cn/#/tags"; + return; + } var maxSelections = 3; $scope.comment = ''; diff --git a/public/scripts/controllers/bookmarks-controller.js b/public/scripts/controllers/bookmarks-controller.js index 558ddda..fd6778c 100644 --- a/public/scripts/controllers/bookmarks-controller.js +++ b/public/scripts/controllers/bookmarks-controller.js @@ -1,7 +1,6 @@ app.controller('bookmarksCtr', ['$scope', '$state', '$stateParams', '$filter', '$window', '$timeout', '$document', 'ngDialog', 'bookmarkService', 'pubSubService', 'dataService', function($scope, $state, $stateParams, $filter, $window, $timeout, $document, ngDialog, bookmarkService, pubSubService, dataService) { console.log("Hello bookmarksCtr...", $stateParams); - var browser = dataService.browser(); - if(browser.mobile && !browser.iPad){ + if(dataService.smallDevice()){ $window.location = "http://m.mybookmark.cn/#/tags"; return; } diff --git a/public/scripts/controllers/home-controller.js b/public/scripts/controllers/home-controller.js index a64e5eb..077bdef 100644 --- a/public/scripts/controllers/home-controller.js +++ b/public/scripts/controllers/home-controller.js @@ -1,9 +1,7 @@ app.controller('homeCtr', ['$scope', '$stateParams', '$filter', '$state', '$window', 'bookmarkService', 'pubSubService', 'dataService', function($scope, $stateParams, $filter, $state, $window, bookmarkService, pubSubService, dataService) { console.log('Hello homeCtr......'); - var browser = dataService.browser(); - if(browser.mobile && !browser.iPad){ - toastr.success(JSON.stringify(browser), "提示"); - $window.location = "http://m.mybookmark.cn"; + if(dataService.smallDevice()){ + $window.location = "http://m.mybookmark.cn/#/tags"; return; } bookmarkService.autoLogin() diff --git a/public/scripts/controllers/hot-controller.js b/public/scripts/controllers/hot-controller.js index 2665f69..f37646e 100644 --- a/public/scripts/controllers/hot-controller.js +++ b/public/scripts/controllers/hot-controller.js @@ -1,7 +1,6 @@ app.controller('hotCtr', ['$scope', '$state', '$stateParams', '$filter', '$window', '$timeout', '$document', 'ngDialog', 'bookmarkService', 'pubSubService', 'dataService', function($scope, $state, $stateParams, $filter, $window, $timeout, $document, ngDialog, bookmarkService, pubSubService, dataService) { console.log("Hello hotCtr..."); - var browser = dataService.browser(); - if(browser.mobile && !browser.iPad){ + if(dataService.smallDevice()){ $window.location = "http://m.mybookmark.cn/#/tags"; return; } diff --git a/public/scripts/controllers/login-controller.js b/public/scripts/controllers/login-controller.js index 18a231d..812a0c0 100644 --- a/public/scripts/controllers/login-controller.js +++ b/public/scripts/controllers/login-controller.js @@ -1,8 +1,7 @@ app.controller('loginCtr', ['$scope', '$filter', '$state', '$cookieStore', '$window', 'bookmarkService', 'pubSubService', 'dataService', function($scope, $filter, $state, $cookieStore, $window, bookmarkService, pubSubService, dataService) { console.log("Hello loginCtr...", $cookieStore.get("username")); - var browser = dataService.browser(); - if(browser.mobile && !browser.iPad){ - $window.location = "http://m.mybookmark.cn/#/login"; + if(dataService.smallDevice()){ + $window.location = "http://m.mybookmark.cn/#/tags"; return; } diff --git a/public/scripts/controllers/menus-controller.js b/public/scripts/controllers/menus-controller.js index 7d0c6d5..58bb7a4 100644 --- a/public/scripts/controllers/menus-controller.js +++ b/public/scripts/controllers/menus-controller.js @@ -156,6 +156,16 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time }); } + $scope.coffee = function () { + $state.go('settings', { + formIndex: 6, + }); + pubSubService.publish('Common.menuActive', { + login: true, + index: dataService.LoginIndexSettings + }); + } + function updateMenuActive(index) { $('.ui.menu a.item').removeClass('selected'); $('.ui.menu a.item:eq(' + index + ')').addClass('selected'); diff --git a/public/scripts/controllers/note-controller.js b/public/scripts/controllers/note-controller.js index b1cca1f..97b788a 100644 --- a/public/scripts/controllers/note-controller.js +++ b/public/scripts/controllers/note-controller.js @@ -1,8 +1,7 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$window', '$timeout', '$document', 'ngDialog', 'bookmarkService', 'pubSubService', 'dataService', function ($scope, $state, $stateParams, $filter, $window, $timeout, $document, ngDialog, bookmarkService, pubSubService, dataService) { console.log("Hello noteCtr...", $stateParams); - var browser = dataService.browser(); - if(browser.mobile && !browser.iPad){ - $window.location = "http://m.mybookmark.cn/#/note"; + if(dataService.smallDevice()){ + $window.location = "http://m.mybookmark.cn/#/tags"; return; } diff --git a/public/scripts/controllers/praise-controller.js b/public/scripts/controllers/praise-controller.js index 8e78c7f..fe68b1c 100644 --- a/public/scripts/controllers/praise-controller.js +++ b/public/scripts/controllers/praise-controller.js @@ -1,6 +1,9 @@ app.controller('praiseCtr', ['$scope', '$state', '$stateParams', '$filter', '$window', '$timeout', 'ngDialog', 'bookmarkService', 'pubSubService', 'dataService', function($scope, $state, $stateParams, $filter, $window, $timeout, ngDialog, bookmarkService, pubSubService, dataService) { console.log("Hello praiseCtr...", $stateParams); - + if(dataService.smallDevice()){ + $window.location = "http://m.mybookmark.cn/#/tags"; + return; + } bookmarkService.autoLogin() .then((data) => { var login = data.logined; diff --git a/public/scripts/controllers/search-controller.js b/public/scripts/controllers/search-controller.js index 0bb477c..1d64c3d 100644 --- a/public/scripts/controllers/search-controller.js +++ b/public/scripts/controllers/search-controller.js @@ -1,8 +1,7 @@ app.controller('searchCtr', ['$scope', '$state', '$stateParams', '$filter', '$window', '$timeout', '$document', 'ngDialog', 'bookmarkService', 'pubSubService', 'dataService', function($scope, $state, $stateParams, $filter, $window, $timeout, $document, ngDialog, bookmarkService, pubSubService, dataService) { console.log("Hello searchCtr...", $stateParams); - var browser = dataService.browser(); - if(browser.mobile && !browser.iPad){ - $window.location = "http://m.mybookmark.cn/#/search"; + if(dataService.smallDevice()){ + $window.location = "http://m.mybookmark.cn/#/tags"; return; } diff --git a/public/scripts/controllers/settings-controller.js b/public/scripts/controllers/settings-controller.js index 1304f65..2c8d9f3 100644 --- a/public/scripts/controllers/settings-controller.js +++ b/public/scripts/controllers/settings-controller.js @@ -1,13 +1,12 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$window', '$timeout', 'bookmarkService', 'pubSubService', 'dataService', function($scope, $stateParams, $filter, $state, $window, $timeout, bookmarkService, pubSubService, dataService) { console.log('Hello settingsCtr......', $stateParams); - var browser = dataService.browser(); - if(browser.mobile && !browser.iPad){ - $window.location = "http://m.mybookmark.cn/#/settings"; + if(dataService.smallDevice()){ + $window.location = "http://m.mybookmark.cn/#/tags"; return; } $scope.forbidQuickKey = dataService.forbidQuickKey - $scope.form = [false, false, false, false, false, false]; + $scope.form = [false, false, false, false, false, false, false]; $scope.passwordOrgin = ""; $scope.passwordNew1 = ""; $scope.passwordNew2 = ""; diff --git a/public/scripts/controllers/tags-controller.js b/public/scripts/controllers/tags-controller.js index dced572..e748c31 100644 --- a/public/scripts/controllers/tags-controller.js +++ b/public/scripts/controllers/tags-controller.js @@ -1,7 +1,6 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$timeout', '$document', 'ngDialog', 'bookmarkService', 'pubSubService', 'dataService', function ($scope, $filter, $window, $stateParams, $timeout, $document, ngDialog, bookmarkService, pubSubService, dataService) { console.log("Hello tagsCtr...", $stateParams); - var browser = dataService.browser(); - if(browser.mobile && !browser.iPad){ + if(dataService.smallDevice()){ $window.location = "http://m.mybookmark.cn/#/tags"; return; } diff --git a/public/scripts/externe/jquery.form.js b/public/scripts/externe/jquery.form.js new file mode 100644 index 0000000..591ad6f --- /dev/null +++ b/public/scripts/externe/jquery.form.js @@ -0,0 +1,1277 @@ +/*! + * jQuery Form Plugin + * version: 3.51.0-2014.06.20 + * Requires jQuery v1.5 or later + * Copyright (c) 2014 M. Alsup + * Examples and documentation at: http://malsup.com/jquery/form/ + * Project repository: https://github.com/malsup/form + * Dual licensed under the MIT and GPL licenses. + * https://github.com/malsup/form#copyright-and-license + */ +/*global ActiveXObject */ + +// AMD support +(function (factory) { + "use strict"; + if (typeof define === 'function' && define.amd) { + // using AMD; register as anon module + define(['jquery'], factory); + } else { + // no AMD; invoke directly + factory( (typeof(jQuery) != 'undefined') ? jQuery : window.Zepto ); + } +} + +(function($) { +"use strict"; + +/* + Usage Note: + ----------- + Do not use both ajaxSubmit and ajaxForm on the same form. These + functions are mutually exclusive. Use ajaxSubmit if you want + to bind your own submit handler to the form. For example, + + $(document).ready(function() { + $('#myForm').on('submit', function(e) { + e.preventDefault(); // <-- important + $(this).ajaxSubmit({ + target: '#output' + }); + }); + }); + + Use ajaxForm when you want the plugin to manage all the event binding + for you. For example, + + $(document).ready(function() { + $('#myForm').ajaxForm({ + target: '#output' + }); + }); + + You can also use ajaxForm with delegation (requires jQuery v1.7+), so the + form does not have to exist when you invoke ajaxForm: + + $('#myForm').ajaxForm({ + delegation: true, + target: '#output' + }); + + When using ajaxForm, the ajaxSubmit function will be invoked for you + at the appropriate time. +*/ + +/** + * Feature detection + */ +var feature = {}; +feature.fileapi = $("").get(0).files !== undefined; +feature.formdata = window.FormData !== undefined; + +var hasProp = !!$.fn.prop; + +// attr2 uses prop when it can but checks the return type for +// an expected string. this accounts for the case where a form +// contains inputs with names like "action" or "method"; in those +// cases "prop" returns the element +$.fn.attr2 = function() { + if ( ! hasProp ) { + return this.attr.apply(this, arguments); + } + var val = this.prop.apply(this, arguments); + if ( ( val && val.jquery ) || typeof val === 'string' ) { + return val; + } + return this.attr.apply(this, arguments); +}; + +/** + * ajaxSubmit() provides a mechanism for immediately submitting + * an HTML form using AJAX. + */ +$.fn.ajaxSubmit = function(options) { + /*jshint scripturl:true */ + + // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) + if (!this.length) { + log('ajaxSubmit: skipping submit process - no element selected'); + return this; + } + + var method, action, url, $form = this; + + if (typeof options == 'function') { + options = { success: options }; + } + else if ( options === undefined ) { + options = {}; + } + + method = options.type || this.attr2('method'); + action = options.url || this.attr2('action'); + + url = (typeof action === 'string') ? $.trim(action) : ''; + url = url || window.location.href || ''; + if (url) { + // clean url (don't include hash vaue) + url = (url.match(/^([^#]+)/)||[])[1]; + } + + options = $.extend(true, { + url: url, + success: $.ajaxSettings.success, + type: method || $.ajaxSettings.type, + iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' + }, options); + + // hook for manipulating the form data before it is extracted; + // convenient for use with rich editors like tinyMCE or FCKEditor + var veto = {}; + this.trigger('form-pre-serialize', [this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); + return this; + } + + // provide opportunity to alter form data before it is serialized + if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSerialize callback'); + return this; + } + + var traditional = options.traditional; + if ( traditional === undefined ) { + traditional = $.ajaxSettings.traditional; + } + + var elements = []; + var qx, a = this.formToArray(options.semantic, elements); + if (options.data) { + options.extraData = options.data; + qx = $.param(options.data, traditional); + } + + // give pre-submit callback an opportunity to abort the submit + if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSubmit callback'); + return this; + } + + // fire vetoable 'validate' event + this.trigger('form-submit-validate', [a, this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); + return this; + } + + var q = $.param(a, traditional); + if (qx) { + q = ( q ? (q + '&' + qx) : qx ); + } + if (options.type.toUpperCase() == 'GET') { + options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; + options.data = null; // data is null for 'get' + } + else { + options.data = q; // data is the query string for 'post' + } + + var callbacks = []; + if (options.resetForm) { + callbacks.push(function() { $form.resetForm(); }); + } + if (options.clearForm) { + callbacks.push(function() { $form.clearForm(options.includeHidden); }); + } + + // perform a load on the target only if dataType is not provided + if (!options.dataType && options.target) { + var oldSuccess = options.success || function(){}; + callbacks.push(function(data) { + var fn = options.replaceTarget ? 'replaceWith' : 'html'; + $(options.target)[fn](data).each(oldSuccess, arguments); + }); + } + else if (options.success) { + callbacks.push(options.success); + } + + options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg + var context = options.context || this ; // jQuery 1.4+ supports scope context + for (var i=0, max=callbacks.length; i < max; i++) { + callbacks[i].apply(context, [data, status, xhr || $form, $form]); + } + }; + + if (options.error) { + var oldError = options.error; + options.error = function(xhr, status, error) { + var context = options.context || this; + oldError.apply(context, [xhr, status, error, $form]); + }; + } + + if (options.complete) { + var oldComplete = options.complete; + options.complete = function(xhr, status) { + var context = options.context || this; + oldComplete.apply(context, [xhr, status, $form]); + }; + } + + // are there files to upload? + + // [value] (issue #113), also see comment: + // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219 + var fileInputs = $('input[type=file]:enabled', this).filter(function() { return $(this).val() !== ''; }); + + var hasFileInputs = fileInputs.length > 0; + var mp = 'multipart/form-data'; + var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); + + var fileAPI = feature.fileapi && feature.formdata; + log("fileAPI :" + fileAPI); + var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI; + + var jqxhr; + + // options.iframe allows user to force iframe mode + // 06-NOV-09: now defaulting to iframe mode if file input is detected + if (options.iframe !== false && (options.iframe || shouldUseFrame)) { + // hack to fix Safari hang (thanks to Tim Molendijk for this) + // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d + if (options.closeKeepAlive) { + $.get(options.closeKeepAlive, function() { + jqxhr = fileUploadIframe(a); + }); + } + else { + jqxhr = fileUploadIframe(a); + } + } + else if ((hasFileInputs || multipart) && fileAPI) { + jqxhr = fileUploadXhr(a); + } + else { + jqxhr = $.ajax(options); + } + + $form.removeData('jqxhr').data('jqxhr', jqxhr); + + // clear element array + for (var k=0; k < elements.length; k++) { + elements[k] = null; + } + + // fire 'notify' event + this.trigger('form-submit-notify', [this, options]); + return this; + + // utility fn for deep serialization + function deepSerialize(extraData){ + var serialized = $.param(extraData, options.traditional).split('&'); + var len = serialized.length; + var result = []; + var i, part; + for (i=0; i < len; i++) { + // #252; undo param space replacement + serialized[i] = serialized[i].replace(/\+/g,' '); + part = serialized[i].split('='); + // #278; use array instead of object storage, favoring array serializations + result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]); + } + return result; + } + + // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz) + function fileUploadXhr(a) { + var formdata = new FormData(); + + for (var i=0; i < a.length; i++) { + formdata.append(a[i].name, a[i].value); + } + + if (options.extraData) { + var serializedData = deepSerialize(options.extraData); + for (i=0; i < serializedData.length; i++) { + if (serializedData[i]) { + formdata.append(serializedData[i][0], serializedData[i][1]); + } + } + } + + options.data = null; + + var s = $.extend(true, {}, $.ajaxSettings, options, { + contentType: false, + processData: false, + cache: false, + type: method || 'POST' + }); + + if (options.uploadProgress) { + // workaround because jqXHR does not expose upload property + s.xhr = function() { + var xhr = $.ajaxSettings.xhr(); + if (xhr.upload) { + xhr.upload.addEventListener('progress', function(event) { + var percent = 0; + var position = event.loaded || event.position; /*event.position is deprecated*/ + var total = event.total; + if (event.lengthComputable) { + percent = Math.ceil(position / total * 100); + } + options.uploadProgress(event, position, total, percent); + }, false); + } + return xhr; + }; + } + + s.data = null; + var beforeSend = s.beforeSend; + s.beforeSend = function(xhr, o) { + //Send FormData() provided by user + if (options.formData) { + o.data = options.formData; + } + else { + o.data = formdata; + } + if(beforeSend) { + beforeSend.call(this, xhr, o); + } + }; + return $.ajax(s); + } + + // private function for handling file uploads (hat tip to YAHOO!) + function fileUploadIframe(a) { + var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; + var deferred = $.Deferred(); + + // #341 + deferred.abort = function(status) { + xhr.abort(status); + }; + + if (a) { + // ensure that every serialized input is still enabled + for (i=0; i < elements.length; i++) { + el = $(elements[i]); + if ( hasProp ) { + el.prop('disabled', false); + } + else { + el.removeAttr('disabled'); + } + } + } + + s = $.extend(true, {}, $.ajaxSettings, options); + s.context = s.context || s; + id = 'jqFormIO' + (new Date().getTime()); + if (s.iframeTarget) { + $io = $(s.iframeTarget); + n = $io.attr2('name'); + if (!n) { + $io.attr2('name', id); + } + else { + id = n; + } + } + else { + $io = $('