├── mocha.opts ├── demo ├── index.md ├── gallery.md ├── _config.yml ├── _includes │ ├── header.html │ ├── facebook.html │ ├── promo.html │ ├── head.html │ └── footer.html ├── _data │ └── egjs.yml ├── common │ ├── css │ │ ├── gallery.css │ │ ├── monokai.css │ │ └── page.css │ ├── image │ │ ├── logo_mono.svg │ │ ├── type_white.svg │ │ ├── logo_mono_black.svg │ │ ├── type_black.svg │ │ ├── cp-arrow-right.svg │ │ └── logo.svg │ └── js │ │ └── app.js ├── _layouts │ ├── gallery.html │ └── page.html ├── started.md ├── assets │ ├── html │ │ └── demo.html │ ├── js │ │ └── demo.js │ └── css │ │ └── demo.css └── demo.md ├── .github ├── PULL_REQUEST_TEMPLATE.md ├── ISSUE_TEMPLATE.md └── stale.yml ├── src ├── index.js ├── utils.js └── Visible.js ├── .editorconfig ├── config ├── uglify.js ├── webpack.config.development.js ├── banner.js ├── webpack.config.packaged.js ├── commit.template ├── webpack.config.production.js ├── release.js ├── validate-commit-msg.js └── changelog.js ├── bower.json ├── .travis.yml ├── .eslintrc ├── .babelrc ├── .npmignore ├── webpack.parts.js ├── test ├── unit │ ├── utils.spec.js │ ├── list.tmpl.html │ ├── observe.tmpl.html │ ├── targetContainer.tmpl.html │ ├── fixed.tmpl.html │ ├── pre.tmpl.html │ └── visible.spec.js └── manual │ ├── observer │ ├── js │ │ └── test.js │ └── index.html │ ├── js │ └── test.js │ └── index.html ├── LICENSE ├── webpack.config.js ├── NOTICE ├── jsdoc.json ├── karma.conf.js ├── CONTRIBURING.md ├── package.json ├── .gitignore └── README.md /mocha.opts: -------------------------------------------------------------------------------- 1 | --timeout 10000 -------------------------------------------------------------------------------- /demo/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | --- 4 | -------------------------------------------------------------------------------- /demo/gallery.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: gallery 3 | --- 4 | -------------------------------------------------------------------------------- /demo/_config.yml: -------------------------------------------------------------------------------- 1 | # Build settings 2 | source: demo 3 | destination: demo/_site 4 | exclude: [started.md, demo.md] 5 | markdown: kramdown -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Issue 2 | 3 | 4 | ## Details 5 | 6 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) NAVER Corp. 3 | * egjs-visible projects are licensed under the MIT license 4 | */ 5 | import Visible from "./Visible"; 6 | 7 | module.exports = Visible; 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | 3 | 4 | ## Steps to check or reproduce 5 | 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*.js] 5 | charset = utf-8 6 | end_of_line = lf 7 | indent_style = tab 8 | insert_final_newline = true 9 | max_line_length = 80 10 | trim_trailing_whitespace = true 11 | 12 | [{package.json,.travis.yml}] 13 | indent_style = space 14 | indent_size = 2 15 | -------------------------------------------------------------------------------- /config/uglify.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | include: /\.min\.js$/, 3 | beautify: false, 4 | mangle: { 5 | screw_ie8: false, 6 | keep_fnames: true 7 | }, 8 | compress: { 9 | screw_ie8: false, 10 | warnings: false 11 | }, 12 | output: { 13 | screw_ie8: false 14 | }, 15 | comments: false, 16 | sourceMap: true 17 | }; 18 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egjs-visible", 3 | "version": "2.0.0-rc.1", 4 | "license": "MIT", 5 | "keywords": [ 6 | "egjs", 7 | "visible", 8 | "plugin", 9 | "javaScript", 10 | "jQuery" 11 | ], 12 | "ignore": [ 13 | "**/.*", 14 | "bower_components", 15 | "node_modules" 16 | ], 17 | "main": "dist/visible.js" 18 | } 19 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "6" 4 | dist: trusty 5 | sudo: false 6 | install: 7 | - npm install 8 | addons: 9 | chrome: stable 10 | cache: 11 | directories: 12 | - "node_modules" 13 | before_script: 14 | - npm run lint 15 | script: 16 | - npm run coverage 17 | after_success: 18 | - npm run coveralls 19 | -------------------------------------------------------------------------------- /demo/_includes/header.html: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | // Naver https://github.com/naver/eslint-config-naver/blob/master/STYLE_GUIDE.md 3 | "extends": "naver", 4 | "rules": { 5 | "comma-dangle": ["error", { 6 | "arrays": "always-multiline", 7 | "objects": "always-multiline", 8 | "imports": "always-multiline", 9 | "exports": "always-multiline", 10 | "functions": "never" 11 | }] 12 | } 13 | } -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "es2015", 5 | { 6 | "loose": true 7 | } 8 | ] 9 | ], 10 | "plugins": [ 11 | "add-module-exports", 12 | "transform-object-assign", 13 | "transform-es3-property-literals", 14 | "transform-es3-member-expression-literals" 15 | ] 16 | } -------------------------------------------------------------------------------- /demo/_includes/facebook.html: -------------------------------------------------------------------------------- 1 |
2 | 9 | -------------------------------------------------------------------------------- /config/webpack.config.development.js: -------------------------------------------------------------------------------- 1 | var merge = require("webpack-merge"); 2 | var WriteFilePlugin = require("write-file-webpack-plugin"); 3 | 4 | var config = { 5 | devtool: "inline-source-map", 6 | devServer: { 7 | publicPath: "/dist/" 8 | }, 9 | plugins: [new WriteFilePlugin()] 10 | }; 11 | 12 | module.exports = function (common) { 13 | return merge(common, config); 14 | }; 15 | -------------------------------------------------------------------------------- /demo/_data/egjs.yml: -------------------------------------------------------------------------------- 1 | component: Visible 2 | home: //naver.github.io/egjs 3 | desc: A class that checks if an element is visible in the base element or viewport. 4 | dist: 5 | - release/latest/dist/visible.pkgd.min.js 6 | hashtag: "#visibility" 7 | GA: UA-70842526-13 8 | github: 9 | user: naver 10 | repo: egjs-visible 11 | js: 12 | - assets/js/demo.js 13 | css: 14 | - assets/css/demo.css -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | #configs 2 | config 3 | bower.json 4 | 5 | #tests 6 | test 7 | karma.conf.js 8 | 9 | #build tools 10 | webpack.*.js 11 | .travis.yml 12 | .codeclimate.yml 13 | 14 | #linters 15 | .eslintrc* 16 | 17 | #docs 18 | doc 19 | demo 20 | jsdoc.json 21 | README.md 22 | 23 | #editor settings 24 | .idea 25 | .editorconfig 26 | 27 | coverage/ 28 | node_modules/ 29 | .github 30 | .babelrc 31 | mocha.opts 32 | demo -------------------------------------------------------------------------------- /config/banner.js: -------------------------------------------------------------------------------- 1 | var pkg = require("../package.json"); 2 | 3 | module.exports = { 4 | common: [ 5 | "Copyright (c) 2017 " + pkg.author.name, 6 | pkg.name + " project is licensed under the " + pkg.license + " license", 7 | "", 8 | pkg.name + " JavaScript library", 9 | pkg.homepage, 10 | "", 11 | "@version " + pkg.version 12 | ].join("\r\n"), 13 | pkgd: [ 14 | "All-in-one packaged file for ease use of '" + pkg.name + "' with below dependencies.", 15 | "NOTE: This is not an official distribution file and is only for user convenience.", 16 | ""].join("\r\n") 17 | }; 18 | -------------------------------------------------------------------------------- /webpack.parts.js: -------------------------------------------------------------------------------- 1 | exports.development = function(options) { 2 | return { 3 | devServer: { 4 | publicPath: "/dist/" 5 | }, 6 | devtool: "inline-source-map" 7 | } 8 | }; 9 | 10 | exports.production = function(options) { 11 | return { 12 | entry: { 13 | // it will merged config.entry 14 | "visible.min": "./src/index.js" 15 | }, 16 | devtool: "cheap-module-source-map" 17 | } 18 | }; 19 | 20 | exports.productionPackaged = function(options) { 21 | return { 22 | entry: { 23 | "visible.pkgd": "./src/index.js", 24 | "visible.pkgd.min": "./src/index.js" 25 | }, 26 | externals: { 27 | // it will overwrite config.externals 28 | } 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /demo/common/css/gallery.css: -------------------------------------------------------------------------------- 1 | .highlighter-rouge { 2 | display:none !important; 3 | } 4 | 5 | .docs { 6 | padding : 20px 0; 7 | } 8 | 9 | .docs .docs-inner { 10 | padding: 1px 30px 30px 30px; 11 | } 12 | 13 | .moreBtn { 14 | float: right; 15 | background: #000; 16 | border-radius: 42px; 17 | border: none; 18 | margin-top:6px; 19 | display: inline-block; 20 | cursor: pointer; 21 | color: rgb(255, 255, 255); 22 | font-size: 14px; 23 | font-weight: bold; 24 | padding: 4px 6px; 25 | text-decoration: none; 26 | } 27 | 28 | h3 { 29 | padding-left: 10px; 30 | border: 0px; 31 | border-left-width: 10px; 32 | border-color: #eebf3f; 33 | border-style: solid; 34 | } -------------------------------------------------------------------------------- /config/webpack.config.packaged.js: -------------------------------------------------------------------------------- 1 | var merge = require("webpack-merge"); 2 | var webpack = require("webpack"); 3 | var UglifyJSPlugin = require("uglifyjs-webpack-plugin"); 4 | var uglifyConfig = require("./uglify"); 5 | var banner = require("./banner"); 6 | 7 | var config = { 8 | entry: { 9 | "visible.pkgd": "./src/index.js", 10 | "visible.pkgd.min": "./src/index.js" 11 | }, 12 | externals: [], 13 | plugins: [ 14 | new UglifyJSPlugin(uglifyConfig), 15 | new webpack.BannerPlugin([banner.common, "", banner.pkgd].join("\r\n")) 16 | ] 17 | }; 18 | 19 | module.exports = function (common) { 20 | return merge.strategy({ 21 | entry: "replace", 22 | externals: "replace", 23 | plugins: "append" 24 | })(common, config); 25 | }; 26 | -------------------------------------------------------------------------------- /demo/_includes/promo.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |

