Джанго проект
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (DjangoProga)" project-jdk-type="Python SDK" />
|
||||
<component name="PyCharmProfessionalAdvertiser">
|
||||
<option name="shown" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/DjangoProga.iml" filepath="$PROJECT_DIR$/.idea/DjangoProga.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,11 @@
|
||||
import psycopg2
|
||||
|
||||
def getcont2():
|
||||
connection = psycopg2.connect(host='localhost', dbname='dbdata', user='postgres', password='Q1w2e3r4')
|
||||
cursor = connection.cursor()
|
||||
cursor.execute("SELECT product, price, diagonal, resolution, cpu, ram, graphics_controller, volume, src FROM laptops")
|
||||
fetched = cursor.fetchall()
|
||||
return fetched
|
||||
cursor.close()
|
||||
connection.close()
|
||||
print(getcont2())
|
||||
@@ -0,0 +1,16 @@
|
||||
# This is a sample Python script.
|
||||
|
||||
# Press Shift+F10 to execute it or replace it with your code.
|
||||
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
|
||||
|
||||
|
||||
def print_hi(name):
|
||||
# Use a breakpoint in the code line below to debug your script.
|
||||
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
|
||||
|
||||
|
||||
# Press the green button in the gutter to run the script.
|
||||
if __name__ == '__main__':
|
||||
print_hi('PyCharm')
|
||||
|
||||
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
"""Django's command-line utility for administrative tasks."""
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
"""Run administrative tasks."""
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
ASGI config for mysite project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
|
||||
|
||||
application = get_asgi_application()
|
||||
@@ -0,0 +1,124 @@
|
||||
"""
|
||||
Django settings for mysite project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 4.2.1.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.2/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/4.2/ref/settings/
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-f=h1&j1_v0e4jqa0y4#5*-!(t)gv208k+ks$#%&*f#g#4@mg3='
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'polls.apps.PollsConfig',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'mysite.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'mysite.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / 'db.sqlite3',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/4.2/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
@@ -0,0 +1,23 @@
|
||||
"""
|
||||
URL configuration for mysite project.
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/4.2/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('polls/', include('polls.urls'))
|
||||
]
|
||||
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
WSGI config for mysite project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class PollsConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'polls'
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 545 B |
|
After Width: | Height: | Size: 699 B |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 76 KiB |
@@ -0,0 +1,33 @@
|
||||
|
||||
|
||||
/*-----------------count down js----------*/
|
||||
|
||||
|
||||
/*!
|
||||
* The Final Countdown for jQuery v2.1.0 (http://hilios.github.io/jQuery.countdown/)
|
||||
* Copyright (c) 2015 Edson Hilios
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){"use strict";function b(a){if(a instanceof Date)return a;if(String(a).match(g))return String(a).match(/^[0-9]*$/)&&(a=Number(a)),String(a).match(/\-/)&&(a=String(a).replace(/\-/g,"/")),new Date(a);throw new Error("Couldn't cast `"+a+"` to a date object.")}function c(a){var b=a.toString().replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");return new RegExp(b)}function d(a){return function(b){var d=b.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);if(d)for(var f=0,g=d.length;g>f;++f){var h=d[f].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/),j=c(h[0]),k=h[1]||"",l=h[3]||"",m=null;h=h[2],i.hasOwnProperty(h)&&(m=i[h],m=Number(a[m])),null!==m&&("!"===k&&(m=e(l,m)),""===k&&10>m&&(m="0"+m.toString()),b=b.replace(j,m.toString()))}return b=b.replace(/%%/,"%")}}function e(a,b){var c="s",d="";return a&&(a=a.replace(/(:|;|\s)/gi,"").split(/\,/),1===a.length?c=a[0]:(d=a[0],c=a[1])),1===Math.abs(b)?d:c}var f=[],g=[],h={precision:100,elapse:!1};g.push(/^[0-9]*$/.source),g.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g=new RegExp(g.join("|"));var i={Y:"years",m:"months",n:"daysToMonth",w:"weeks",d:"daysToWeek",D:"totalDays",H:"hours",M:"minutes",S:"seconds"},j=function(b,c,d){this.el=b,this.$el=a(b),this.interval=null,this.offset={},this.options=a.extend({},h),this.instanceNumber=f.length,f.push(this),this.$el.data("countdown-instance",this.instanceNumber),d&&("function"==typeof d?(this.$el.on("update.countdown",d),this.$el.on("stoped.countdown",d),this.$el.on("finish.countdown",d)):this.options=a.extend({},h,d)),this.setFinalDate(c),this.start()};a.extend(j.prototype,{start:function(){null!==this.interval&&clearInterval(this.interval);var a=this;this.update(),this.interval=setInterval(function(){a.update.call(a)},this.options.precision)},stop:function(){clearInterval(this.interval),this.interval=null,this.dispatchEvent("stoped")},toggle:function(){this.interval?this.stop():this.start()},pause:function(){this.stop()},resume:function(){this.start()},remove:function(){this.stop.call(this),f[this.instanceNumber]=null,delete this.$el.data().countdownInstance},setFinalDate:function(a){this.finalDate=b(a)},update:function(){if(0===this.$el.closest("html").length)return void this.remove();var b,c=void 0!==a._data(this.el,"events"),d=new Date;b=this.finalDate.getTime()-d.getTime(),b=Math.ceil(b/1e3),b=!this.options.elapse&&0>b?0:Math.abs(b),this.totalSecsLeft!==b&&c&&(this.totalSecsLeft=b,this.elapsed=d>=this.finalDate,this.offset={seconds:this.totalSecsLeft%60,minutes:Math.floor(this.totalSecsLeft/60)%60,hours:Math.floor(this.totalSecsLeft/60/60)%24,days:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToWeek:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToMonth:Math.floor(this.totalSecsLeft/60/60/24%30.4368),totalDays:Math.floor(this.totalSecsLeft/60/60/24),weeks:Math.floor(this.totalSecsLeft/60/60/24/7),months:Math.floor(this.totalSecsLeft/60/60/24/30.4368),years:Math.abs(this.finalDate.getFullYear()-d.getFullYear())},this.options.elapse||0!==this.totalSecsLeft?this.dispatchEvent("update"):(this.stop(),this.dispatchEvent("finish")))},dispatchEvent:function(b){var c=a.Event(b+".countdown");c.finalDate=this.finalDate,c.elapsed=this.elapsed,c.offset=a.extend({},this.offset),c.strftime=d(this.offset),this.$el.trigger(c)}}),a.fn.countdown=function(){var b=Array.prototype.slice.call(arguments,0);return this.each(function(){var c=a(this).data("countdown-instance");if(void 0!==c){var d=f[c],e=b[0];j.prototype.hasOwnProperty(e)?d[e].apply(d,b.slice(1)):null===String(e).match(/^[$A-Z_][0-9A-Z_$]*$/i)?(d.setFinalDate.call(d,e),d.start()):a.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi,e))}else new j(this,b[0],b[1])})}});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
/**
|
||||
* ImageZoom Plugin
|
||||
* http://0401morita.github.io/imagezoom-plugin
|
||||
* MIT licensed
|
||||
*
|
||||
* Copyright (C) 2014 http://0401morita.github.io/imagezoom-plugin A project by Yosuke Morita
|
||||
*/
|
||||
(function($){
|
||||
var defaults = {
|
||||
cursorcolor:'255,255,255',
|
||||
opacity:0.5,
|
||||
cursor:'crosshair',
|
||||
zindex:2147483647,
|
||||
zoomviewsize:[480,395],
|
||||
zoomviewposition:'right',
|
||||
zoomviewmargin:10,
|
||||
zoomviewborder:'none',
|
||||
magnification:1.925
|
||||
};
|
||||
|
||||
var imagezoomCursor,imagezoomView,settings,imageWidth,imageHeight,offset;
|
||||
var methods = {
|
||||
init : function(options){
|
||||
$this = $(this),
|
||||
imagezoomCursor = $('.imagezoom-cursor'),
|
||||
imagezoomView = $('.imagezoom-view'),
|
||||
$(document).on('mouseenter',$this.selector,function(e){
|
||||
var data = $(this).data();
|
||||
settings = $.extend({},defaults,options,data),
|
||||
offset = $(this).offset(),
|
||||
imageWidth = $(this).width(),
|
||||
imageHeight = $(this).height(),
|
||||
cursorSize = [(settings.zoomviewsize[0]/settings.magnification),(settings.zoomviewsize[1]/settings.magnification)];
|
||||
if(data.imagezoom == true){
|
||||
imageSrc = $(this).attr('src');
|
||||
}else{
|
||||
imageSrc = $(this).get(0).getAttribute('data-imagezoom');
|
||||
}
|
||||
|
||||
var posX = e.pageX,posY = e.pageY,zoomViewPositionX;
|
||||
$('body').prepend('<div class="imagezoom-cursor"> </div><div class="imagezoom-view"><img src="'+imageSrc+'"></div>');
|
||||
|
||||
if(settings.zoomviewposition == 'right'){
|
||||
zoomViewPositionX = (offset.left+imageWidth+settings.zoomviewmargin);
|
||||
}else{
|
||||
zoomViewPositionX = (offset.left-imageWidth-settings.zoomviewmargin);
|
||||
}
|
||||
|
||||
$(imagezoomView.selector).css({
|
||||
'position':'absolute',
|
||||
'left': zoomViewPositionX,
|
||||
'top': offset.top,
|
||||
'width': cursorSize[0]*settings.magnification,
|
||||
'height': cursorSize[1]*settings.magnification,
|
||||
'background':'#FFF',
|
||||
'z-index':2147483647,
|
||||
'overflow':'hidden',
|
||||
'border': settings.zoomviewborder
|
||||
});
|
||||
|
||||
$(imagezoomView.selector).children('img').css({
|
||||
'position':'absolute',
|
||||
'width': imageWidth*settings.magnification,
|
||||
'height': imageHeight*settings.magnification,
|
||||
});
|
||||
|
||||
$(imagezoomCursor.selector).css({
|
||||
'position':'absolute',
|
||||
'width':cursorSize[0],
|
||||
'height':cursorSize[1],
|
||||
'background-color':'rgb('+settings.cursorcolor+')',
|
||||
'z-index':settings.zindex,
|
||||
'opacity':settings.opacity,
|
||||
'cursor':settings.cursor
|
||||
});
|
||||
$(imagezoomCursor.selector).css({'top':posY-(cursorSize[1]/2),'left':posX});
|
||||
$(document).on('mousemove',document.body,methods.cursorPos);
|
||||
});
|
||||
},
|
||||
cursorPos:function(e){
|
||||
var posX = e.pageX,posY = e.pageY;
|
||||
if(posY < offset.top || posX < offset.left || posY > (offset.top+imageHeight) || posX > (offset.left+imageWidth)){
|
||||
$(imagezoomCursor.selector).remove();
|
||||
$(imagezoomView.selector).remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(posX-(cursorSize[0]/2) < offset.left){
|
||||
posX = offset.left+(cursorSize[0]/2);
|
||||
}else if(posX+(cursorSize[0]/2) > offset.left+imageWidth){
|
||||
posX = (offset.left+imageWidth)-(cursorSize[0]/2);
|
||||
}
|
||||
|
||||
if(posY-(cursorSize[1]/2) < offset.top){
|
||||
posY = offset.top+(cursorSize[1]/2);
|
||||
}else if(posY+(cursorSize[1]/2) > offset.top+imageHeight){
|
||||
posY = (offset.top+imageHeight)-(cursorSize[1]/2);
|
||||
}
|
||||
|
||||
$(imagezoomCursor.selector).css({'top':posY-(cursorSize[1]/2),'left':posX-(cursorSize[0]/2)});
|
||||
$(imagezoomView.selector).children('img').css({'top':((offset.top-posY)+(cursorSize[1]/2))*settings.magnification,'left':((offset.left-posX)+(cursorSize[0]/2))*settings.magnification});
|
||||
|
||||
$(imagezoomCursor.selector).mouseleave(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.imageZoom = function(method){
|
||||
if(methods[method]){
|
||||
return methods[method].apply( this, Array.prototype.slice.call(arguments,1));
|
||||
}else if( typeof method === 'object' || ! method ) {
|
||||
return methods.init.apply(this,arguments);
|
||||
}else{
|
||||
$.error(method);
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$('[data-imagezoom]').imageZoom();
|
||||
});
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,285 @@
|
||||
/*!
|
||||
* jQuery meanMenu v2.0.8
|
||||
* @Copyright (C) 2012-2014 Chris Wharton @ MeanThemes (https://github.com/meanthemes/meanMenu)
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT
|
||||
* HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR
|
||||
* FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE
|
||||
* OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS,
|
||||
* COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.COPYRIGHT HOLDERS WILL NOT
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL
|
||||
* DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://gnu.org/licenses/>.
|
||||
*
|
||||
* Find more information at http://www.meanthemes.com/plugins/meanmenu/
|
||||
*
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
$.fn.meanmenu = function (options) {
|
||||
var defaults = {
|
||||
meanMenuTarget: jQuery(this), // Target the current HTML markup you wish to replace
|
||||
meanMenuContainer: '.mobile-menu-area .container', // Choose where meanmenu will be placed within the HTML
|
||||
meanMenuClose: "X", // single character you want to represent the close menu button
|
||||
meanMenuCloseSize: "18px", // set font size of close button
|
||||
meanMenuOpen: "<span /><span /><span />", // text/markup you want when menu is closed
|
||||
meanRevealPosition: "right", // left right or center positions
|
||||
meanRevealPositionDistance: "0", // Tweak the position of the menu
|
||||
meanRevealColour: "", // override CSS colours for the reveal background
|
||||
meanScreenWidth: "991", // set the screen width you want meanmenu to kick in at
|
||||
meanNavPush: "", // set a height here in px, em or % if you want to budge your layout now the navigation is missing.
|
||||
meanShowChildren: true, // true to show children in the menu, false to hide them
|
||||
meanExpandableChildren: true, // true to allow expand/collapse children
|
||||
meanExpand: "+", // single character you want to represent the expand for ULs
|
||||
meanContract: "-", // single character you want to represent the contract for ULs
|
||||
meanRemoveAttrs: false, // true to remove classes and IDs, false to keep them
|
||||
onePage: false, // set to true for one page sites
|
||||
meanDisplay: "block", // override display method for table cell based layouts e.g. table-cell
|
||||
removeElements: "" // set to hide page elements
|
||||
};
|
||||
options = $.extend(defaults, options);
|
||||
|
||||
// get browser width
|
||||
var currentWidth = window.innerWidth || document.documentElement.clientWidth;
|
||||
|
||||
return this.each(function () {
|
||||
var meanMenu = options.meanMenuTarget;
|
||||
var meanContainer = options.meanMenuContainer;
|
||||
var meanMenuClose = options.meanMenuClose;
|
||||
var meanMenuCloseSize = options.meanMenuCloseSize;
|
||||
var meanMenuOpen = options.meanMenuOpen;
|
||||
var meanRevealPosition = options.meanRevealPosition;
|
||||
var meanRevealPositionDistance = options.meanRevealPositionDistance;
|
||||
var meanRevealColour = options.meanRevealColour;
|
||||
var meanScreenWidth = options.meanScreenWidth;
|
||||
var meanNavPush = options.meanNavPush;
|
||||
var meanRevealClass = ".meanmenu-reveal";
|
||||
var meanShowChildren = options.meanShowChildren;
|
||||
var meanExpandableChildren = options.meanExpandableChildren;
|
||||
var meanExpand = options.meanExpand;
|
||||
var meanContract = options.meanContract;
|
||||
var meanRemoveAttrs = options.meanRemoveAttrs;
|
||||
var onePage = options.onePage;
|
||||
var meanDisplay = options.meanDisplay;
|
||||
var removeElements = options.removeElements;
|
||||
|
||||
//detect known mobile/tablet usage
|
||||
var isMobile = false;
|
||||
if ( (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)) || (navigator.userAgent.match(/Android/i)) || (navigator.userAgent.match(/Blackberry/i)) || (navigator.userAgent.match(/Windows Phone/i)) ) {
|
||||
isMobile = true;
|
||||
}
|
||||
|
||||
if ( (navigator.userAgent.match(/MSIE 8/i)) || (navigator.userAgent.match(/MSIE 7/i)) ) {
|
||||
// add scrollbar for IE7 & 8 to stop breaking resize function on small content sites
|
||||
jQuery('html').css("overflow-y" , "scroll");
|
||||
}
|
||||
|
||||
var meanRevealPos = "";
|
||||
var meanCentered = function() {
|
||||
if (meanRevealPosition === "center") {
|
||||
var newWidth = window.innerWidth || document.documentElement.clientWidth;
|
||||
var meanCenter = ( (newWidth/2)-22 )+"px";
|
||||
meanRevealPos = "left:" + meanCenter + ";right:auto;";
|
||||
|
||||
if (!isMobile) {
|
||||
jQuery('.meanmenu-reveal').css("left",meanCenter);
|
||||
} else {
|
||||
jQuery('.meanmenu-reveal').animate({
|
||||
left: meanCenter
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var menuOn = false;
|
||||
var meanMenuExist = false;
|
||||
|
||||
|
||||
if (meanRevealPosition === "right") {
|
||||
meanRevealPos = "right:" + meanRevealPositionDistance + ";left:auto;";
|
||||
}
|
||||
if (meanRevealPosition === "left") {
|
||||
meanRevealPos = "left:" + meanRevealPositionDistance + ";right:auto;";
|
||||
}
|
||||
// run center function
|
||||
meanCentered();
|
||||
|
||||
// set all styles for mean-reveal
|
||||
var $navreveal = "";
|
||||
|
||||
var meanInner = function() {
|
||||
// get last class name
|
||||
if (jQuery($navreveal).is(".meanmenu-reveal.meanclose")) {
|
||||
$navreveal.html(meanMenuClose);
|
||||
} else {
|
||||
$navreveal.html(meanMenuOpen);
|
||||
}
|
||||
};
|
||||
|
||||
// re-instate original nav (and call this on window.width functions)
|
||||
var meanOriginal = function() {
|
||||
jQuery('.mean-bar,.mean-push').remove();
|
||||
jQuery(meanContainer).removeClass("mean-container");
|
||||
jQuery(meanMenu).css('display', meanDisplay);
|
||||
menuOn = false;
|
||||
meanMenuExist = false;
|
||||
jQuery(removeElements).removeClass('mean-remove');
|
||||
};
|
||||
|
||||
// navigation reveal
|
||||
var showMeanMenu = function() {
|
||||
var meanStyles = "background:"+meanRevealColour+";color:"+meanRevealColour+";"+meanRevealPos;
|
||||
if (currentWidth <= meanScreenWidth) {
|
||||
jQuery(removeElements).addClass('mean-remove');
|
||||
meanMenuExist = true;
|
||||
// add class to body so we don't need to worry about media queries here, all CSS is wrapped in '.mean-container'
|
||||
jQuery(meanContainer).addClass("mean-container");
|
||||
jQuery('.mean-container').prepend('<div class="mean-bar"><a href="#nav" class="meanmenu-reveal" style="'+meanStyles+'">Show Navigation</a><nav class="mean-nav"></nav></div>');
|
||||
|
||||
//push meanMenu navigation into .mean-nav
|
||||
var meanMenuContents = jQuery(meanMenu).html();
|
||||
jQuery('.mean-nav').html(meanMenuContents);
|
||||
|
||||
// remove all classes from EVERYTHING inside meanmenu nav
|
||||
if(meanRemoveAttrs) {
|
||||
jQuery('nav.mean-nav ul, nav.mean-nav ul *').each(function() {
|
||||
// First check if this has mean-remove class
|
||||
if (jQuery(this).is('.mean-remove')) {
|
||||
jQuery(this).attr('class', 'mean-remove');
|
||||
} else {
|
||||
jQuery(this).removeAttr("class");
|
||||
}
|
||||
jQuery(this).removeAttr("id");
|
||||
});
|
||||
}
|
||||
|
||||
// push in a holder div (this can be used if removal of nav is causing layout issues)
|
||||
jQuery(meanMenu).before('<div class="mean-push" />');
|
||||
jQuery('.mean-push').css("margin-top",meanNavPush);
|
||||
|
||||
// hide current navigation and reveal mean nav link
|
||||
jQuery(meanMenu).hide();
|
||||
jQuery(".meanmenu-reveal").show();
|
||||
|
||||
// turn 'X' on or off
|
||||
jQuery(meanRevealClass).html(meanMenuOpen);
|
||||
$navreveal = jQuery(meanRevealClass);
|
||||
|
||||
//hide mean-nav ul
|
||||
jQuery('.mean-nav ul').hide();
|
||||
|
||||
// hide sub nav
|
||||
if(meanShowChildren) {
|
||||
// allow expandable sub nav(s)
|
||||
if(meanExpandableChildren){
|
||||
jQuery('.mean-nav ul ul').each(function() {
|
||||
if(jQuery(this).children().length){
|
||||
jQuery(this,'li:first').parent().append('<a class="mean-expand" href="#" style="font-size: '+ meanMenuCloseSize +'">'+ meanExpand +'</a>');
|
||||
}
|
||||
});
|
||||
jQuery('.mean-expand').on("click",function(e){
|
||||
e.preventDefault();
|
||||
if (jQuery(this).hasClass("mean-clicked")) {
|
||||
jQuery(this).text(meanExpand);
|
||||
jQuery(this).prev('ul').slideUp(300, function(){});
|
||||
} else {
|
||||
jQuery(this).text(meanContract);
|
||||
jQuery(this).prev('ul').slideDown(300, function(){});
|
||||
}
|
||||
jQuery(this).toggleClass("mean-clicked");
|
||||
});
|
||||
} else {
|
||||
jQuery('.mean-nav ul ul').show();
|
||||
}
|
||||
} else {
|
||||
jQuery('.mean-nav ul ul').hide();
|
||||
}
|
||||
|
||||
// add last class to tidy up borders
|
||||
jQuery('.mean-nav ul li').last().addClass('mean-last');
|
||||
$navreveal.removeClass("meanclose");
|
||||
jQuery($navreveal).click(function(e){
|
||||
e.preventDefault();
|
||||
if( menuOn === false ) {
|
||||
$navreveal.css("text-align", "center");
|
||||
$navreveal.css("text-indent", "0");
|
||||
$navreveal.css("font-size", meanMenuCloseSize);
|
||||
jQuery('.mean-nav ul:first').slideDown();
|
||||
menuOn = true;
|
||||
} else {
|
||||
jQuery('.mean-nav ul:first').slideUp();
|
||||
menuOn = false;
|
||||
}
|
||||
$navreveal.toggleClass("meanclose");
|
||||
meanInner();
|
||||
jQuery(removeElements).addClass('mean-remove');
|
||||
});
|
||||
|
||||
// for one page websites, reset all variables...
|
||||
if ( onePage ) {
|
||||
jQuery('.mean-nav ul > li > a:first-child').on( "click" , function () {
|
||||
jQuery('.mean-nav ul:first').slideUp();
|
||||
menuOn = false;
|
||||
jQuery($navreveal).toggleClass("meanclose").html(meanMenuOpen);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
meanOriginal();
|
||||
}
|
||||
};
|
||||
|
||||
if (!isMobile) {
|
||||
// reset menu on resize above meanScreenWidth
|
||||
jQuery(window).resize(function () {
|
||||
currentWidth = window.innerWidth || document.documentElement.clientWidth;
|
||||
if (currentWidth > meanScreenWidth) {
|
||||
meanOriginal();
|
||||
} else {
|
||||
meanOriginal();
|
||||
}
|
||||
if (currentWidth <= meanScreenWidth) {
|
||||
showMeanMenu();
|
||||
meanCentered();
|
||||
} else {
|
||||
meanOriginal();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
jQuery(window).resize(function () {
|
||||
// get browser width
|
||||
currentWidth = window.innerWidth || document.documentElement.clientWidth;
|
||||
|
||||
if (!isMobile) {
|
||||
meanOriginal();
|
||||
if (currentWidth <= meanScreenWidth) {
|
||||
showMeanMenu();
|
||||
meanCentered();
|
||||
}
|
||||
} else {
|
||||
meanCentered();
|
||||
if (currentWidth <= meanScreenWidth) {
|
||||
if (meanMenuExist === false) {
|
||||
showMeanMenu();
|
||||
}
|
||||
} else {
|
||||
meanOriginal();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// run main menuMenu function on load
|
||||
showMeanMenu();
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
||||