PageRenderTime 52ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/docs/admin/js/custom.js

https://bitbucket.org/projectangelfaces/project-angel-faces
JavaScript | 376 lines | 265 code | 83 blank | 28 comment | 14 complexity | c5b932b775691c99a275faabdc656643 MD5 | raw file
  1. /* JS */
  2. /* Navigation */
  3. $(document).ready(function(){
  4. $(window).resize(function()
  5. {
  6. if($(window).width() >= 765){
  7. $(".sidebar #nav").slideDown(350);
  8. }
  9. else{
  10. $(".sidebar #nav").slideUp(350);
  11. }
  12. });
  13. $("#nav > li > a").on('click',function(e){
  14. if($(this).parent().hasClass("has_sub")) {
  15. e.preventDefault();
  16. }
  17. if(!$(this).hasClass("subdrop")) {
  18. // hide any open menus and remove all other classes
  19. $("#nav li ul").slideUp(350);
  20. $("#nav li a").removeClass("subdrop");
  21. // open our new menu and add the open class
  22. $(this).next("ul").slideDown(350);
  23. $(this).addClass("subdrop");
  24. }
  25. else if($(this).hasClass("subdrop")) {
  26. $(this).removeClass("subdrop");
  27. $(this).next("ul").slideUp(350);
  28. }
  29. });
  30. });
  31. $(document).ready(function(){
  32. $(".sidebar-dropdown a").on('click',function(e){
  33. e.preventDefault();
  34. if(!$(this).hasClass("open")) {
  35. // hide any open menus and remove all other classes
  36. $(".sidebar #nav").slideUp(350);
  37. $(".sidebar-dropdown a").removeClass("open");
  38. // open our new menu and add the open class
  39. $(".sidebar #nav").slideDown(350);
  40. $(this).addClass("open");
  41. }
  42. else if($(this).hasClass("open")) {
  43. $(this).removeClass("open");
  44. $(".sidebar #nav").slideUp(350);
  45. }
  46. });
  47. });
  48. /* Widget close */
  49. $('.wclose').click(function(e){
  50. e.preventDefault();
  51. var $wbox = $(this).parent().parent().parent();
  52. $wbox.hide(100);
  53. });
  54. /* Widget minimize */
  55. $('.wminimize').click(function(e){
  56. e.preventDefault();
  57. var $wcontent = $(this).parent().parent().next('.widget-content');
  58. if($wcontent.is(':visible'))
  59. {
  60. $(this).children('i').removeClass('icon-chevron-up');
  61. $(this).children('i').addClass('icon-chevron-down');
  62. }
  63. else
  64. {
  65. $(this).children('i').removeClass('icon-chevron-down');
  66. $(this).children('i').addClass('icon-chevron-up');
  67. }
  68. $wcontent.toggle(500);
  69. });
  70. /* Calendar */
  71. $(document).ready(function() {
  72. var date = new Date();
  73. var d = date.getDate();
  74. var m = date.getMonth();
  75. var y = date.getFullYear();
  76. $('#calendar').fullCalendar({
  77. header: {
  78. left: 'prev',
  79. center: 'title',
  80. right: 'month,agendaWeek,agendaDay,next'
  81. },
  82. editable: true,
  83. events: [
  84. {
  85. title: 'All Day Event',
  86. start: new Date(y, m, 1)
  87. },
  88. {
  89. title: 'Long Event',
  90. start: new Date(y, m, d-5),
  91. end: new Date(y, m, d-2)
  92. },
  93. {
  94. id: 999,
  95. title: 'Repeating Event',
  96. start: new Date(y, m, d-3, 16, 0),
  97. allDay: false
  98. },
  99. {
  100. id: 999,
  101. title: 'Repeating Event',
  102. start: new Date(y, m, d+4, 16, 0),
  103. allDay: false
  104. },
  105. {
  106. title: 'Meeting',
  107. start: new Date(y, m, d, 10, 30),
  108. allDay: false
  109. },
  110. {
  111. title: 'Lunch',
  112. start: new Date(y, m, d, 12, 0),
  113. end: new Date(y, m, d, 14, 0),
  114. allDay: false
  115. },
  116. {
  117. title: 'Birthday Party',
  118. start: new Date(y, m, d+1, 19, 0),
  119. end: new Date(y, m, d+1, 22, 30),
  120. allDay: false
  121. },
  122. {
  123. title: 'Click for Google',
  124. start: new Date(y, m, 28),
  125. end: new Date(y, m, 29),
  126. url: 'http://google.com/'
  127. }
  128. ]
  129. });
  130. });
  131. /* Progressbar animation */
  132. setTimeout(function(){
  133. $('.progress-animated .bar').each(function() {
  134. var me = $(this);
  135. var perc = me.attr("data-percentage");
  136. //TODO: left and right text handling
  137. var current_perc = 0;
  138. var progress = setInterval(function() {
  139. if (current_perc>=perc) {
  140. clearInterval(progress);
  141. } else {
  142. current_perc +=1;
  143. me.css('width', (current_perc)+'%');
  144. }
  145. me.text((current_perc)+'%');
  146. }, 600);
  147. });
  148. },600);
  149. /* Slider */
  150. $(function() {
  151. // Horizontal slider
  152. $( "#master1, #master2" ).slider({
  153. value: 60,
  154. orientation: "horizontal",
  155. range: "min",
  156. animate: true
  157. });
  158. $( "#master4, #master3" ).slider({
  159. value: 80,
  160. orientation: "horizontal",
  161. range: "min",
  162. animate: true
  163. });
  164. $("#master5, #master6").slider({
  165. range: true,
  166. min: 0,
  167. max: 400,
  168. values: [ 75, 200 ],
  169. slide: function( event, ui ) {
  170. $( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
  171. }
  172. });
  173. // Vertical slider
  174. $( "#eq > span" ).each(function() {
  175. // read initial values from markup and remove that
  176. var value = parseInt( $( this ).text(), 10 );
  177. $( this ).empty().slider({
  178. value: value,
  179. range: "min",
  180. animate: true,
  181. orientation: "vertical"
  182. });
  183. });
  184. });
  185. /* Support */
  186. $(document).ready(function(){
  187. $("#slist a").click(function(e){
  188. e.preventDefault();
  189. $(this).next('p').toggle(200);
  190. });
  191. });
  192. /* Scroll to Top */
  193. $(".totop").hide();
  194. $(function(){
  195. $(window).scroll(function(){
  196. if ($(this).scrollTop()>300)
  197. {
  198. $('.totop').slideDown();
  199. }
  200. else
  201. {
  202. $('.totop').slideUp();
  203. }
  204. });
  205. $('.totop a').click(function (e) {
  206. e.preventDefault();
  207. $('body,html').animate({scrollTop: 0}, 500);
  208. });
  209. });
  210. /* jQuery Notification */
  211. $(document).ready(function(){
  212. setTimeout(function() {noty({text: '<strong>Howdy! Hope you are doing good...</strong>',layout:'topRight',type:'information',timeout:15000});}, 7000);
  213. setTimeout(function() {noty({text: 'This is an all in one theme which includes Front End, Admin & E-Commerce. Dont miss it. Grab it now',layout:'topRight',type:'alert',timeout:13000});}, 9000);
  214. });
  215. $(document).ready(function() {
  216. $('.noty-alert').click(function (e) {
  217. e.preventDefault();
  218. noty({text: 'Some notifications goes here...',layout:'topRight',type:'alert',timeout:2000});
  219. });
  220. $('.noty-success').click(function (e) {
  221. e.preventDefault();
  222. noty({text: 'Some notifications goes here...',layout:'top',type:'success',timeout:2000});
  223. });
  224. $('.noty-error').click(function (e) {
  225. e.preventDefault();
  226. noty({text: 'Some notifications goes here...',layout:'topRight',type:'error',timeout:2000});
  227. });
  228. $('.noty-warning').click(function (e) {
  229. e.preventDefault();
  230. noty({text: 'Some notifications goes here...',layout:'bottom',type:'warning',timeout:2000});
  231. });
  232. $('.noty-information').click(function (e) {
  233. e.preventDefault();
  234. noty({text: 'Some notifications goes here...',layout:'topRight',type:'information',timeout:2000});
  235. });
  236. });
  237. /* Date picker */
  238. $(function() {
  239. $('#datetimepicker1').datetimepicker({
  240. pickTime: false
  241. });
  242. });
  243. $(function() {
  244. $('#datetimepicker2').datetimepicker({
  245. pickDate: false
  246. });
  247. });
  248. /* Bootstrap toggle */
  249. $('.toggle-button').toggleButtons({
  250. style: {
  251. // Accepted values ["primary", "danger", "info", "success", "warning"] or nothing
  252. enabled: "danger"
  253. }
  254. });
  255. $('.warning-toggle-button').toggleButtons({
  256. width:130,
  257. style: {
  258. // Accepted values ["primary", "danger", "info", "success", "warning"] or nothing
  259. enabled: "success",
  260. disabled: "danger"
  261. },
  262. label: {
  263. enabled: "Enabled",
  264. disabled: "Disabled"
  265. }
  266. });
  267. $('.info-toggle-button').toggleButtons({
  268. style: {
  269. // Accepted values ["primary", "danger", "info", "success", "warning"] or nothing
  270. enabled: "info"
  271. }
  272. });
  273. $('.success-toggle-button').toggleButtons({
  274. style: {
  275. // Accepted values ["primary", "danger", "info", "success", "warning"] or nothing
  276. enabled: "warning"
  277. }
  278. });
  279. /* Uniform - Form Styleing */
  280. $(document).ready(function() {
  281. $(".uni select, .uni input, .uni textarea").uniform();
  282. });
  283. /* CL Editor */
  284. $(".cleditor").cleditor({
  285. width: "auto",
  286. height: "auto"
  287. });
  288. /* Modal fix */
  289. $('.modal').appendTo($('body'));
  290. /* Pretty Photo for Gallery*/
  291. jQuery("a[class^='prettyPhoto']").prettyPhoto({
  292. overlay_gallery: false, social_tools: false
  293. });