百度:Tangram
基本上就是个百度版jQuery,2.0版本使用链式API,更像了。
配套的还有UI库Magic和模版引擎BaiduTemplate(和ejs很像)
腾讯:JX
理念在介绍里面写的很详细,代码清晰,注释丰富,可读性很好,但只有文档没有实例。
比较传统的大块头框架,本质上来说还是一堆工具方法和对象的堆积,提供了很基本的模块化的开发方式,但没有模块间的依赖关系支持。
| //**dataURL to blob** | |
| function dataURLtoBlob(dataurl) { | |
| var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1], | |
| bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n); | |
| while(n--){ | |
| u8arr[n] = bstr.charCodeAt(n); | |
| } | |
| return new Blob([u8arr], {type:mime}); | |
| } |
| /** | |
| * Beveled corners — with gradients | |
| */ | |
| div { | |
| background: #58a; | |
| background: linear-gradient(135deg, transparent 15px, #58a 0) top left, | |
| linear-gradient(-135deg, transparent 15px, #58a 0) top right, | |
| linear-gradient(-45deg, transparent 15px, #58a 0) bottom right, | |
| linear-gradient(45deg, transparent 15px, #58a 0) bottom left; |
| var guid = function() { | |
| var S4 = function() { | |
| return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); | |
| }; | |
| return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4()); | |
| }; |
| $.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 || ''); |
| <!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; |
| /* 前端JS代码 */ | |
| function addWine() { | |
| console.log('addWine'); | |
| $.ajax({ | |
| type: 'POST', | |
| contentType: 'application/json', | |
| url: rootURL, | |
| dataType: "json", | |
| data: formToJSON(), | |
| success: function(data, textStatus, jqXHR){ |
| 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; | |
| } |
| function clearSelection() { | |
| if(document.selection && document.selection.empty) { | |
| document.selection.empty(); | |
| } else if(window.getSelection) { | |
| var sel = window.getSelection(); | |
| sel.removeAllRanges(); | |
| } | |
| } |
| function isEven(number) { | |
| if (number === 0) { | |
| return true; | |
| } | |
| else { | |
| return isOdd(number - 1); | |
| } | |
| } | |
| function isOdd(number) { |