6 | {{ site.data.egjs.component }}v{{ site.data.version }} 7 |

8 |

{{ site.data.egjs.desc }}
9 | {{ site.data.egjs.hashtag }} 10 |

11 |
12 |
-------------------------------------------------------------------------------- /demo/_includes/head.html: -------------------------------------------------------------------------------- 1 | 2 | {{ site.data.egjs.github.repo }} 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/unit/utils.spec.js: -------------------------------------------------------------------------------- 1 | import {$} from "../../src/utils"; 2 | 3 | describe("Util Test", function() { 4 | beforeEach(() => { 5 | this.el = sandbox(); 6 | }); 7 | afterEach(() => { 8 | cleanup(); 9 | }); 10 | it("should check `$` method", () => { 11 | // Given 12 | // When 13 | const complicatedHTML = "

"; 14 | const div = complicatedHTML; // string 15 | const divs = [complicatedHTML, complicatedHTML]; 16 | 17 | // Then 18 | expect($(div) instanceof HTMLElement).to.be.true; 19 | expect($(divs) instanceof HTMLElement).to.be.true; 20 | expect($(divs, true).length).to.be.equal(2); 21 | expect($("#sandbox")).to.be.equal(this.el); 22 | expect(this.el).to.be.equal(this.el); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 30 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - wontstale 8 | # Label to use when marking an issue as stale 9 | staleLabel: stale 10 | # Comment to post when marking an issue as stale. Set to `false` to disable 11 | markComment: > 12 | This issue/PR has been automatically marked as stale because it has not had any update (including 13 | commits, comments, labels, milestones, etc) for 30 days. It will be closed automatically if no 14 | further update occurs in 7 day. Thank you for your contributions! 15 |
한글 16 | 이 이슈/PR은 commits, comments, labels, milestones 등 30일간 활동이 없어 자동으로 stale 상태로 전환되었습니다. 이후 7일간 활동이 없다면 자동으로 닫힐 예정입니다. 프로젝트 개선에 기여해주셔서 감사합니다. 17 |
18 | # Comment to post when closing a stale issue. Set to `false` to disable 19 | closeComment: false 20 | -------------------------------------------------------------------------------- /config/commit.template: -------------------------------------------------------------------------------- 1 | ========== Commit Format ========== 2 | (): 3 | 4 | (optional) 5 | 6 |