您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

functions.js 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975
  1. $(function() {
  2. //===== File manager =====//
  3. var elf = $('#fileManager').elfinder({
  4. url : 'php/connector.php', // connector URL (REQUIRED)
  5. uiOptions : {
  6. // toolbar configuration
  7. toolbar : [
  8. ['back', 'forward'],
  9. ['info'],
  10. ['quicklook'],
  11. ['search']
  12. ]
  13. },
  14. contextmenu : {
  15. // Commands that can be executed for current directory
  16. cwd : ['reload', 'delim', 'info'],
  17. // Commands for only one selected file
  18. files : ['select', 'open']
  19. }
  20. }).elfinder('instance');
  21. //===== ShowCode plugin for <pre> tag =====//
  22. //$('.code').sourcerer('js html css php'); // Display all languages
  23. //===== Left navigation styling =====//
  24. $('.subNav li a.this').parent('li').addClass('activeli');
  25. //===== Login pic hover animation =====//
  26. $(".loginPic").hover(
  27. function() {
  28. $('.logleft, .logback').animate({left:10, opacity:1},200);
  29. $('.logright').animate({right:10, opacity:1},200); },
  30. function() {
  31. $('.logleft, .logback').animate({left:0, opacity:0},200);
  32. $('.logright').animate({right:0, opacity:0},200); }
  33. );
  34. //===== Image gallery control buttons =====//
  35. $(".gallery ul li").hover(
  36. function() { $(this).children(".actions").show("fade", 200); },
  37. function() { $(this).children(".actions").hide("fade", 200); }
  38. );
  39. //===== Autocomplete =====//
  40. var availableTags = [ "ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme" ];
  41. $( ".ac" ).autocomplete({
  42. source: availableTags
  43. });
  44. //===== jQuery file tree =====//
  45. /*$('.filetree').fileTree({
  46. root: '../images/',
  47. script: 'php/jqueryFileTree.php',
  48. expandSpeed: 200,
  49. collapseSpeed: 200,
  50. multiFolder: true
  51. }, function(file) {
  52. alert(file);
  53. });*/
  54. //===== Resizable columns =====//
  55. $("#resize, #resize2").colResizable({
  56. liveDrag:true,
  57. draggingClass:"dragging"
  58. });
  59. //===== Bootstrap functions =====//
  60. // Loading button
  61. $('#loading').click(function () {
  62. var btn = $(this)
  63. btn.button('loading')
  64. setTimeout(function () {
  65. btn.button('reset')
  66. }, 3000)
  67. });
  68. // Dropdown
  69. $('.dropdown-toggle').dropdown();
  70. //===== Animated progress bars (ID dependency) =====//
  71. var percent = $('#bar1').attr('title');
  72. $('#bar1').animate({width: percent},1000);
  73. var percent = $('#bar2').attr('title');
  74. $('#bar2').animate({width: percent},1000);
  75. var percent = $('#bar3').attr('title');
  76. $('#bar3').animate({width: percent},1000);
  77. var percent = $('#bar4').attr('title');
  78. $('#bar4').animate({width: percent},1000);
  79. var percent = $('#bar5').attr('title');
  80. $('#bar5').animate({width: percent},1000);
  81. var percent = $('#bar6').attr('title');
  82. $('#bar6').animate({width: percent},1000);
  83. var percent = $('#bar7').attr('title');
  84. $('#bar7').animate({width: percent},1000);
  85. var percent = $('#bar8').attr('title');
  86. $('#bar8').animate({width: percent},1000);
  87. var percent = $('#bar9').attr('title');
  88. $('#bar9').animate({width: percent},1000);
  89. var percent = $('#bar10').attr('title');
  90. $('#bar10').animate({width: percent},1000);
  91. //===== Fancybox =====//
  92. $(".lightbox").fancybox({
  93. 'padding': 2
  94. });
  95. //===== Color picker =====//
  96. $('#cPicker').ColorPicker({
  97. color: '#e62e90',
  98. onShow: function (colpkr) {
  99. $(colpkr).fadeIn(500);
  100. return false;
  101. },
  102. onHide: function (colpkr) {
  103. $(colpkr).fadeOut(500);
  104. return false;
  105. },
  106. onChange: function (hsb, hex, rgb) {
  107. $('#cPicker div').css('backgroundColor', '#' + hex);
  108. }
  109. });
  110. $('#flatPicker').ColorPicker({flat: true});
  111. //===== Time picker =====//
  112. $('.timepicker').timeEntry({
  113. show24Hours: true, // 24 hours format
  114. showSeconds: true, // Show seconds?
  115. spinnerImage: 'images/elements/ui/spinner.png', // Arrows image
  116. spinnerSize: [19, 26, 0], // Image size
  117. spinnerIncDecOnly: true // Only up and down arrows
  118. });
  119. //===== Usual validation engine=====//
  120. /*$("#usualValidate").validate({
  121. rules: {
  122. firstname: "required",
  123. minChars: {
  124. required: true,
  125. minlength: 3
  126. },
  127. maxChars: {
  128. required: true,
  129. maxlength: 6
  130. },
  131. mini: {
  132. required: true,
  133. min: 3
  134. },
  135. maxi: {
  136. required: true,
  137. max: 6
  138. },
  139. range: {
  140. required: true,
  141. range: [6, 16]
  142. },
  143. emailField: {
  144. required: true,
  145. email: true
  146. },
  147. urlField: {
  148. required: true,
  149. url: true
  150. },
  151. dateField: {
  152. required: true,
  153. date: true
  154. },
  155. digitsOnly: {
  156. required: true,
  157. digits: true
  158. },
  159. enterPass: {
  160. required: true,
  161. minlength: 5
  162. },
  163. repeatPass: {
  164. required: true,
  165. minlength: 5,
  166. equalTo: "#enterPass"
  167. },
  168. customMessage: "required",
  169. topic: {
  170. required: "#newsletter:checked",
  171. minlength: 2
  172. },
  173. agree: "required"
  174. },
  175. messages: {
  176. customMessage: {
  177. required: "Bazinga! This message is editable",
  178. },
  179. agree: "Please accept our policy"
  180. }
  181. });*/
  182. //===== Validation engine =====//
  183. //$("#validate").validationEngine();
  184. //===== iButtons =====//
  185. $('.on_off :checkbox, .on_off :radio').iButton({
  186. labelOn: "",
  187. labelOff: "",
  188. enableDrag: false
  189. });
  190. $('.yes_no :checkbox, .yes_no :radio').iButton({
  191. labelOn: "On",
  192. labelOff: "Off",
  193. enableDrag: false
  194. });
  195. $('.enabled_disabled :checkbox, .enabled_disabled :radio').iButton({
  196. labelOn: "Enabled",
  197. labelOff: "Disabled",
  198. enableDrag: false
  199. });
  200. //===== Notification boxes =====//
  201. $(".nNote").click(function() {
  202. $(this).fadeTo(200, 0.00, function(){ //fade
  203. $(this).slideUp(200, function() { //slide up
  204. $(this).remove(); //then remove from the DOM
  205. });
  206. });
  207. });
  208. //===== Animate current li when closing button clicked =====//
  209. $(".remove").click(function() {
  210. $(this).parent('li').fadeTo(200, 0.00, function(){ //fade
  211. $(this).slideUp(200, function() { //slide up
  212. $(this).remove(); //then remove from the DOM
  213. });
  214. });
  215. });
  216. //===== Check all checbboxes =====//
  217. $(".titleIcon input:checkbox").click(function() {
  218. var checkedStatus = this.checked;
  219. $("#checkAll tbody tr td:first-child input:checkbox").each(function() {
  220. this.checked = checkedStatus;
  221. if (checkedStatus == this.checked) {
  222. $(this).closest('.checker > span').removeClass('checked');
  223. $(this).closest('table tbody tr').removeClass('thisRow');
  224. }
  225. if (this.checked) {
  226. $(this).closest('.checker > span').addClass('checked');
  227. $(this).closest('table tbody tr').addClass('thisRow');
  228. }
  229. });
  230. });
  231. $(function() {
  232. $('#checkAll tbody tr td:first-child input[type=checkbox]').change(function() {
  233. $(this).closest('tr').toggleClass("thisRow", this.checked);
  234. });
  235. });
  236. //===== File uploader =====//
  237. $("#uploader").pluploadQueue({
  238. runtimes : 'html5,html4',
  239. url : 'php/upload.php',
  240. max_file_size : '100kb',
  241. unique_names : true,
  242. filters : [
  243. {title : "Image files", extensions : "jpg,gif,png"}
  244. ]
  245. });
  246. //===== Wizards =====//
  247. /*$("#wizard1").formwizard({
  248. formPluginEnabled: true,
  249. validationEnabled: false,
  250. focusFirstInput : false,
  251. disableUIStyles : true,
  252. formOptions :{
  253. success: function(data){$("#status1").fadeTo(500,1,function(){ $(this).html("<span>Form was submitted!</span>").fadeTo(5000, 0); })},
  254. beforeSubmit: function(data){$("#w1").html("<span>Form was submitted with ajax. Data sent to the server: " + $.param(data) + "</span>");},
  255. resetForm: true
  256. }
  257. });
  258. $("#wizard2").formwizard({
  259. formPluginEnabled: true,
  260. validationEnabled: true,
  261. focusFirstInput : false,
  262. disableUIStyles : true,
  263. formOptions :{
  264. success: function(data){$("#status2").fadeTo(500,1,function(){ $(this).html("<span>Form was submitted!</span>").fadeTo(5000, 0); })},
  265. beforeSubmit: function(data){$("#w2").html("<span>Form was submitted with ajax. Data sent to the server: " + $.param(data) + "</span>");},
  266. dataType: 'json',
  267. resetForm: true
  268. },
  269. validationOptions : {
  270. rules: {
  271. bazinga: "required",
  272. email: { required: true, email: true }
  273. },
  274. messages: {
  275. bazinga: "Bazinga. This note is editable",
  276. email: { required: "Please specify your email", email: "Correct format is name@domain.com" }
  277. }
  278. }
  279. });
  280. $("#wizard3").formwizard({
  281. formPluginEnabled: false,
  282. validationEnabled: false,
  283. focusFirstInput : false,
  284. disableUIStyles : true
  285. });*/
  286. //===== WYSIWYG editor =====//
  287. $("#editor").cleditor({
  288. width:"100%",
  289. height:"250px",
  290. bodyStyle: "margin: 10px; font: 12px Arial,Verdana; cursor:text",
  291. useCSS:true
  292. });
  293. //===== Dual select boxes =====//
  294. $.configureBoxes();
  295. //===== Select2 dropdowns =====//
  296. $(".select").select2();
  297. $(".selectMultiple").select2();
  298. $("#loadingdata").select2({
  299. placeholder: "Enter at least 1 character",
  300. allowClear: true,
  301. minimumInputLength: 1,
  302. query: function (query) {
  303. var data = {results: []}, i, j, s;
  304. for (i = 1; i < 5; i++) {
  305. s = "";
  306. for (j = 0; j < i; j++) {s = s + query.term;}
  307. data.results.push({id: query.term + i, text: s});
  308. }
  309. query.callback(data);
  310. }
  311. });
  312. $("#maxselect").select2({ maximumSelectionSize: 3 });
  313. $("#minselect").select2({
  314. minimumInputLength: 2,
  315. width: 'element'
  316. });
  317. $("#minselect2").select2({
  318. minimumInputLength: 2
  319. });
  320. $("#disableselect, #disableselect2").select2(
  321. "disable"
  322. );
  323. //===== Autotabs. Inline data rows =====//
  324. $('.onlyNums input').autotab_magic().autotab_filter('numeric');
  325. $('.onlyText input').autotab_magic().autotab_filter('text');
  326. $('.onlyAlpha input').autotab_magic().autotab_filter('alpha');
  327. $('.onlyRegex input').autotab_magic().autotab_filter({ format: 'custom', pattern: '[^0-9\.]' });
  328. $('.allUpper input').autotab_magic().autotab_filter({ format: 'alphanumeric', uppercase: true });
  329. //===== Masked input =====//
  330. $.mask.definitions['~'] = "[+-]";
  331. $(".maskDate").mask("99/99/9999",{completed:function(){alert("Callback when completed");}});
  332. $(".maskPhone").mask("(999) 999-9999");
  333. $(".maskPhoneExt").mask("(999) 999-9999? x99999");
  334. $(".maskIntPhone").mask("+33 999 999 999");
  335. $(".maskTin").mask("99-9999999");
  336. $(".maskSsn").mask("999-99-9999");
  337. $(".maskProd").mask("a*-999-a999", { placeholder: " " });
  338. $(".maskEye").mask("~9.99 ~9.99 999");
  339. $(".maskPo").mask("PO: aaa-999-***");
  340. $(".maskPct").mask("99%");
  341. //===== Tags =====//
  342. $('.tags').tagsInput({width:'100%'});
  343. //===== Input limiter =====//
  344. $('.lim').inputlimiter({
  345. limit: 100,
  346. boxId: 'limitingtext',
  347. boxAttach: false
  348. });
  349. //===== Elastic textarea =====//
  350. $('.auto').autosize();
  351. //===== Full width sidebar dropdown =====//
  352. $('.fulldd li').click(function () {
  353. $(this).children("ul").slideToggle(150);
  354. });
  355. $(document).bind('click', function(e) {
  356. var $clicked = $(e.target);
  357. if (! $clicked.parents().hasClass("has"))
  358. $('.fulldd li').children("ul").slideUp(150);
  359. });
  360. //===== Top panel search field =====//
  361. $('.userNav a.search').click(function () {
  362. $('.topSearch').fadeToggle(150);
  363. });
  364. //===== 2 responsive buttons (320px - 480px) =====//
  365. $('.iTop').click(function () {
  366. $('#sidebar').slideToggle(100);
  367. });
  368. $('.iButton').click(function () {
  369. $('.altMenu').slideToggle(100);
  370. });
  371. //===== Animated dropdown for the right links group on breadcrumbs line =====//
  372. $('.breadLinks ul li').click(function () {
  373. $(this).children("ul").slideToggle(150);
  374. });
  375. $(document).bind('click', function(e) {
  376. var $clicked = $(e.target);
  377. if (! $clicked.parents().hasClass("has"))
  378. $('.breadLinks ul li').children("ul").slideUp(150);
  379. });
  380. //===== Easy tabs =====//
  381. $('#tab-container').easytabs({
  382. animationSpeed: 300,
  383. collapsible: false,
  384. tabActiveClass: "clicked"
  385. });
  386. //===== Tabs =====//
  387. $( ".tabs" ).tabs();
  388. var tabs = $( ".tabs-sortable" ).tabs();
  389. tabs.find( ".ui-tabs-nav" ).sortable({
  390. axis: "x",
  391. stop: function() {
  392. tabs.tabs( "refresh" );
  393. }
  394. });
  395. //===== Dynamic data table =====//
  396. /*oTable = $('.dTable').dataTable({
  397. "bJQueryUI": false,
  398. "bAutoWidth": false,
  399. "sPaginationType": "full_numbers",
  400. "sDom": '<"tablePars"fl>t<"tableFooter"ip>',
  401. "oLanguage": {
  402. "sLengthMenu": "<span class='showentries'>Show entries:</span> _MENU_"
  403. }
  404. });*/
  405. //== Adding class to :last-child elements ==//
  406. $(".subNav li:last-child a, .formRow:last-child, .userList li:last-child, table tbody tr:last-child td, .breadLinks ul li ul li:last-child, .fulldd li ul li:last-child, .niceList li:last-child").addClass("noBorderB")
  407. //===== Add classes for sub sidebar detection =====//
  408. if ($('div').hasClass('secNav')) {
  409. $('#sidebar').addClass('with');
  410. //$('#content').addClass('withSide');
  411. }
  412. else {
  413. $('#sidebar').addClass('without');
  414. $('#content').css('margin-left','100px');//.addClass('withoutSide');
  415. $('#footer > .wrapper').addClass('fullOne');
  416. };
  417. //===== Collapsible elements management =====//
  418. $('.exp').collapsible({
  419. defaultOpen: 'current',
  420. cookieName: 'navAct',
  421. cssOpen: 'subOpened',
  422. cssClose: 'subClosed',
  423. speed: 200
  424. });
  425. $('.opened').collapsible({
  426. defaultOpen: 'opened,toggleOpened',
  427. cssOpen: 'inactive',
  428. cssClose: 'normal',
  429. speed: 200
  430. });
  431. $('.closed').collapsible({
  432. defaultOpen: '',
  433. cssOpen: 'inactive',
  434. cssClose: 'normal',
  435. speed: 200
  436. });
  437. //===== Accordion =====//
  438. $('div.menu_body:eq(0)').show();
  439. $('.acc .whead:eq(0)').show().css({color:"#2B6893"});
  440. $(".acc .whead").click(function() {
  441. $(this).css({color:"#2B6893"}).next("div.menu_body").slideToggle(200).siblings("div.menu_body").slideUp("slow");
  442. $(this).siblings().css({color:"#404040"});
  443. });
  444. //===== Breadcrumbs =====//
  445. $('#breadcrumbs').xBreadcrumbs();
  446. //===== User nav dropdown =====//
  447. $('a.leftUserDrop').click(function () {
  448. $('.leftUser').slideToggle(200);
  449. });
  450. $(document).bind('click', function(e) {
  451. var $clicked = $(e.target);
  452. if (! $clicked.parents().hasClass("leftUserDrop"))
  453. $(".leftUser").slideUp(200);
  454. });
  455. //===== Tooltips =====//
  456. $('.tipN').tipsy({gravity: 'n',fade: true, html:true});
  457. $('.tipS').tipsy({gravity: 's',fade: true, html:true});
  458. $('.tipW').tipsy({gravity: 'w',fade: true, html:true});
  459. $('.tipE').tipsy({gravity: 'e',fade: true, html:true});
  460. //===== Calendar =====//
  461. var date = new Date();
  462. var d = date.getDate();
  463. var m = date.getMonth();
  464. var y = date.getFullYear();
  465. $('#calendar').fullCalendar({
  466. header: {
  467. left: 'prev,next',
  468. center: 'title',
  469. right: 'month,agendaWeek,agendaDay'
  470. },
  471. editable: true,
  472. events: [
  473. {
  474. title: 'All Day Event',
  475. start: new Date(y, m, 1)
  476. },
  477. {
  478. title: 'Long Event',
  479. start: new Date(y, m, d-5),
  480. end: new Date(y, m, d-2)
  481. },
  482. {
  483. id: 999,
  484. title: 'Repeating Event',
  485. start: new Date(y, m, d-3, 16, 0),
  486. allDay: false
  487. },
  488. {
  489. id: 999,
  490. title: 'Repeating Event',
  491. start: new Date(y, m, d+4, 16, 0),
  492. allDay: false
  493. },
  494. {
  495. title: 'Meeting',
  496. start: new Date(y, m, d, 10, 30),
  497. allDay: false
  498. },
  499. {
  500. title: 'Lunch',
  501. start: new Date(y, m, d, 12, 0),
  502. end: new Date(y, m, d, 14, 0),
  503. allDay: false
  504. },
  505. {
  506. title: 'Birthday Party',
  507. start: new Date(y, m, d+1, 19, 0),
  508. end: new Date(y, m, d+1, 22, 30),
  509. allDay: false
  510. },
  511. {
  512. title: 'Click for Google',
  513. start: new Date(y, m, 28),
  514. end: new Date(y, m, 29),
  515. url: 'http://google.com/'
  516. }
  517. ]
  518. });
  519. //===== Spinner options =====//
  520. $( "#spinner-default" ).spinner();
  521. $( "#spinner-decimal" ).spinner({
  522. step: 0.01,
  523. numberFormat: "n"
  524. });
  525. $( "#culture" ).change(function() {
  526. var current = $( "#spinner-decimal" ).spinner( "value" );
  527. Globalize.culture( $(this).val() );
  528. $( "#spinner-decimal" ).spinner( "value", current );
  529. });
  530. $( "#currency" ).change(function() {
  531. $( "#spinner-currency" ).spinner( "option", "culture", $( this ).val() );
  532. });
  533. $( "#spinner-currency" ).spinner({
  534. min: 5,
  535. max: 2500,
  536. step: 25,
  537. start: 1000,
  538. numberFormat: "C"
  539. });
  540. $( "#spinner-overflow" ).spinner({
  541. spin: function( event, ui ) {
  542. if ( ui.value > 10 ) {
  543. $( this ).spinner( "value", -10 );
  544. return false;
  545. } else if ( ui.value < -10 ) {
  546. $( this ).spinner( "value", 10 );
  547. return false;
  548. }
  549. }
  550. });
  551. $.widget( "ui.timespinner", $.ui.spinner, {
  552. options: {
  553. // seconds
  554. step: 60 * 1000,
  555. // hours
  556. page: 60
  557. },
  558. _parse: function( value ) {
  559. if ( typeof value === "string" ) {
  560. // already a timestamp
  561. if ( Number( value ) == value ) {
  562. return Number( value );
  563. }
  564. return +Globalize.parseDate( value );
  565. }
  566. return value;
  567. },
  568. _format: function( value ) {
  569. return Globalize.format( new Date(value), "t" );
  570. }
  571. });
  572. $( "#spinner-time" ).timespinner();
  573. $( "#culture-time" ).change(function() {
  574. var current = $( "#spinner-time" ).timespinner( "value" );
  575. Globalize.culture( $(this).val() );
  576. $( "#spinner-time" ).timespinner( "value", current );
  577. });
  578. //===== jQuery UI dialog =====//
  579. $('#dialog').dialog({
  580. autoOpen: false,
  581. width: 400,
  582. buttons: {
  583. "Gotcha": function () {
  584. $(this).dialog("close");
  585. },
  586. "Cancel": function () {
  587. $(this).dialog("close");
  588. }
  589. }
  590. });
  591. // Dialog Link
  592. $('#dialog_open').click(function () {
  593. $('#dialog').dialog('open');
  594. return false;
  595. });
  596. // Dialog
  597. $('#formDialog').dialog({
  598. autoOpen: false,
  599. width: 400,
  600. buttons: {
  601. "Nice stuff": function () {
  602. $(this).dialog("close");
  603. },
  604. "Cancel": function () {
  605. $(this).dialog("close");
  606. }
  607. }
  608. });
  609. // Dialog Link
  610. $('#formDialog_open').click(function () {
  611. $('#formDialog').dialog('open');
  612. return false;
  613. });
  614. // Dialog
  615. $('#customDialog').dialog({
  616. autoOpen: false,
  617. width: 650,
  618. buttons: {
  619. "Very cool!": function () {
  620. $(this).dialog("close");
  621. },
  622. "Cancel": function () {
  623. $(this).dialog("close");
  624. }
  625. }
  626. });
  627. // Dialog Link
  628. $('#customDialog_open').click(function () {
  629. $('#customDialog').dialog('open');
  630. return false;
  631. });
  632. //===== Vertical sliders =====//
  633. $( "#eq > span" ).each(function() {
  634. // read initial values from markup and remove that
  635. var value = parseInt( $( this ).text(), 10 );
  636. $( this ).empty().slider({
  637. value: value,
  638. range: "min",
  639. animate: true,
  640. orientation: "vertical"
  641. });
  642. });
  643. //===== Modal =====//
  644. $('#dialog-modal').dialog({
  645. autoOpen: false,
  646. width: 400,
  647. modal: true,
  648. buttons: {
  649. "Yep!": function() {
  650. $( this ).dialog( "close" );
  651. }
  652. }
  653. });
  654. $('#modal_open').click(function () {
  655. $('#dialog-modal').dialog('open');
  656. return false;
  657. });
  658. //===== jQuery UI stuff =====//
  659. // default mode
  660. $('#progress1').anim_progressbar();
  661. // from second #5 till 15
  662. var iNow = new Date().setTime(new Date().getTime() + 5 * 1000); // now plus 5 secs
  663. var iEnd = new Date().setTime(new Date().getTime() + 15 * 1000); // now plus 15 secs
  664. $('#progress2').anim_progressbar({start: iNow, finish: iEnd, interval: 1});
  665. // Progressbar
  666. $("#progress").progressbar({
  667. value: 80
  668. });
  669. // Modal Link
  670. $('#modal_link').click(function () {
  671. $('#dialog-message').dialog('open');
  672. return false;
  673. });
  674. // Datepicker
  675. $('.inlinedate').datepicker({
  676. inline: true,
  677. showOtherMonths:true
  678. });
  679. $( ".datepicker" ).datepicker({
  680. defaultDate: +7,
  681. showOtherMonths:true,
  682. autoSize: true,
  683. appendText: '(dd-mm-yyyy)',
  684. dateFormat: 'dd-mm-yy'
  685. });
  686. $(function() {
  687. var dates = $( "#fromDate, #toDate" ).datepicker({
  688. defaultDate: "+1w",
  689. changeMonth: false,
  690. showOtherMonths:true,
  691. numberOfMonths: 3,
  692. onSelect: function( selectedDate ) {
  693. var option = this.id == "fromDate" ? "minDate" : "maxDate",
  694. instance = $( this ).data( "datepicker" ),
  695. date = $.datepicker.parseDate(
  696. instance.settings.dateFormat ||
  697. $.datepicker._defaults.dateFormat,
  698. selectedDate, instance.settings );
  699. dates.not( this ).datepicker( "option", option, date );
  700. }
  701. });
  702. });
  703. $( ".uSlider" ).slider(); /* Usual slider */
  704. $( ".uRange" ).slider({ /* Range slider */
  705. range: true,
  706. min: 0,
  707. max: 500,
  708. values: [ 75, 300 ],
  709. slide: function( event, ui ) {
  710. $( "#rangeAmount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
  711. }
  712. });
  713. $( "#rangeAmount" ).val( "$" + $( ".uRange" ).slider( "values", 0 ) +" - $" + $( ".uRange" ).slider( "values", 1 ));
  714. $( ".uMin" ).slider({ /* Slider with minimum */
  715. range: "min",
  716. value: 37,
  717. min: 1,
  718. max: 700,
  719. slide: function( event, ui ) {
  720. $( "#minRangeAmount" ).val( "$" + ui.value );
  721. }
  722. });
  723. $( "#minRangeAmount" ).val( "$" + $( ".uMin" ).slider( "value" ) );
  724. $( ".uMax" ).slider({ /* Slider with maximum */
  725. range: "max",
  726. min: 1,
  727. max: 100,
  728. value: 20,
  729. slide: function( event, ui ) {
  730. $( "#maxRangeAmount" ).val( ui.value );
  731. }
  732. });
  733. $( "#maxRangeAmount" ).val( $( ".uMax" ).slider( "value" ) );
  734. //===== Add class on #content resize. Needed for responsive grid =====//
  735. $(window).resize(function () {
  736. var width = $("#content").width();
  737. if (width < 769) {
  738. $("#content").addClass('under');
  739. }
  740. else { $("#content").removeClass('under') }
  741. }).resize(); // Run resize on window load
  742. //===== Button for showing up sidebar on iPad portrait mode. Appears on right top =====//
  743. $("ul.userNav li a.sidebar").click(function() {
  744. $(".secNav").toggleClass('display');
  745. });
  746. //===== Form elements styling =====//
  747. $(".styled, input:radio, input:checkbox, .dataTables_length select").uniform();
  748. });