百度:Tangram
基本上就是个百度版jQuery,2.0版本使用链式API,更像了。
配套的还有UI库Magic和模版引擎BaiduTemplate(和ejs很像)
腾讯:JX
理念在介绍里面写的很详细,代码清晰,注释丰富,可读性很好,但只有文档没有实例。
比较传统的大块头框架,本质上来说还是一堆工具方法和对象的堆积,提供了很基本的模块化的开发方式,但没有模块间的依赖关系支持。
| /* | |
| 12306 Auto Query => A javascript snippet to help you book tickets online. | |
| Copyright (C) 2011-2012 Jingqin Lynn | |
| Includes jQuery | |
| Copyright 2011, John Resig | |
| Dual licensed under the MIT or GPL Version 2 licenses. | |
| http://jquery.org/license | |
| Includes Sizzle.js |
| window.onload = function () { | |
| drag(document.getElementById('drag'), [200, 400, 30, 300]); | |
| }; | |
| function drag(o, r) { | |
| o.firstChild.onmousedown = function () { | |
| return false; | |
| }; | |
| o.onmousedown = function (a) { | |
| o.style.cursor = 'move'; |
| // http://dancewithnet.com/2007/12/04/a-javascript-module-pattern/ | |
| <script type="text/javascript" src="http://yui.yahooapis.com/2.2.2/build/utilities/utilities.js"></script> | |
| <ul id="myList"> | |
| <li class="draggable">一项</li> | |
| <li>二项</li> | |
| <li class="draggable">三项</li> | |
| </ul> | |
| <script> | |
| YAHOO.namespace("myProject"); | |
| YAHOO.myProject.myModule = function () { |
| function isEven(number) { | |
| if (number === 0) { | |
| return true; | |
| } | |
| else { | |
| return isOdd(number - 1); | |
| } | |
| } | |
| function isOdd(number) { |
| function clearSelection() { | |
| if(document.selection && document.selection.empty) { | |
| document.selection.empty(); | |
| } else if(window.getSelection) { | |
| var sel = window.getSelection(); | |
| sel.removeAllRanges(); | |
| } | |
| } |
| function getConnection() { | |
| $dbhost="127.0.0.1"; | |
| $dbuser="root"; | |
| $dbpass="root"; | |
| $dbname="cellar"; | |
| $dbh = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8';")); | |
| $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
| return $dbh; | |
| } |
| /* 前端JS代码 */ | |
| function addWine() { | |
| console.log('addWine'); | |
| $.ajax({ | |
| type: 'POST', | |
| contentType: 'application/json', | |
| url: rootURL, | |
| dataType: "json", | |
| data: formToJSON(), | |
| success: function(data, textStatus, jqXHR){ |
| <!DOCTYPE html> | |
| <meta charset=utf-8> | |
| <meta name=viewport content="width=device-width, initial-scale=1, maximum-scale=1"> | |
| <meta name=apple-mobile-web-app-capable content=yes> | |
| <meta name=apple-mobile-web-app-status-bar-style content=black> | |
| <title>Test fullscreen</title> | |
| <style> | |
| html, body { | |
| margin: 0; | |
| padding: 0; |
| $.fn.serializeObject = function() | |
| { | |
| var o = {}; | |
| var a = this.serializeArray(); | |
| $.each(a, function() { | |
| if (o[this.name]) { | |
| if (!o[this.name].push) { | |
| o[this.name] = [o[this.name]]; | |
| } | |
| o[this.name].push(this.value || ''); |