Skip to content

Instantly share code, notes, and snippets.

View geek01's full-sized avatar
🎯
Focusing

Chiung-Hung Lai geek01

🎯
Focusing
View GitHub Profile
@geek01
geek01 / ckeditor_json
Created October 18, 2013 02:40
insert json data into ckeditor
//CKEditor
$('#texta').blur(function(){
var nsn = $('#texta').val();
$.ajax({
type: 'GET',
url:'ajaxs.php',
data:'nsn=' + nsn,
dataType: 'json',
success:function(data){
$('#sch_name').val(data.news_title);
@geek01
geek01 / load jquery & jquery.ui
Created October 22, 2013 03:43
prevent loading jquery multiple times
$jquery="
<script type='text/javascript'>
if(typeof jQuery == 'undefined') {
document.write(\"<script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js'><\/script>\");
}
</script>
";
$jquery_ui="
@geek01
geek01 / Base.php
Created November 1, 2013 03:09
讓PHPWord能合併儲存格
<?php
/**
* PHPWord
*
* Copyright (c) 2011 PHPWord
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
<?php
/* Last updated with phpFlickr 3.1
*
* Edit these variables to reflect the values you need. $default_redirect
* and $permissions are only important if you are linking here instead of
* using phpFlickr::auth() from another page or if you set the remember_uri
* argument to false.
*/
// Include configuration file
@geek01
geek01 / jquery.validationEngine.js
Created February 20, 2014 05:56
讓jquery.validationEngine.js支援上傳格式檢查
//參考資料http://www.pressinganswer.com/883320/jquery-validation-engine-validation-file-mime-type
//jquery.validationEngine.js增加
case "checkFileType":
errorMsg = methods._checkFileType(field, rules, i, options);
break;
//jquery.validationEngine.js增加
_checkFileType: function (field, rules, i, options) {
var uploadedFile = $(field);
@geek01
geek01 / nicEdit
Last active August 29, 2015 13:56
解決NicEdit在ie6.7.8寬度不正常問題
//參考資料http://wordpress.org/support/topic/plugin-front-end-editor-text-area-become-very-narrow
尋找
(parseInt(e.getStyle('width')) || e.clientWidth)
取代為
(e.clientWidth || parseInt(e.getStyle('width')))
$(document).ready(function(){
var url = window.location.href;
$('a[href="'+url+'"]').parent().addClass('active');
});
(function() {
var flickerAPI = "https://api.flickr.com/services/rest/?";
$.getJSON(flickerAPI, {
format: "json"
})
.done(function(data) {
$.each(data.photoset.photo, function(i, item) {
$("<img>").attr("src", "https://farm"+item.farm+".staticflickr.com/"+item.server+"/"+item.id+"_"+item.secret+"_m.jpg").appendTo("#images");
if (i === 3) {
return false;
@geek01
geek01 / eguide_event.html
Last active August 29, 2015 14:14
eguide form Validation
<script type='text/javascript' src='http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.min.js'></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/localization/messages_zh_tw.js"></script>
<script type="text/javascript" src="<{$xoops_url}>/modules/eguide/class/jquery-validate.bootstrap-tooltip.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#register-form').validate({
rules: {
<{foreach from=$form.check key=name item=msg}>
'<{$name}>': 'required',
<{/foreach}>
@geek01
geek01 / birthday_select.html
Last active August 29, 2015 14:14
birthday select jQuery
<script type='text/javascript'>
$(function() {
for (i = new Date().getFullYear(); i > 1900; i--) {
$('.year_$fname').append($('<option />').val(i).html(i));
}
for (i = 1; i < 13; i++) {
$('.month_$fname').append($('<option />').val(i).html(i));
}
updateNumberOfDays();
$('.year_$fname, .month_$fname').on('change', function() {